refactor: Simplify trade sorting to use chronological order
This commit is contained in:
parent
646d4b847f
commit
a37b70d88d
@ -371,8 +371,8 @@ def trading_journal_page():
|
||||
for trade in trades:
|
||||
st.write(f"Trade: {trade['direction']} {trade['shares']} shares at {trade['entry_price']}")
|
||||
|
||||
# Sort trades by entry_date and put sells after buys
|
||||
trades.sort(key=lambda x: (x['entry_date'], 0 if x.get('direction') == 'buy' else 1))
|
||||
# Sort trades chronologically
|
||||
trades.sort(key=lambda x: x['entry_date'])
|
||||
first_trade = trades[0]
|
||||
|
||||
# Calculate position performance
|
||||
|
||||
Loading…
Reference in New Issue
Block a user