feat: Load open trades from journal into portfolio on initialization
This commit is contained in:
parent
aadd2c517e
commit
efe69a2dbb
@ -588,6 +588,19 @@ def trading_system_page():
|
|||||||
if 'portfolio' not in st.session_state:
|
if 'portfolio' not in st.session_state:
|
||||||
st.session_state.portfolio = Portfolio()
|
st.session_state.portfolio = Portfolio()
|
||||||
|
|
||||||
|
# Load existing open trades into portfolio
|
||||||
|
open_trades = get_open_trades()
|
||||||
|
for trade in open_trades:
|
||||||
|
position = Position(
|
||||||
|
symbol=trade['ticker'],
|
||||||
|
entry_date=trade['entry_date'],
|
||||||
|
entry_price=trade['entry_price'],
|
||||||
|
shares=trade['shares'],
|
||||||
|
stop_loss=trade['stop_loss'],
|
||||||
|
target_price=trade['target_price']
|
||||||
|
)
|
||||||
|
st.session_state.portfolio.add_position(position)
|
||||||
|
|
||||||
# Add position form
|
# Add position form
|
||||||
with st.expander("Add New Position"):
|
with st.expander("Add New Position"):
|
||||||
col1, col2 = st.columns(2)
|
col1, col2 = st.columns(2)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user