fix: Improve prefill data handling in trading system page

This commit is contained in:
Bobby (aider) 2025-02-17 16:59:43 -08:00
parent f4b6c2f07e
commit c418973cf3

View File

@ -243,16 +243,31 @@ def trading_system_page():
# Debug output to verify prefill data
if prefill:
st.write("Debug - Prefill data:", prefill)
st.write("Debug - Prefill ", prefill)
col1, col2 = st.columns(2)
with col1:
ticker = st.text_input("Ticker", value=str(prefill.get('ticker', '')))
entry_price = st.number_input("Entry Price",
value=prefill.get('entry_price', 0.0),
value=float(prefill.get('entry_price') or 0.0),
min_value=0.0,
step=0.01,
format="%.2f")
shares = st.number_input("Shares",
value=int(prefill.get('shares') or 0),
min_value=0,
step=1)
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")
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,