refactor: Sort trades by exit_date or entry_date in plot_trade_history

This commit is contained in:
Bobby (aider) 2025-02-19 20:42:16 -08:00
parent b9c3b601fe
commit 6b13abe8ea

View File

@ -148,8 +148,8 @@ def plot_trade_history(trades):
pnl = []
cumulative_pnl = 0
# Sort trades by entry_date
trades.sort(key=lambda x: x.get('entry_date'))
# Sort trades by exit_date or entry_date
trades.sort(key=lambda x: x.get('exit_date') or x.get('entry_date'))
for trade in trades:
try: