QuantConnect / QuantConnect/Lean

Create Trade Helper to Manage Bets Independently

Open
#6,642 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
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 master branch
  • I have confirmed that this is not a duplicate issue by searching issues

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.