fix: Handle entry_price formatting with error handling
This commit is contained in:
parent
9ef81fb589
commit
0c30213688
@ -316,10 +316,15 @@ def trading_journal_page():
|
|||||||
|
|
||||||
col1, col2 = st.columns(2)
|
col1, col2 = st.columns(2)
|
||||||
with col1:
|
with col1:
|
||||||
if trade['direction'] == 'sell':
|
try:
|
||||||
st.metric("Exit Price", f"${trade['entry_price']:.2f}")
|
entry_price = float(trade['entry_price'])
|
||||||
else:
|
if trade['direction'] == 'sell':
|
||||||
st.metric("Entry Price", f"${trade['entry_price']:.2f}")
|
st.metric("Exit Price", f"${entry_price:.2f}")
|
||||||
|
else:
|
||||||
|
st.metric("Entry Price", f"${entry_price:.2f}")
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
price_label = "Exit Price" if trade['direction'] == 'sell' else "Entry Price"
|
||||||
|
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())
|
st.metric("Type", direction.capitalize())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user