Fee models get the order, not the fill, so fees based on trade value use an estimate
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 22/100
Research direction
Start with OrderFeeParameters and the fee model call in BacktestingBrokerage, where fill.OrderFee is set after the fill but the fee model still receives the original order. The fix changes the fee-model interface across all fee models, including Python and brokerage plugins, so it needs design agreement first. Done means fee models see the fill's price and quantity while pre-trade buying power checks still use the order, with the reproduction case charging $1.00.
Written by the indexing model from the issue text.
Description
Expected Behavior
A fee model that charges on trade value, such as InteractiveBrokersFeeModel's 1% maximum per order, charges a fill on that fill's price and quantity.
Actual Behavior
OrderFeeParameters only carries the Security and the Order. BacktestingBrokerage sets fill.OrderFee after the fill, but it passes the fee model the original order and not the fill. So fee models estimate the trade value from the order's prices or the security's current price.
Once #10129 is merged, US equity orders under $100 pay 1% of trade value, so the estimate shows in the fee. For example, take a one-share buy stop at $100 when the next minute bar is 90/110/90/90 (open/high/low/close). It fills at $100 and should cost $1.00, but it's charged $0.90.
Potential Solution
Pass the fill (price and quantity) to the fee model when charging a fill, for example as an optional fill on OrderFeeParameters. Pre-trade fee estimates, such as buying power checks, keep using the order. This affects every fee model, including Python models and models in the brokerage plugins.
Reproducing the Problem
With #10129: EquityFillModel fills the stop above at $100, and InteractiveBrokersFeeModel charges $0.90.
System Information
master, .NET 10.
- Dominant language
- C#
- Stars
- 22.6k
- Forks
- 5.4k
- Avg merge
- 11h 39m
- Merged PRs (30d)
- 104
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from QuantConnect/Lean
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
QuantConnect/Lean#10216 ·
Maintainers usually reply within 1 day
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
QuantConnect/Lean#10206 ·
Maintainers usually reply within 1 day
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
QuantConnect/Lean#10199 ·
Maintainers usually reply within 1 day
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
QuantConnect/Lean#10198 ·
Maintainers usually reply within 1 day
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
QuantConnect/Lean#10197 ·
Maintainers usually reply within 1 day
All issues in QuantConnect/Lean
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
dotnet-outdated/dotnet-outdated#871 ·
Maintainers usually reply within 1 day
-
triage/untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
unoplatform/uno#26676 ·
Maintainers usually reply within 1 day
-
.NET bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
jhaizhou-ops/S2Arm#2177 · 3 comments ·
Maintainers usually reply within 1 day
-
area-CodeGen-coreclr untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
dotnet/runtime#138181 · 1 comment ·
Maintainers usually reply within 1 day