报错:name 'position_current_weight' is not defined
由knightcn创建,最终由knightcn 被浏览 27 用户
请大佬和技术专家帮忙看看为什么出错了,策略是用传统策略向导生成的
策略链接如下:
https://bigquant.com/experimentshare/00443fe529a64324904489a75849cbf7
\
出错信息如下:
NameError Traceback (most recent call last) <ipython-input-2-156ac7e938ff> in <module> 536 ) 537 --> 538 m4 = M.trade.v4( 539 instruments=m1.data, 540 options_data=m17.data_1,
<ipython-input-2-156ac7e938ff> in m4_handle_data_bigquant_run(context, data) 380 381 sell_action(context, data) --> 382 buy_action(context, data) 383 384 # 回测引擎:准备数据,只执行一次
<ipython-input-2-156ac7e938ff> in buy_action(context, data) 276 277 if data.can_trade(context.symbol(s)): --> 278 if context.symbol(s) in position_current_weight: 279 curr_value = position_current_value.get(context.symbol(s)) 280 order_value(context.symbol(s), min(context.max_stock_weight * portfolio_value - curr_value, equal_weight*portfolio_value))
NameError: name 'position_current_weight' is not defined
查了之前的文档,发现用传统模式向导生成一直都会出错