'''backtest start: 2020-09-25 00:00:00 end: 2020-09-27 00:00:00 period: 1h basePeriod: 1h exchanges: [{"eid":"Futures_OKCoin","currency":"BTC_USD"}] ''' class Constant(object): IS_OPEN = False #是否开仓标记 #初始化常量 def init_env_constant(): ext.Debug("init_env_constant()#初始化常量对象") pass #开启监控 def start_monitor(): ext.Debug("start_monitor()#开启监控") pass #启动开仓 def start_open_shipping_space(): ext.Debug("start_open_shipping_space()#启动开仓") pass #开始加仓 def start_add_shipping_space(): ext.Debug("start_add_shipping_space()#开始加仓") pass #开始检查止损 def start_check_stop_and_stop_point_up(): ext.Debug("start_check_stop_and_stop_point_up()#初始止损") pass #触及止损,开始平仓 def start_evening_up(): ext.Debug("start_evening_up()#触及止损,开始平仓") pass #重置环境常量对象 def reset_env_constant(): ext.Debug("reset_env_constant()#重置环境常量对象") pass def main(): global CONSTANT CONSTANT = Constant() while True : init_env_constant()#初始化常量对象 start_monitor() #开启监控 start_open_shipping_space() #启动开仓 start_check_stop_and_stop_point_up() #启动检查止损 start_add_shipping_space() #启动加仓 start_check_stop_and_stop_point_up() #止损点上移 start_evening_up() #启动平仓 reset_env_constant() #重置环境常量对象 Sleep(1000*10*6*10) #十分钟轮询一次 exit()
孟大壮 干哈用的