Bot auto-update: src/__pycache__/main_ml.cpython-310.pyc,src/main_ml.py

This commit is contained in:
Marc Blatter 2026-07-04 14:30:43 +02:00
parent 2b0624a04b
commit fce2ebc467
2 changed files with 18 additions and 0 deletions

View File

@ -570,6 +570,24 @@ class MLTradingBot:
hold_time_min = hold_time_s / 60
await self.dashboard.record_sell(pair, current_qty, current_price, profit_usd, profit_pct, hold_time_min)
# ALSO record to completed_trades before deletion
completed_trade = {
'pair': pair,
'entry_price': buy_price,
'exit_price': current_price,
'qty': current_qty,
'profit_usd': profit_usd,
'profit_pct': profit_pct,
'entry_time': self.current_trades[pair]['buy_time'],
'exit_time': datetime.now().isoformat(),
'hold_time_min': hold_time_min
}
# Send to dashboard's completed_trades
try:
await self.dashboard.update_state({'completed_trades': [completed_trade]})
except:
pass
del self.current_trades[pair]
logger.info(f'✅ EXIT EXECUTED & RECORDED TO DASHBOARD!')
else: