fix: Add type checking for trade direction to prevent AttributeError
This commit is contained in:
parent
0c30213688
commit
f85299b518
@ -327,7 +327,10 @@ def trading_journal_page():
|
|||||||
st.metric(price_label, "N/A")
|
st.metric(price_label, "N/A")
|
||||||
st.metric("Shares", trade['shares'])
|
st.metric("Shares", trade['shares'])
|
||||||
direction = trade.get('direction', 'buy')
|
direction = trade.get('direction', 'buy')
|
||||||
st.metric("Type", direction.capitalize())
|
if isinstance(direction, str):
|
||||||
|
st.metric("Type", direction.capitalize())
|
||||||
|
else:
|
||||||
|
st.metric("Type", "Buy") # Default value if direction is not a string
|
||||||
|
|
||||||
with col2:
|
with col2:
|
||||||
if trade['direction'] == 'buy':
|
if trade['direction'] == 'buy':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user