我有一个正在使用此模块 (https://python-binance.readthedocs.io/en/latest/binance.html) 运行的机器人。我对 client.get_open_orders() 帐户端点有问题。它有奇怪的行为。我正在循环运行我的机器人,有时当交换有开放订单时,它开始返回空列表 - [] 而不给出任何类型的错误消息(如果订单是开放的,我将在控制台中打印它),但在下一步循环它返回该订单已打开。这个问题的原因是什么?以及如何避免?或者有没有其他方法可以可靠地获得未结订单?
# 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)