nautechsystems / nautilus_trader

A high-performance algorithmic trading platform and event-driven backtester
https://nautilustrader.io
GNU Lesser General Public License v3.0
1.99k stars 456 forks source link

Position grouping #810

Open limx0 opened 1 year ago

limx0 commented 1 year ago

Feature Request

For strategies that trade >1 instrument, it would be nice to have a way to group positions for the purposes of trades analysis and pnl reporting.

A simple example would be a pair trading strategy, information about fills and positional pnl is not useful on a per-instrument or position_id basis (one leg may show small losses, with another leg having much larger gains), it should only be considered for all instruments in the pair (or group).

Could we add some sort of optional "position_group" alongside the position_ids that currently exist in nautilus? This could merely be an attribute that gets added to reports etc for now, but could eventually be integrated into the portfolio for "position group" pnl perhaps.

ccitzen commented 1 year ago

This would be incredibly helpful.