From 73daf18fc81d7a97bde64a8d78fac197036ebad5 Mon Sep 17 00:00:00 2001 From: "Bobby (aider)" Date: Mon, 17 Feb 2025 17:01:10 -0800 Subject: [PATCH] fix: Remove duplicate number_input elements and add unique keys in watchlist form --- src/pages/trading/trading_system_page.py | 29 ++++++++---------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/pages/trading/trading_system_page.py b/src/pages/trading/trading_system_page.py index e28727e..31d06af 100644 --- a/src/pages/trading/trading_system_page.py +++ b/src/pages/trading/trading_system_page.py @@ -247,42 +247,31 @@ def trading_system_page(): col1, col2 = st.columns(2) with col1: - ticker = st.text_input("Ticker", value=str(prefill.get('ticker', ''))) + ticker = st.text_input("Ticker", value=str(prefill.get('ticker', '')), key="watchlist_ticker") entry_price = st.number_input("Entry Price", value=float(prefill.get('entry_price') or 0.0), min_value=0.0, step=0.01, - format="%.2f") + format="%.2f", + key="watchlist_entry_price") shares = st.number_input("Shares", value=int(prefill.get('shares') or 0), min_value=0, - step=1) + step=1, + key="watchlist_shares") with col2: target_price = st.number_input("Target Price", value=float(prefill.get('target_price') or 0.0), min_value=0.0, step=0.01, - format="%.2f") + format="%.2f", + key="watchlist_target_price") stop_loss = st.number_input("Stop Loss", value=float(prefill.get('stop_loss') or 0.0), min_value=0.0, step=0.01, - format="%.2f") - shares = st.number_input("Shares", - value=prefill.get('shares', 0), - min_value=0, - step=1) - with col2: - target_price = st.number_input("Target Price", - value=prefill.get('target_price', 0.0), - min_value=0.0, - step=0.01, - format="%.2f") - stop_loss = st.number_input("Stop Loss", - value=prefill.get('stop_loss', 0.0), - min_value=0.0, - step=0.01, - format="%.2f") + format="%.2f", + key="watchlist_stop_loss") notes = st.text_area("Notes")