def __init__(self): #self.dbhandler = services.get('dbhandler') self.dbreader = services.get('dbreader') self.trader = services.get('trader') self.config = services.get('configurator') self.predictor = services.get('predictor') self.model = None self.start_date = None self.end_date = None
def __init__(self): BaseBackTester.__init__(self) self.model = services.get('mean_reversion_model') self.window_size = 10 self.threshold = 1.5
def __init__(self): self.dbhandler = services.get('dbhandler') self.dbreader = services.get('dbreader') self.predictor = services.get('predictor') self.config = services.get('configurator')
def __init__(self): BaseBackTester.__init__(self) self.model = services.get('machine_learning_model')
def __init__(self, wait_sec=5): self.wait_sec = wait_sec self.dbwriter = services.get('dbwriter') self.dbhandler = services.get('dbhandler')
def __init__(self): self.dbhandler = services.get('dbhandler')
def __init__(self): self.dbreader = services.get('dbreader') self.config = services.get('configurator') self.items = {}
def makeDataSet(self, code, start_date, end_date): df = services.get('dbreader').loadDataFrame(code, start_date, end_date) return df
services.register('predictor', Predictors()) services.register('trader', MessTrader()) services.register('mean_reversion_model', MeanReversionModel()) services.register('machine_learning_model', MachineLearningModel()) crawler = DataCrawler() universe = Portfolio() portfolio = PortfolioBuilder() mean_backtester = MeanReversionBackTester() machine_backtester = MachineLearningBackTester() #crawler.updateAllCodes() #crawler.updateAllStockData(1, 2010, 1, 1, 2015, 12, 1, start_index=90) services.get('configurator').register('start_date', '20150101') services.get('configurator').register('end_date', '20151031') services.get('configurator').register('input_column', 'price_adj_close') services.get('configurator').register('output_column', 'indicator') services.get('configurator').register('data_limit', 20) #finder.setTimePeriod('20150101', '20151130') df_stationarity = portfolio.doStationarityTest('price_close') df_rank = portfolio.rankStationarity(df_stationarity) stationarity_codes = portfolio.buildUniverse(df_rank, 'rank', 0.8) #print(stationarity_codes) df_machine_result = portfolio.doMachineLearningTest(split_ratio=0.75, lags_count=5) df_machine_rank = portfolio.rankMachineLearning(df_machine_result) machine_codes = portfolio.buildUniverse(df_machine_rank, 'rank', 0.8)