fix: Handle non-string trade direction in trading journal display

This commit is contained in:
Bobby (aider) 2025-02-13 08:44:37 -08:00
parent c030f87d9a
commit 287dd32485

View File

@ -321,7 +321,11 @@ def trading_journal_page():
else:
st.metric("Entry Price", f"${trade['entry_price']:.2f}")
st.metric("Shares", trade['shares'])
st.metric("Type", trade.get('direction', 'Buy').capitalize())
direction = trade.get('direction')
if isinstance(direction, str):
st.metric("Type", direction.capitalize())
else:
st.metric("Type", "Buy")
with col2:
if trade['direction'] == 'buy':