feat: Use portfolio value as default account size in position calculator
This commit is contained in:
parent
470cb88da6
commit
31af0f6a02
@ -545,11 +545,26 @@ def trading_system_page():
|
|||||||
with calc_tab:
|
with calc_tab:
|
||||||
st.subheader("Position Calculator")
|
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)
|
col1, col2 = st.columns(2)
|
||||||
with col1:
|
with col1:
|
||||||
account_size = st.number_input("Account Size ($)", min_value=0.0, value=100000.0, step=1000.0)
|
account_size = st.number_input("Account Size ($)",
|
||||||
risk_percentage = st.number_input("Risk Percentage (%)", min_value=0.1, max_value=100.0, value=1.0, step=0.1)
|
min_value=0.0,
|
||||||
stop_loss_percentage = st.number_input("Stop Loss Percentage (%)", min_value=0.1, max_value=100.0, value=7.0, step=0.1)
|
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:
|
with col2:
|
||||||
entry_price = st.number_input("Entry Price ($)", min_value=0.01, step=0.01)
|
entry_price = st.number_input("Entry Price ($)", min_value=0.01, step=0.01)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user