From bdfd53e65366dbb48c5ae022ad740e80ab54902b Mon Sep 17 00:00:00 2001 From: "Bobby (aider)" Date: Tue, 11 Feb 2025 18:56:27 -0800 Subject: [PATCH] feat: Enhance trading plan view with comprehensive details and improved layout --- src/streamlit_app.py | 92 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 73 insertions(+), 19 deletions(-) diff --git a/src/streamlit_app.py b/src/streamlit_app.py index d0ab5e7..202cb72 100644 --- a/src/streamlit_app.py +++ b/src/streamlit_app.py @@ -833,41 +833,95 @@ def trading_plan_page(): col1, col2 = st.columns(2) with col1: - st.markdown("### Strategy Details") + st.markdown("### Basic Information") + st.write(f"**Plan Name:** {plan.plan_name}") + st.write(f"**Status:** {plan.status.value}") + st.write(f"**Author:** {plan.plan_author}") + st.write(f"**Version:** {plan.strategy_version}") + st.write(f"**Created:** {plan.created_at}") + st.write(f"**Updated:** {plan.updated_at}") + + st.markdown("### Market Details") st.write(f"**Timeframe:** {plan.timeframe.value}") st.write(f"**Market:** {plan.market_focus.value}") st.write(f"**Frequency:** {plan.trade_frequency.value}") - st.write(f"**Version:** {plan.strategy_version}") - + if plan.sector_focus: + st.write(f"**Sector Focus:** {plan.sector_focus}") + + with col2: st.markdown("### Risk Parameters") st.write(f"**Stop Loss:** {plan.stop_loss}%") st.write(f"**Profit Target:** {plan.profit_target}%") - st.write(f"**Risk/Trade:** {plan.total_risk_per_trade}%") + st.write(f"**Risk/Reward Ratio:** {plan.risk_reward_ratio}") + st.write(f"**Position Size:** {plan.position_sizing}%") + st.write(f"**Risk per Trade:** {plan.total_risk_per_trade}%") st.write(f"**Max Portfolio Risk:** {plan.max_portfolio_risk}%") - - with col2: - st.markdown("### Performance") - if plan.win_rate: - st.write(f"**Win Rate:** {plan.win_rate}%") - if plan.average_return_per_trade: - st.write(f"**Avg Return:** {plan.average_return_per_trade}%") - if plan.profit_factor: - st.write(f"**Profit Factor:** {plan.profit_factor}") - - st.markdown("### Trade Limits") + st.write(f"**Max Drawdown:** {plan.maximum_drawdown}%") st.write(f"**Max Trades/Day:** {plan.max_trades_per_day}") st.write(f"**Max Trades/Week:** {plan.max_trades_per_week}") - st.write(f"**Max Drawdown:** {plan.maximum_drawdown}%") - st.markdown("### Entry Criteria") + st.markdown("### Performance Metrics") + if any([plan.win_rate, plan.average_return_per_trade, plan.profit_factor]): + col3, col4 = st.columns(2) + with col3: + if plan.win_rate: + st.write(f"**Win Rate:** {plan.win_rate}%") + if plan.average_return_per_trade: + st.write(f"**Avg Return/Trade:** {plan.average_return_per_trade}%") + with col4: + if plan.profit_factor: + st.write(f"**Profit Factor:** {plan.profit_factor}") + + st.markdown("### Strategy Details") + st.write("**Entry Criteria:**") st.write(plan.entry_criteria) - st.markdown("### Exit Criteria") + st.write("**Exit Criteria:**") st.write(plan.exit_criteria) + st.write("**Entry Confirmation:**") + st.write(plan.entry_confirmation) + + st.write("**Market Conditions:**") + st.write(plan.market_conditions) + + st.write("**Technical Indicators:**") + st.write(plan.indicators_used) + + st.markdown("### Risk Management") + st.write("**Drawdown Adjustments:**") + st.write(plan.adjustments_for_drawdown) + + st.write("**Risk Controls:**") + st.write(plan.risk_controls) + + if plan.fundamental_criteria: + st.markdown("### Fundamental Analysis") + st.write(plan.fundamental_criteria) + + if plan.options_strategy_details: + st.markdown("### Options Strategy") + st.write(plan.options_strategy_details) + if plan.improvements_needed: - st.markdown("### Improvements Needed") + st.markdown("### Areas for Improvement") st.write(plan.improvements_needed) + + if plan.trade_review_notes: + st.markdown("### Trade Review Notes") + st.write(plan.trade_review_notes) + + if plan.future_testing_ideas: + st.markdown("### Future Testing Ideas") + st.write(plan.future_testing_ideas) + + if plan.historical_backtest_results: + st.markdown("### Historical Backtest Results") + st.write(plan.historical_backtest_results) + + if plan.real_trade_performance: + st.markdown("### Real Trading Performance") + st.write(plan.real_trade_performance) else: st.info("No trading plans found")