diff --git a/src/streamlit_app.py b/src/streamlit_app.py index e135d00..2567210 100644 --- a/src/streamlit_app.py +++ b/src/streamlit_app.py @@ -723,7 +723,7 @@ def trading_system_page(): try: update_portfolio_value(new_value, new_cash, notes) st.success("Portfolio value updated successfully!") - st.experimental_set_query_params(rerun=True) + st.set_query_params(rerun=True) except Exception as e: st.error(f"Error updating portfolio value: {str(e)}") diff --git a/src/trading/trading_plan.py b/src/trading/trading_plan.py index a2f4a8a..9ffc30d 100644 --- a/src/trading/trading_plan.py +++ b/src/trading/trading_plan.py @@ -267,8 +267,46 @@ def get_all_trading_plans(status: Optional[PlanStatus] = None) -> List[TradingPl query += " ORDER BY updated_at DESC" results = client.query(query, params) - rows = results.result_rows - return [get_trading_plan(row[0]) for row in rows] + rows = results.result_rows # Ensure this is the correct method to access rows + return [TradingPlan( + id=row[0], + plan_name=row[1], + status=PlanStatus(row[2]), + created_at=row[3], + updated_at=row[4], + timeframe=Timeframe(row[5]), + market_focus=MarketFocus(row[6]), + entry_criteria=row[7], + exit_criteria=row[8], + stop_loss=row[9], + profit_target=row[10], + risk_reward_ratio=row[11], + trade_frequency=TradeFrequency(row[12]), + market_conditions=row[13], + indicators_used=row[14], + entry_confirmation=row[15], + position_sizing=row[16], + maximum_drawdown=row[17], + max_trades_per_day=row[18], + max_trades_per_week=row[19], + total_risk_per_trade=row[20], + max_portfolio_risk=row[21], + adjustments_for_drawdown=row[22], + risk_controls=row[23], + win_rate=row[24], + average_return_per_trade=row[25], + profit_factor=row[26], + historical_backtest_results=row[27], + real_trade_performance=row[28], + improvements_needed=row[29], + strategy_version=row[30], + plan_author=row[31], + trade_review_notes=row[32], + future_testing_ideas=row[33], + sector_focus=row[34], + fundamental_criteria=row[35], + options_strategy_details=row[36] + ) for row in rows] except Exception as e: print(f"Error retrieving trading plans: {e}")