Bot auto-update: src/__pycache__/main_ml.cpython-310.pyc,src/main_ml.py
This commit is contained in:
parent
2b0624a04b
commit
fce2ebc467
Binary file not shown.
|
|
@ -570,6 +570,24 @@ class MLTradingBot:
|
||||||
hold_time_min = hold_time_s / 60
|
hold_time_min = hold_time_s / 60
|
||||||
await self.dashboard.record_sell(pair, current_qty, current_price, profit_usd, profit_pct, hold_time_min)
|
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]
|
del self.current_trades[pair]
|
||||||
logger.info(f'✅ EXIT EXECUTED & RECORDED TO DASHBOARD!')
|
logger.info(f'✅ EXIT EXECUTED & RECORDED TO DASHBOARD!')
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue