refactor: Sort trades by exit_date or entry_date in plot_trade_history
This commit is contained in:
parent
b9c3b601fe
commit
6b13abe8ea
@ -148,8 +148,8 @@ def plot_trade_history(trades):
|
|||||||
pnl = []
|
pnl = []
|
||||||
cumulative_pnl = 0
|
cumulative_pnl = 0
|
||||||
|
|
||||||
# Sort trades by entry_date
|
# Sort trades by exit_date or entry_date
|
||||||
trades.sort(key=lambda x: x.get('entry_date'))
|
trades.sort(key=lambda x: x.get('exit_date') or x.get('entry_date'))
|
||||||
|
|
||||||
for trade in trades:
|
for trade in trades:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user