def Run(codes='', task_id=0): from autoxd.pypublish import publish def fnSample(code, dtype=''): import tushare as ts df = ts.get_hist_data(code)[['high', 'low', 'open', 'close', 'volume']] df.columns = list('hlocv') df = df.sort_index() return df #设置策略参数 def setParams(s): if 0: s = Strategy_Boll s.setParams( trade_num=300, pl=publish.Publish(explicit=True), ) backtest_policy.test_strategy(codes, BollFenCangKline, setParams, mode=myenum.hisdat_mode, start_day='2017-4-10', end_day='2018-9-15', datasource_mode=DataSources.datafrom.custom, datasource_fn=fnSample)
def Run(codes, task_id=0): #agl.LOG('sdf中') #codes = ['300033'] def fnSample(code, dtype='5'): from autoxd import warp_pytdx as tdx if dtype == '5': df = tdx.getFive(code) df = df.sort_index() return df if dtype == 'd': df = tdx.getHisdat(code) df = df.sort_index() return df def setParams(s): if 0: s = Strategy_Boll s.setParams(pl=publish.Publish(), ) backtest_policy.test_strategy( codes, Strategy_Boll_Pre, setParams, start_day='2018-11-1', end_day='', #start_day='2017-12-2', end_day='2017-12-13', mode=BackTestPolicy.enum.hisdat_mode | BackTestPolicy.enum.hisdat_five_mode, datasource_mode=DataSources.datafrom.custom, datasource_fn=fnSample)
def Run(codes, task_id=0): #agl.LOG('sdf中') #codes = ['300033'] def setParams(s): if 0: s = Strategy_Boll s.setParams( pl=publish.Publish(), ) backtest_policy.test_strategy(codes, Strategy_Boll_Pre, setParams, start_day='2018-2-7', end_day='2018-3-16', #start_day='2017-7-26', end_day='2017-12-13' mode=BackTestPolicy.enum.tick_mode )
def Run(codes, task_id=0): from autoxd.pypublish import publish def fnSample(code, dtype='5'): from autoxd import warp_pytdx as tdx if dtype=='5': df = tdx.getFive(code) df = df.sort_index() return df if dtype=='d': df = tdx.getHisdat(code) df = df.sort_index() return df def setParams(s): s.setParams( pl=publish.Publish(), ) backtest_policy.test_strategy(codes, StrategySample, setParams, start_day='', end_day='', mode=BackTestPolicy.enum.hisdat_mode|BackTestPolicy.enum.hisdat_five_mode, datasource_mode=DataSources.datafrom.custom, datasource_fn=fnSample )