Bot auto-update: src/__pycache__/main_ml.cpython-310.pyc,src/main_ml.py
This commit is contained in:
parent
daab8bc7d4
commit
b42b06bc5d
Binary file not shown.
|
|
@ -110,7 +110,6 @@ class MLTradingBot:
|
||||||
|
|
||||||
# Symbol constraints cache
|
# Symbol constraints cache
|
||||||
self.symbol_info = {}
|
self.symbol_info = {}
|
||||||
self.pairs = ['BTCUSDT', 'ETHUSDT', 'SOLUSDT', 'BNBUSDT', 'XRPUSDT']
|
|
||||||
|
|
||||||
# Track open positions
|
# Track open positions
|
||||||
self.current_trades = {} # CLEAN START - reset on bot restart
|
self.current_trades = {} # CLEAN START - reset on bot restart
|
||||||
|
|
@ -921,37 +920,6 @@ class MLTradingBot:
|
||||||
# Auto-recover open positions from Binance on restart
|
# Auto-recover open positions from Binance on restart
|
||||||
|
|
||||||
# STARTUP: Load open orders from Binance so Bot knows its positions
|
# STARTUP: Load open orders from Binance so Bot knows its positions
|
||||||
logger.info('📥 Loading open positions from Binance...')
|
|
||||||
try:
|
|
||||||
account = await self.binance.get_balance()
|
|
||||||
for pair in ['BTCUSDT', 'ETHUSDT', 'SOLUSDT', 'BNBUSDT', 'XRPUSDT']:
|
|
||||||
try:
|
|
||||||
orders = await self.binance.get_open_orders(pair)
|
|
||||||
if orders:
|
|
||||||
order = orders[0]
|
|
||||||
self.current_trades[pair] = {
|
|
||||||
'qty': float(order['origQty']),
|
|
||||||
'buy_price': float(order['price']),
|
|
||||||
'buy_time': datetime.fromtimestamp(order['time']/1000).isoformat(),
|
|
||||||
'order_id': order['orderId'],
|
|
||||||
'peak_profit': 0.0
|
|
||||||
}
|
|
||||||
logger.info(f' ✅ Loaded {pair}: {order[origQty]} @ ')
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
except Exception as e:
|
|
||||||
logger.warning(f'Could not load Binance positions: {e}')
|
|
||||||
|
|
||||||
logger.info(f'✅ Startup complete: {len(self.current_trades)} positions loaded from Binance')
|
|
||||||
|
|
||||||
# Create trigger file location
|
|
||||||
trigger_file = '/tmp/bot_liquidate_trigger'
|
|
||||||
|
|
||||||
# FIRST: Cancel all pending orders to free capital
|
|
||||||
await self.cancel_all_open_orders()
|
|
||||||
|
|
||||||
# SECOND: Load exchange info BEFORE liquidation
|
|
||||||
await self.load_exchange_info()
|
|
||||||
|
|
||||||
# THIRD: ONE-TIME LIQUIDATE BTC TO USDT IF NEEDED
|
# THIRD: ONE-TIME LIQUIDATE BTC TO USDT IF NEEDED
|
||||||
await self.liquidate_btc_to_usdt_on_startup()
|
await self.liquidate_btc_to_usdt_on_startup()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue