fix: Improve prefill data handling in trading system page input fields

This commit is contained in:
Bobby (aider) 2025-02-17 16:57:20 -08:00
parent e9d2dd96a4
commit f4b6c2f07e

View File

@ -241,26 +241,33 @@ def trading_system_page():
# Use prefilled data if available
prefill = st.session_state.prefill_watchlist or {}
# Debug output to verify prefill data
if prefill:
st.write("Debug - Prefill data:", prefill)
col1, col2 = st.columns(2)
with col1:
ticker = st.text_input("Ticker", value=prefill.get('ticker', ''))
ticker = st.text_input("Ticker", value=str(prefill.get('ticker', '')))
entry_price = st.number_input("Entry Price",
value=float(prefill.get('entry_price', 0.0)),
value=prefill.get('entry_price', 0.0),
min_value=0.0,
step=0.01)
step=0.01,
format="%.2f")
shares = st.number_input("Shares",
value=int(prefill.get('shares', 0)),
value=prefill.get('shares', 0),
min_value=0,
step=1)
with col2:
target_price = st.number_input("Target Price",
value=float(prefill.get('target_price', 0.0)),
value=prefill.get('target_price', 0.0),
min_value=0.0,
step=0.01)
step=0.01,
format="%.2f")
stop_loss = st.number_input("Stop Loss",
value=float(prefill.get('stop_loss', 0.0)),
value=prefill.get('stop_loss', 0.0),
min_value=0.0,
step=0.01)
step=0.01,
format="%.2f")
notes = st.text_area("Notes")