QuantConnect / QuantConnect/Lean

[Feature Request] Support for Bracket Order

Open
#8,253 6 comments 8 reactions 0 assignees View on GitHub

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

Native support for bracket order (IBRK TWS Api bracket order example)

Currently, the workaround to emulate bracket orders is through onOrderEvent (discussion) However, brokerages such as IBKR supports submitting all orders as a bracket, which is not currently supported in Lean (IBKR plug in, bracket orders involves assigning parent orders). Attaching an order with a stop loss and take profit is common and the value of supporting bracket orders natively in Lean helps reduce code needed and avoid delays in order status transmissions. Also in live trading, being able to place bracket orders alleviates the unreliability by a huge degree as it eliminates possible issues such as server goes down, network issues, market data issues, etc. Please consider offer this! thank you.

related issue: https://github.com/QuantConnect/Lean/issues/5219

Actual Behavior

No native support of bracket orders.

Potential Solution
Reproducing the Problem
System Information
Checklist
  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the IBKR integration in QuantConnect.InteractiveBrokersBrokerage/InteractiveBrokersBrokerage.cs around line 2675, then read related issue #5219 and the linked bracket-order example. Determine the intended native Lean API and brokerage behavior; done means bracket orders can be submitted without the onOrderEvent workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.