QuantConnect / QuantConnect/Lean
Futures Orders Fill On Extended Market Hours
Open
Nobody has claimed this yet.
depth
feature
- Dominant language
- C#
- Stars
- 21.7k
- Forks
- 5.3k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 34
Description
Expected Behavior
Trailing stop orders for futures fill outside market hours.
Actual Behavior
Trailing stop orders do not fill outside market hours.
Potential Solution
Overwrite TrailingStopFill method in FutureFillModel as we did for StopMarketFill.
Reproducing the Problem
from AlgorithmImports import *
class MyAlgorithm(QCAlgorithm):
def Initialize(self):
self.set_start_date(2024, 6, 3)
self.set_end_date(2024, 6, 4)
self.es = self.add_future("ES", extended_market_hours=True)
self.ticket = None
def on_data(self, slice):
if not self.ticket:
self.market_order(self.es.mapped, 1)
self.ticket = self.trailing_stop_order(self.es.mapped, -1, 5, False)
if self.ticket and self.ticket.status != OrderStatus.FILLED:
self.plot(self.es.mapped.value, 'Price', self.es.price)
self.plot(self.es.mapped.value, 'Stop', self.ticket.get(OrderField.STOP_PRICE))
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 FutureFillModel and compare its StopMarketFill implementation with the base TrailingStopFill behavior. Use the provided futures algorithm to reproduce the trailing-stop issue during extended market hours, then verify that the trailing stop fills as expected and add or update the relevant fill-model tests if present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python
- Domain
- backend, fintech-quant
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100