查看函数的文档字符串:
"""
[{'orderID': '57180f5f-d16a-62d6-ff8d-d1430637a8d9',
'clOrdID': '', 'clOrdLinkID': '',
'account': XXXXX, 'symbol': 'XBTUSD', 'side': 'Sell',
'simpleOrderQty': None,
'orderQty': 30, 'price': 3968,
'displayQty': None, 'stopPx': None, 'pegOffsetValue': None,
'pegPriceType': '', 'currency': 'USD', 'settlCurrency': 'XBt',
'ordType': 'Limit', 'timeInForce': 'GoodTillCancel',
'execInst': 'ParticipateDoNotInitiate', 'contingencyType': '',
'exDestination': 'XBME', 'ordStatus': 'New', 'triggered': '',
'workingIndicator': True, 'ordRejReason': '', 'simpleLeavesQty': None,
'leavesQty': 30, 'simpleCumQty': None, 'cumQty': 0, 'avgPx': None,
'multiLegReportingType': 'SingleSecurity', 'text': 'Submission from www.bitmex.com',
'transactTime': '2019-03-25T07:10:34.290Z', 'timestamp': '2019-03-25T07:10:34.290Z'}]
"""
这表明它返回一个字典列表,而不是一个对象。没有bids
您需要访问的属性。
open_orders = bitmex.ws_open_order_objects_of_account()
for order in open_orders:
print(order['price'])