Cross-zero replacement uses full Lean quantity after the closing part fills
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
調査の方向性
Start with Brokerages/Brokerage.cs, especially TryHandleRemainingCrossZeroOrder and TryGetUpdateCrossZeroOrderQuantity, then trace TradeStation's and Alpaca's UpdateOrder callers. Add regression tests with a test brokerage that records replacement requests for both split parts after the closing part fills; confirm price-only replacements preserve each part's intended quantity and ordinary orders still work.
索引モデルが issue の本文から書いたものです。
説明
Problem
After a split cross-zero order's closing part fills, Brokerage.TryGetUpdateCrossZeroOrderQuantity forgets that the still-working opening part is only part of the original Lean quantity. A later price-only replacement can therefore request too much quantity.
Deterministic reproduction
No brokerage connection is needed. Using a test brokerage that records PlaceCrossZeroOrder and replacement requests:
- Start short 5 AAPL and register a Lean buy limit order for 10.
- Call
TryCrossZeroPositionOrder(order, -5). The closing request buys 5; the deferred opening request also buys 5. - Pass a
Filledevent for the first 5 throughTryHandleRemainingCrossZeroOrderand wait for the opening request to be submitted. - Update the limit price without changing the Lean quantity.
Observed with TradeStation's UpdateOrder, recording its replacement arguments:
Brokerage id: opening part's id
Expected replace quantity: 5
Actual replace quantity: 10
If the replacement is accepted and filled, this can buy 15 shares in total instead of the requested 10. The test records the outgoing request; it does not connect to a broker or establish a live occurrence.
Cause and affected callers
Brokerages/Brokerage.cs,TryHandleRemainingCrossZeroOrder: the firstFilledremoves_leanOrderByBrokerageCrossingOrders[order.Id]before submitting the opening part.TryGetUpdateCrossZeroOrderQuantity: once that entry is absent, it returnsleanOrder.Quantity, losing the split quantity.- TradeStation's
UpdateOrdersends that quantity to the last brokerage id. - Alpaca's
UpdateOrderalso uses the returned quantity with the last brokerage id, andCreateAlpacaChangeOrderputs it in the replacement request. It uses the same shared split lifecycle. - Tradier calls the helper but ignores the returned quantity and does not send a quantity in its price replacement, so this specific over-sizing path does not apply there.
This is present independently of the invalid-id soft-rejection change in TradeStation #118.
Required result
A price-only replacement of either part must preserve that part's intended total quantity, including after the closing part completes. Existing first-part updates and ordinary non-split orders must continue to work.
Suggestion: retain enough split lifecycle information in the shared brokerage helper to calculate replacement quantities for both parts, with regression tests; TradeStation and Alpaca can then reuse the correction rather than implementing separate bookkeeping.
- 主要言語
- C#
- スター
- 22.6k
- フォーク
- 5.4k
- 平均マージ
- 11時間 39分
- マージ済み PR(30日)
- 104
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
QuantConnect/Lean のほかの issue
-
priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
QuantConnect/Lean#10216 ·
メンテナーはふだん 1 日以内に返信
-
priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
QuantConnect/Lean#10206 ·
メンテナーはふだん 1 日以内に返信
-
priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
QuantConnect/Lean#10199 ·
メンテナーはふだん 1 日以内に返信
-
priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
QuantConnect/Lean#10198 ·
メンテナーはふだん 1 日以内に返信
-
priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
QuantConnect/Lean#10197 ·
メンテナーはふだん 1 日以内に返信
QuantConnect/Lean の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
dotnet-outdated/dotnet-outdated#871 ·
メンテナーはふだん 1 日以内に返信
-
triage/untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
unoplatform/uno#26676 ·
メンテナーはふだん 1 日以内に返信
-
.NET bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
jhaizhou-ops/S2Arm#2177 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
area-CodeGen-coreclr untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
dotnet/runtime#138181 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信