diff --git a/src/streamlit_app.py b/src/streamlit_app.py index 597bd3b..442004f 100644 --- a/src/streamlit_app.py +++ b/src/streamlit_app.py @@ -545,11 +545,26 @@ def trading_system_page(): with calc_tab: st.subheader("Position Calculator") + # Get latest portfolio value for default account size + portfolio_data = get_latest_portfolio_value() + default_account_size = portfolio_data['total_value'] if portfolio_data else 100000.0 + col1, col2 = st.columns(2) with col1: - account_size = st.number_input("Account Size ($)", min_value=0.0, value=100000.0, step=1000.0) - risk_percentage = st.number_input("Risk Percentage (%)", min_value=0.1, max_value=100.0, value=1.0, step=0.1) - stop_loss_percentage = st.number_input("Stop Loss Percentage (%)", min_value=0.1, max_value=100.0, value=7.0, step=0.1) + account_size = st.number_input("Account Size ($)", + min_value=0.0, + value=default_account_size, + step=1000.0) + risk_percentage = st.number_input("Risk Percentage (%)", + min_value=0.1, + max_value=100.0, + value=1.0, + step=0.1) + stop_loss_percentage = st.number_input("Stop Loss Percentage (%)", + min_value=0.1, + max_value=100.0, + value=7.0, + step=0.1) with col2: entry_price = st.number_input("Entry Price ($)", min_value=0.01, step=0.01)