fix: Move entry datetime input before position ID generation
This commit is contained in:
parent
ef762d2132
commit
28ffb22f71
@ -184,6 +184,17 @@ def trading_journal_page():
|
|||||||
if ticker:
|
if ticker:
|
||||||
# Show existing positions for this ticker
|
# Show existing positions for this ticker
|
||||||
existing_positions = get_position_summary(ticker)
|
existing_positions = get_position_summary(ticker)
|
||||||
|
# Get entry date/time first
|
||||||
|
entry_date = st.date_input("Entry Date")
|
||||||
|
entry_time_str = st.text_input("Entry Time (HH:MM)", "09:30")
|
||||||
|
try:
|
||||||
|
entry_time = datetime.strptime(entry_time_str, "%H:%M").time()
|
||||||
|
entry_datetime = datetime.combine(entry_date, entry_time)
|
||||||
|
entry_datetime = pytz.timezone('US/Pacific').localize(entry_datetime)
|
||||||
|
except ValueError:
|
||||||
|
st.error("Please enter time in HH:MM format (e.g. 09:30)")
|
||||||
|
st.stop()
|
||||||
|
|
||||||
if existing_positions:
|
if existing_positions:
|
||||||
st.write(f"Existing {ticker} Positions:")
|
st.write(f"Existing {ticker} Positions:")
|
||||||
for pos in existing_positions:
|
for pos in existing_positions:
|
||||||
@ -231,13 +242,6 @@ def trading_journal_page():
|
|||||||
|
|
||||||
order_type = st.selectbox("Order Type", ["Market", "Limit"], key="add_trade_order_type")
|
order_type = st.selectbox("Order Type", ["Market", "Limit"], key="add_trade_order_type")
|
||||||
|
|
||||||
entry_date = st.date_input("Entry Date")
|
|
||||||
entry_time_str = st.text_input("Entry Time (HH:MM)", "09:30")
|
|
||||||
try:
|
|
||||||
entry_time = datetime.strptime(entry_time_str, "%H:%M").time()
|
|
||||||
except ValueError:
|
|
||||||
st.error("Please enter time in HH:MM format (e.g. 09:30)")
|
|
||||||
st.stop()
|
|
||||||
|
|
||||||
if direction == "Buy":
|
if direction == "Buy":
|
||||||
followed_rules = st.checkbox("Followed Trading Rules")
|
followed_rules = st.checkbox("Followed Trading Rules")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user