import asyncio import ccxt.async_support as ccxt import json async def main(): exchange = ccxt.binance({ 'apiKey': "rgYQzYRFoM8XBY6athcxj89vtTwhaCZ45AtGOpOdWBG6g2Gw1uPkwEIuPpdkxsaG", 'secret': "GOarX2z3YszV5FMBXExOvP7v9P4mbcPnjY26mgfeyySmyS9IEy7vIp1a2ueJCMKp", 'options': {'defaultType': 'future'}, 'enableRateLimit': True }) try: print("Checking position...") pos = await exchange.fapiPrivateGetPositionRisk({'symbol': 'XRPUSDT'}) for p in pos: if float(p['positionAmt']) != 0: print(f"POSITION: amt={p['positionAmt']}, entry={p['entryPrice']}, side={p['positionSide']}") print("\nFetching ALL open orders (including STOP) directly via fapiPrivateGetOpenOrders...") orders = await exchange.fapiPrivateGetOpenOrders({'symbol': 'XRPUSDT'}) print(f"Total open orders on Binance: {len(orders)}") for o in orders: print(f"[{o['time']}] TYPE: {o['type']}, SIDE: {o['side']}, PRICE: {o['price']}, STOP: {o['stopPrice']}, ID: {o['orderId']}, CLIENT_ID: {o['clientOrderId']}") except Exception as e: print(f"Error: {e}") await exchange.close() asyncio.run(main())