From 3a962fb6854f1ca7bb12c8f53b91b5a9a9ad955f Mon Sep 17 00:00:00 2001 From: "Bobby (aider)" Date: Thu, 13 Feb 2025 07:58:35 -0800 Subject: [PATCH] fix: Handle None values for numeric trade fields in trading journal --- src/pages/journal/trading_journal_page.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/journal/trading_journal_page.py b/src/pages/journal/trading_journal_page.py index 5d04a9d..2becc93 100644 --- a/src/pages/journal/trading_journal_page.py +++ b/src/pages/journal/trading_journal_page.py @@ -223,12 +223,12 @@ def trading_journal_page(): col1, col2 = st.columns(2) with col1: - new_shares = st.number_input("Shares", value=trade['shares']) - new_entry = st.number_input("Entry Price", value=float(trade['entry_price'])) - new_target = st.number_input("Target Price", value=float(trade['target_price'])) + new_shares = st.number_input("Shares", value=trade['shares'] if trade['shares'] is not None else 0) + new_entry = st.number_input("Entry Price", value=float(trade['entry_price']) if trade['entry_price'] is not None else 0.0) + new_target = st.number_input("Target Price", value=float(trade['target_price']) if trade['target_price'] is not None else 0.0) with col2: - new_stop = st.number_input("Stop Loss", value=float(trade['stop_loss'])) + new_stop = st.number_input("Stop Loss", value=float(trade['stop_loss']) if trade['stop_loss'] is not None else 0.0) new_strategy = st.text_input("Strategy", value=trade['strategy']) new_order_type = st.selectbox("Order Type", ["Market", "Limit"], index=0 if trade['order_type'] == "Market" else 1,