Bugfix: Bot + Dashboard sync - Save active_trades.json every cycle so dashboard shows real-time positions (2026-07-09 20:00)
This commit is contained in:
parent
17b94a904e
commit
2b09ab6d13
|
|
@ -218,6 +218,13 @@ class TradingBotV03:
|
|||
self.place_buy_order(best_signal, trade_amount)
|
||||
|
||||
logger.info(f"CYCLE END | Active trades: {len(self.active_trades)} | Free USDT: ${usdt_free:.2f}")
|
||||
# Save active trades for dashboard
|
||||
import json
|
||||
try:
|
||||
with open('/home/marc/bot-deploy/active_trades.json', 'w') as f:
|
||||
json.dump({'active_trades': self.active_trades, 'count': len(self.active_trades)}, f)
|
||||
except Exception as e:
|
||||
logger.warning(f'Failed to save active_trades.json: {e}')
|
||||
logger.info("=" * 70)
|
||||
|
||||
def run(self):
|
||||
|
|
@ -226,8 +233,8 @@ class TradingBotV03:
|
|||
logger.info("TRADING BOT V0.3 STARTED")
|
||||
logger.info(f"Symbols: {SYMBOLS}")
|
||||
logger.info(f"Strategy: Local Min Signals | Risk: TP=+{TAKE_PROFIT_PCT*100:.1f}% / SL={STOP_LOSS_PCT*100:.1f}%")
|
||||
logger.info(f"Position size: Max ${MAX_TRADE_USDT}/trade (50% capital)")
|
||||
logger.info(f"KEY FIX: Fresh balance fetched EVERY cycle (no stale cache!)")
|
||||
logger.info(f"Position size: Max ${MAX_TRADE_USDT}/trade (50% capital avail)")
|
||||
logger.info(f"")
|
||||
logger.info("=" * 70)
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in New Issue