Skip to content

Instantly share code, notes, and snippets.

View nicoforteza's full-sized avatar
🎯
Focusing

Nico Forteza nicoforteza

🎯
Focusing
View GitHub Profile
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)
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
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__)
@nicoforteza
nicoforteza / backtest.py
Last active May 19, 2021 09:21
backtest code
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: