This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import requests | |
import json | |
# API url | |
url = "http://0.0.0.0:5000/ad" | |
# data path | |
data = "dir/input/data/test/X.csv" | |
# load data to test the API - we are not testing the model! | |
x = pd.read_csv(data, index_col=0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
import sys | |
import os | |
import json | |
import traceback | |
import pandas as pd | |
from pyod.models.iforest import IForest | |
# directory where all the info is stored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
import pickle | |
import flask | |
import pandas as pd | |
prefix = "dir/" | |
model_path = os.path.join(prefix, 'model') | |
app = flask.Flask(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
# names for the asset selection | |
NAMES = ['6M_Momentum', '1Y_Momentum', '6M_LowVol'] | |
# allocation algorithm names (equally weighted) | |
ALLOCATION = ['EW'] | |
class Backtest: |