QuantConnect / QuantConnect/Lean
Review Fill Model: Stop Limit Fill
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 21.7k
- Forks
- 5.3k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 34
Description
Expected Behavior
A Stop-Limit order is an instruction to submit a buy or sell limit order when the user-specified stop trigger price is attained or >penetrated. The order has two basic components: the stop price and the limit price. When a trade has occurred at or through the stop price, the order becomes executable and enters the market as a limit order, which is an order to buy or sell at a specified price or better.
Actual Behavior
FillModel.StopLimitFill uses quote data to trigger the order.
Potential Solution
Remove the FillModel.GetPrices logic and write the StopLimitFill method to use Tick.Trade or TradeBar properties. We need to create unit tests that cover all scenarios and security types. For instance, Forex and CFD don't have trade data.
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
Contributor 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.
Research direction
Start with FillModel.StopLimitFill and the FillModel.GetPrices logic. Compare how Tick.Trade and TradeBar properties can trigger stop-limit orders, noting that Forex and CFD lack trade data. Add unit tests covering the relevant scenarios and security types, then verify the tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100