feat: Add unique keys to selectboxes to resolve duplicate element ID error
This commit is contained in:
parent
28f0eee4ec
commit
9e1cccd3b6
@ -161,7 +161,8 @@ def trading_journal_page():
|
|||||||
if add_to_existing:
|
if add_to_existing:
|
||||||
position_id = st.selectbox(
|
position_id = st.selectbox(
|
||||||
"Select Position ID",
|
"Select Position ID",
|
||||||
options=[pos['position_id'] for pos in existing_positions]
|
options=[pos['position_id'] for pos in existing_positions],
|
||||||
|
key="position_select"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
position_id = generate_position_id(ticker)
|
position_id = generate_position_id(ticker)
|
||||||
@ -177,7 +178,7 @@ def trading_journal_page():
|
|||||||
with col2:
|
with col2:
|
||||||
stop_loss = st.number_input("Stop Loss", min_value=0.01, step=0.01)
|
stop_loss = st.number_input("Stop Loss", min_value=0.01, step=0.01)
|
||||||
strategy = st.text_input("Strategy")
|
strategy = st.text_input("Strategy")
|
||||||
order_type = st.selectbox("Order Type", ["Market", "Limit"])
|
order_type = st.selectbox("Order Type", ["Market", "Limit"], key="add_trade_order_type")
|
||||||
|
|
||||||
entry_date = st.date_input("Entry Date")
|
entry_date = st.date_input("Entry Date")
|
||||||
entry_time = st.time_input("Entry Time")
|
entry_time = st.time_input("Entry Time")
|
||||||
@ -220,7 +221,8 @@ def trading_journal_page():
|
|||||||
trade_id = st.selectbox(
|
trade_id = st.selectbox(
|
||||||
"Select Trade to Update",
|
"Select Trade to Update",
|
||||||
options=[t['id'] for t in open_trades],
|
options=[t['id'] for t in open_trades],
|
||||||
format_func=lambda x: f"{next(t['ticker'] for t in open_trades if t['id'] == x)} - {x}"
|
format_func=lambda x: f"{next(t['ticker'] for t in open_trades if t['id'] == x)} - {x}",
|
||||||
|
key="trade_select"
|
||||||
)
|
)
|
||||||
|
|
||||||
trade = next(t for t in open_trades if t['id'] == trade_id)
|
trade = next(t for t in open_trades if t['id'] == trade_id)
|
||||||
@ -235,7 +237,8 @@ def trading_journal_page():
|
|||||||
new_stop = st.number_input("Stop Loss", value=float(trade['stop_loss']))
|
new_stop = st.number_input("Stop Loss", value=float(trade['stop_loss']))
|
||||||
new_strategy = st.text_input("Strategy", value=trade['strategy'])
|
new_strategy = st.text_input("Strategy", value=trade['strategy'])
|
||||||
new_order_type = st.selectbox("Order Type", ["Market", "Limit"],
|
new_order_type = st.selectbox("Order Type", ["Market", "Limit"],
|
||||||
index=0 if trade['order_type'] == "Market" else 1)
|
index=0 if trade['order_type'] == "Market" else 1,
|
||||||
|
key="update_trade_order_type")
|
||||||
|
|
||||||
new_notes = st.text_area("Notes", value=trade['notes'] if trade['notes'] else "")
|
new_notes = st.text_area("Notes", value=trade['notes'] if trade['notes'] else "")
|
||||||
|
|
||||||
@ -300,7 +303,8 @@ def technical_scanner_page():
|
|||||||
with scanner_tab:
|
with scanner_tab:
|
||||||
scanner_type = st.selectbox(
|
scanner_type = st.selectbox(
|
||||||
"Select Scanner",
|
"Select Scanner",
|
||||||
["SunnyBands", "ATR-EMA", "ATR-EMA v2"]
|
["SunnyBands", "ATR-EMA", "ATR-EMA v2"],
|
||||||
|
key="tech_scanner_type"
|
||||||
)
|
)
|
||||||
|
|
||||||
col1, col2 = st.columns(2)
|
col1, col2 = st.columns(2)
|
||||||
@ -343,7 +347,8 @@ def technical_scanner_page():
|
|||||||
selected_report = st.selectbox(
|
selected_report = st.selectbox(
|
||||||
"Select Report",
|
"Select Report",
|
||||||
options=reports,
|
options=reports,
|
||||||
format_func=lambda x: f"{x['name']} ({x['created'].strftime('%Y-%m-%d %H:%M')})"
|
format_func=lambda x: f"{x['name']} ({x['created'].strftime('%Y-%m-%d %H:%M')})",
|
||||||
|
key="tech_scanner_report"
|
||||||
)
|
)
|
||||||
|
|
||||||
if selected_report:
|
if selected_report:
|
||||||
@ -452,7 +457,8 @@ def canslim_screener_page():
|
|||||||
selected_report = st.selectbox(
|
selected_report = st.selectbox(
|
||||||
"Select Report",
|
"Select Report",
|
||||||
options=reports,
|
options=reports,
|
||||||
format_func=lambda x: f"{x['name']} ({x['created'].strftime('%Y-%m-%d %H:%M')})"
|
format_func=lambda x: f"{x['name']} ({x['created'].strftime('%Y-%m-%d %H:%M')})",
|
||||||
|
key="canslim_scanner_report"
|
||||||
)
|
)
|
||||||
|
|
||||||
if selected_report:
|
if selected_report:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user