Market On Open isn't accurate
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 EquityFillModel.cs 开始,尤其关注报告中提到的 Tick 和 TradeBar 分支,并使用包含 market-on-open 订单的分钟数据回测来复现该行为。检查缓存的 TradeBar 和官方开盘价是如何选择的,然后添加或更新有针对性的测试,使 fill 使用预期的每日开盘价,并修正报告中的时间。
由索引模型根据 Issue 内容生成。
描述
Expected Behavior
Market on open should mimic the official open price for the day when subscribing to regular data feed (such as minute) as outlined here
https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/market-on-open-orders
Actual Behavior
this backtest isnt actually producing any results as described in the article.
as well i have noticed on other backtests that when subscribing to minute data the qc takes the 2nd bar after the open (the bar of 09:32 and not and not 09:31 as outlined in your article... )
Potential Solution
might be related to this:
For MOO, official opening price is only used in the Tick branch: EquityFillModel.cs (line 458) looks for OfficialOpen | OpeningPrints.
But our algo subscribes to minute TradeBars, so LEAN uses this branch instead: EquityFillModel.cs (line 503). That branch literally does:
_var tradeBar = asset.Cache.GetData<TradeBar>();
fill.FillPrice = tradeBar.Open;_
at line 505 (line 505) and line 518 (line 518).
So yes: with minute bars, QC MOO can fill from the cached minute bar Open, not the official daily open. If the cached bar is the 09:31-09:32 bar, the report shows 09:32 and price matches 09:31 open.
Reproducing the Problem
create a backtest with subscribing to minute data and do some MOO, see that trade prices are not the daily open prices.
System Information
QC CLoud
Checklist
- I have completely filled out this template
- I have confirmed that this issue exists on the current
masterbranch - I have confirmed that this is not a duplicate issue by searching issues
- I have provided detailed steps to reproduce the issue
- 主要语言
- C#
- 星标
- 21.9k
- 派生
- 5.3k
- 平均合并
- 19 小时 31 分钟
- 30 天内合并 PR
- 44
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
QuantConnect/Lean 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
QuantConnect/Lean#9889 ·
维护者通常 1 天内回复
-
library-request
难度 2/5 1-3 小时 新手友好度 68/100
QuantConnect/Lean#9879 ·
维护者通常 1 天内回复
-
library-request
难度 2/5 1-3 小时 新手友好度 74/100
QuantConnect/Lean#9743 ·
维护者通常 1 天内回复
-
library-request
难度 2/5 1-3 小时 新手友好度 68/100
QuantConnect/Lean#9500 ·
维护者通常 1 天内回复
-
library-request
难度 2/5 1-3 小时 新手友好度 68/100
QuantConnect/Lean#9499 ·
维护者通常 1 天内回复
查看 QuantConnect/Lean 的全部 Issue
相似的 Issue
-
needs-area-label
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
Fallout-build/Fallout#708 ·
维护者通常 5 天内回复
-
bug next version
难度 2/5 1-3 小时 新手友好度 68/100
Rem0o/FanControl.Releases#4220 · 1 条评论 ·
-
area:repo audit:approved audit:auto priority:P3
难度 2/5 1-3 小时 新手友好度 66/100
elsa-workflows/elsa-core#8771 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
nkdAgility/azure-devops-migration-tools#3217 ·
维护者通常 1 天内回复