Daily-resolution market orders converted to MarketOnClose are rejected by brokerage models without MarketOnClose
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 58/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- csharp
- 领域
- backend, fintech-quant
调研方向
Start with QCAlgorithm.ConvertMarketOrderIfRequired and the brokerage models' CanSubmitOrder supported order types, especially Tradier, Tastytrade, Public, and Webull. Run the supplied daily-resolution SPY reproduction with Tradier and inspect the order type and status. Done means converted orders are accepted and fill at the close when the original market order is supported.
由索引模型根据 Issue 内容生成。
描述
Expected Behavior
In a backtest, a market order placed during market hours on an equity subscribed only at daily resolution is converted to MarketOnClose (or MarketOnOpen within the MOC buffer) by QCAlgorithm.ConvertMarketOrderIfRequired (#9534). The converted order should be accepted by the brokerage model whenever the original market order would have been, and fill at the close.
Actual Behavior
Brokerage models whose supported order types include Market but not MarketOnClose reject the converted order, so every such market order comes back Invalid:
BrokerageModel declared unable to submit order: [1] Warning - Code: NotSupported - The TradierBrokerageModel does not support MarketOnClose order type. Only supports [Limit,Market,StopMarket,StopLimit]
The user called MarketOrder, which the model supports, and the order never fills. Live trading does not convert, so the same algorithm behaves differently live and in backtest.
Models with the same supported-type pattern (from reading their CanSubmitOrder sets): TradierBrokerageModel (reproduced below), TastytradeBrokerageModel, PublicBrokerageModel, WebullBrokerageModel.
Potential Solution
A suggestion; whoever fixes it picks the approach: let a model accept a MarketOnClose/MarketOnOpen order that Lean created from a market order as a backtest execution proxy, or skip the conversion when the brokerage model doesn't support the target type.
Reproducing the Problem
public class DailyMarketOrderMocRepro : QCAlgorithm
{
private Symbol _spy;
public override void Initialize()
{
SetStartDate(2013, 10, 7);
SetEndDate(2013, 10, 11);
SetCash(100000);
SetBrokerageModel(BrokerageName.TradierBrokerage);
_spy = AddEquity("SPY", Resolution.Daily).Symbol;
Schedule.On(DateRules.EveryDay(_spy), TimeRules.AfterMarketOpen(_spy, 30), () =>
{
var ticket = MarketOrder(_spy, 1);
Log($"{Time} type={ticket.OrderType} status={ticket.Status}");
});
}
}
Output on master: every day logs type=MarketOnClose status=Invalid with the message above.
System Information
master (06eb5cb31)
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#
- 星标
- 22.4k
- 派生
- 5.4k
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 63
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
QuantConnect/Lean 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
QuantConnect/Lean#10059 ·
维护者通常 1 天内回复
-
library-request
难度 2/5 1-3 小时 新手友好度 76/100
QuantConnect/Lean#10034 ·
维护者通常 1 天内回复
-
`LeanData.TryParsePath` fails on an absolute universe file path可能已有人在做 @FeiyangP 于 8 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
QuantConnect/Lean#10005 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
QuantConnect/Lean#9965 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
QuantConnect/Lean#9955 ·
维护者通常 1 天内回复
查看 QuantConnect/Lean 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
RadicalCSG/com.chisel#312 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 63/100
DeveloperAcademy-POSTECH/2026-C6-M10-MUSA#677 ·
维护者通常 1 天内回复
-
REQ-13 : une demande En cours perd son responsable par un simple enregistrement, et reste En cours未关闭a-corriger bug
难度 2/5 1-3 小时 新手友好度 76/100
christian-raj/S-Aloha#301 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
-
.NET Docs Next Major State: Needs Discussion
难度 2/5 1-3 小时 新手友好度 78/100
getsentry/sentry-dotnet#5912 · 1 条评论 ·
维护者通常 1 天内回复