0

I have bot that is running using this module (https://python-binance.readthedocs.io/en/latest/binance.html). I have problem with client.get_open_orders() account endpoint. It has strange behavior. I'm running my bot in loop and sometimes while there is open order on exchange it starts to return empty list - [] without giving any kind of error message (if order is open I'm printing it in console), but in next loops it returns that order is open. What is cause of this problem? And how it can be avoided? Or is there any other method to get open orders reliably?

# Function to get active orders from binance for specific currency
def get_binance_orders(b, symbol):
    # Tries to connect to server every few seconds
    failed_connection = True
    while failed_connection:
        try:
            # Gets active orders
            binance_orders = b.get_open_orders(symbol=symbol)
            print("BINANCE ORDERS", binance_orders)
            # ...
            failed_connection = False
        except Exception as e:
            print(e)
            print("get_binance_orders: Can't get latest market data from Binance!")
            time.sleep(0.5)
Matiss Zuravlevs
  • 329
  • 2
  • 11

0 Answers0