Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Create Trade Helper to Manage Bets Independently

Open jaredbroad opened this issue 3 years ago • 0 comments

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

  • [x] I have completely filled out this template
  • [x] I have confirmed that this issue exists on the current master branch
  • [x] I have confirmed that this is not a duplicate issue by searching issues

jaredbroad avatar Sep 19 '22 22:09 jaredbroad