diff --git a/src/streamlit_app.py b/src/streamlit_app.py index 0ea14e3..e3cea26 100644 --- a/src/streamlit_app.py +++ b/src/streamlit_app.py @@ -882,29 +882,7 @@ def trading_plan_page(): winning_trades = 0 total_trades = len(plan_trades) - for trade in plan_trades: - with st.expander(f"{trade['ticker']} - {trade['entry_date']}"): - col1, col2 = st.columns(2) - with col1: - st.write(f"**Entry:** ${trade['entry_price']:.2f}") - st.write(f"**Shares:** {trade['shares']}") - st.write(f"**Direction:** {trade['direction']}") - if trade['strategy']: - st.write(f"**Strategy:** {trade['strategy']}") - - with col2: - if trade['exit_price']: - pl = (trade['exit_price'] - trade['entry_price']) * trade['shares'] - total_pl += pl - if pl > 0: - winning_trades += 1 - st.write(f"**Exit:** ${trade['exit_price']:.2f}") - st.write(f"**P/L:** ${pl:.2f}") - st.write(f"**Exit Date:** {trade['exit_date']}") - else: - st.write("**Status:** Open") - - # Display trade statistics + # Display trade statistics first st.markdown("#### Trade Statistics") col1, col2 = st.columns(2) with col1: @@ -917,6 +895,33 @@ def trading_plan_page(): st.write(f"**Total P/L:** ${total_pl:.2f}") if total_trades > 0: st.write(f"**Average P/L per Trade:** ${total_pl/total_trades:.2f}") + + # Display trades in a table format instead of nested expanders + st.markdown("#### Individual Trades") + for trade in plan_trades: + st.markdown("---") + cols = st.columns(3) + with cols[0]: + st.write(f"**{trade['ticker']} - {trade['entry_date']}**") + st.write(f"**Direction:** {trade['direction']}") + if trade['strategy']: + st.write(f"**Strategy:** {trade['strategy']}") + + with cols[1]: + st.write(f"**Entry:** ${trade['entry_price']:.2f}") + st.write(f"**Shares:** {trade['shares']}") + + with cols[2]: + if trade['exit_price']: + pl = (trade['exit_price'] - trade['entry_price']) * trade['shares'] + total_pl += pl + if pl > 0: + winning_trades += 1 + st.write(f"**Exit:** ${trade['exit_price']:.2f}") + st.write(f"**P/L:** ${pl:.2f}") + st.write(f"**Exit Date:** {trade['exit_date']}") + else: + st.write("**Status:** Open") else: st.info("No trades linked to this plan")