x = json.loads(y) #y is received from sender
print(x)
Output:
[
[
{
"O2JUKZ-4QUHH-6ZUZWF": {
"avg_price": "0.00000",
"cost": "0.00000",
"descr": {
"close": None,
"leverage": "0"
},
"status": "open",
"stoprice": "0.00000"
}
}
],
"openOrders",
{
"sequence": 1
}
]
Question: How do we assign order number (the characters in bold) to a variable, when It always changes?
Already tried: x[0][0]['O2JUKZ-4QUHH-6ZUZWF']['status'] to get the status (which works), but doesn't work anymore when "O2JUKZ-4QUHH-6ZUZWF" changes.
How do we assign order number to variable?