I'm using a basic script to retrieve some trading data from an exchange, here is the response:
{'info': {'symbol': 'ETHBTC',
'orderListId': -1,
'price': '0.01083700',
'origQty': '0.01800000',
'executedQty': '0.00000000',
'cummulativeQuoteQty': '0.00000000',
'status': 'NEW',
'timeInForce': 'GTC',
'type': 'LIMIT',
'side': 'BUY',
'stopPrice': '0.00000000',
'icebergQty': '0.00000000',
'time': 1567078061338,
'updateTime': 1567078061338,
'isWorking': True}}
Now i want to print some parts of this response individually.
If i try:
tot = exchange.fetch_open_orders()
for x in tot:
print(x['symbol'])
I'll get: 'ETHBTC'. Until now, everything is normal.
But if i try:
tot = exchange.fetch_open_orders()
for x in tot:
print(x['origQty'])
I get a KeyError: 'origQty', which is weird, because this error should appear when i try to reference a parameter which doesn't exist, but it exists, since it is in my response. What am i doing wrong?
tot? It can't be that dict you show, because iterating through a dict gives you just the keys.tot? If it is the response dictionary then I would expect the first example to fail too