I'm trying to get some parameters of my orders from Python-Binance API. In this case, I would like to get only the 'status' of an order and save it into a variable.
I used this to get my last order :
orders = client.get_all_orders(symbol=symbol, limit=1)
And I get this result:
[{'clientOrderId': 'HzHxjogJf5rXrzD2uFnTyMn',
'cummulativeQuoteQty': '12.06757100',
'executedQty': '0.00030000',
'icebergQty': '0.00000000',
'isWorking': True,
'orderId': 88978639302,
'orderListId': -1,
'origQty': '0.00030000',
'origQuoteOrderQty': '0.00000000',
'price': '31558.57000000',
'side': 'BUY',
'status': 'FILLED',
'stopPrice': '31592.06000000',
'symbol': 'BTCUSDT',
'time': 1612653434918,
'timeInForce': 'GTC',
'type': 'STOP_LOSS_LIMIT',
'updateTime': 1612109872451}]
Tried to print just the status:
pprint.pprint(orders['status'])
But it returns an error:
TypeError: list indices must be integers or slices, not str