鳄鱼法则
import numpy as np def initialize(context): g.up_price = {} #向上碎形最高价 g.low_price = {} #向下碎形最低价 g.up_fractal_exists = {} #判断有效向上碎形 g.down_fractal_exists = {} #判断有效向下碎形 g.AO_index = {} #存放连续的AO指标数据 g.cal_AC_index = {} #计算AC指标中转存储 g.AC_index = {} #存放连续的AC指标数据 g.amount = {} #满仓仓位 g.stock = get_index_stocks('000300.XSHG') g.buy_stock = [] set_benchmark('000300.XSHG') g.month = context.current_dt.month run_monthly(select_universe,1,'open') #重置全局变量 def reset_global(): g.up_price = {} #向上碎形最高价 g.low_price = {} #向下碎形最低价 g.up_fractal_exists = {} #判断有效向上碎形 g.down_fractal_exists = {} #判断有效向下碎形 g.AO_index