QuantConnect / QuantConnect/Lean
Create Trade Helper to Manage Bets Independently
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 21.7k
- Forks
- 5.3k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 34
Description
Create a helper class that accepts order tickets and calculates the profit-loss on the set of orders its managing, independent of the portfolio holdings. This could allow creating multiple "Trades" and tracking each "bet" independently.
E.g.
Open a covered call position (1-Option, 1-Opening Order) -> Est P&L on Trade.
Later open a second covered call position -> Est P&L on Trade independently based on the fill prices of the second order tickets not on the average portfolio value.
The helper should include:
- Properties like "ClosingProfit" to estimate the current market price of the trade set.
- AddOrder() to add a new order to the Trade Set.
- Close() to flatten the Trade and take profit.
Expected Behavior
Some concept of trade management in LEAN.
Actual Behavior
No "trade" concept in LEAN; separate orders with portfolio focus.
Resulting in users making many different personal frameworks to implement the behavior.
Potential Solution
Create a Trade helper which lets users group their orders into trades and manage each investment/bet independently.
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
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
The issue does not name files, tests, or an existing entry point; start by reviewing how order tickets and portfolio holdings are represented in LEAN. Before implementation, define the Trade API, profit-loss behavior, order grouping, and Close semantics, then establish tests that show independent trade tracking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, fintech-quant
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100