问答交流

交易引擎貌似有bug,设置了固定时间平仓,有部分日期没正确执行

由bqi4yalj创建,最终由bqi4yalj 被浏览 1 用户


        设置了固定时间平仓,有部分日期没正确执行
        if t >= context.force_close_time and t<= context.force_close_time_2:
            #context.order_target(context.symbol, 0)
            context.sell_close(context.symbol, long_position_qty, price, order_type=OrderType.MARKET)
            msg = "{} 平多3 数量 {}  最新价={} 成本价={} 变化={}".format(dt,str(long_position_qty),str(price),str(cost),str(price-cost))
            print(msg)
            return

**设置了固定时间下午14:55到15:00平仓,有部分日期没正确执行,**2025-07-17 和2025-07-18 执行不正常(没有执行),其它日期正常执行,见输出日志(后面附日志截图),

https://bigquant.com/codesharev3/61499106-5e17-4630-a188-1e76986436c1

标签

交易引擎
{link}