问答交流

基于财报的事件驱动策略这么写不会导致超买嘛

由yzc18811006016创建,最终由yzc18811006016 被浏览 11 用户


    for instrument in set(context.get_account_positions().keys()):
        if (data.current_dt - context.get_position(instrument).last_sale_date).days >= context.holding_days:
            context.order_target_percent(instrument, 0)
         
    for i, x in today_df.iterrows():
        # 调用:context.order_target_percent('AAPL', 50.0)。
        context.order_target_percent(x.instrument, float(x.position))

不会出现持仓日期还没到,原有的票还是占有一定的仓位,比如还占有50%

今天又出现2个票,每个票占比50%,买进来

这不会出现150%的持仓吗

评论
  • undefined
{link}