feat: add portfolio summary to simulation page
Shows real-time portfolio metrics: - Cash Balance - Position (quantity and value) - Entry Price / Current Price - Unrealized P&L - Total Value - P&L (absolute and percentage) Updates as simulation runs and trades are executed.
This commit is contained in:
@@ -60,6 +60,9 @@ def run_simulation_sync(
|
||||
for k in engine.klines
|
||||
]
|
||||
simulation.trade_log = engine.trade_log
|
||||
# Save portfolio data
|
||||
if hasattr(engine, 'current_balance') and engine.current_balance is not None:
|
||||
simulation.signals = [serialize_signal(s) for s in engine.signals]
|
||||
db.commit()
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
Reference in New Issue
Block a user