I'm trying to understand how to work with the json returns I am getting from de Kraken API.
This is my code:
resp = kraken_request("/0/private/TradeBalance", {
"nonce": str(int(10000*time.time())),
"asset": "USD"
}, api_key, api_sec)
print("TradeBalance: " + str(resp.json()))
resp = kraken_request("/0/private/OpenOrders", {
"nonce": str(int(10000*time.time())),
"asset": "USD"
}, api_key, api_sec)
print()
print("OpenOrders: " + str(resp.json())
This is my json return (edited so it is no real data):
{"error":[],"result":{"open":{"ABCDE-AWSCG-ABCDE":{"refid":null,"userref":0,"status":"open","opentm":1666683580.8848298,"starttm":0,"expiretm":0,"descr":{"pair":"LINKEUR","type":"sell","ordertype":"limit","price":"8.70000","price2":"0","leverage":"none","order":"sell 1.00000000 LINKEUR @ limit 8.70000","close":""},"vol":"1.00000000","vol_exec":"0.00000000","cost":"0.000000","fee":"0.000000","price":"0.000000","stopprice":"0.000000","limitprice":"0.000000","misc":"","oflags":"fcib"},"ABCDE-AHKEK-ABCDE":{"refid":null,"userref":0,"status":"open","opentm":1666683548.8137474,"starttm":0,"expiretm":0,"descr":{"pair":"LINKEUR","type":"sell","ordertype":"limit","price":"8.60000","price2":"0","leverage":"none","order":"sell 1.00000000 LINKEUR @ limit 8.60000","close":""},"vol":"1.00000000","vol_exec":"0.00000000","cost":"0.000000","fee":"0.000000","price":"0.000000","stopprice":"0.000000","limitprice":"0.000000","misc":"","oflags":"fcib"},"ABCDE-POQX7-ABCDE":{"refid":null,"userref":0,"status":"open","opentm":1666683517.207053,"starttm":0,"expiretm":0,"descr":{"pair":"LINKEUR","type":"sell","ordertype":"limit","price":"8.50000","price2":"0","leverage":"none","order":"sell 1.00000000 LINKEUR @ limit 8.50000","close":""},"vol":"1.00000000","vol_exec":"0.00000000","cost":"0.000000","fee":"0.000000","price":"0.000000","stopprice":"0.000000","limitprice":"0.000000","misc":"","oflags":"fcib"},"ABCDE-UADOV-ABCDE":{"refid":null,"userref":0,"status":"open","opentm":1666683490.4299977,"starttm":0,"expiretm":0,"descr":{"pair":"LINKEUR","type":"sell","ordertype":"limit","price":"8.40000","price2":"0","leverage":"none","order":"sell 1.00000000 LINKEUR @ limit 8.40000","close":""},"vol":"1.00000000","vol_exec":"0.00000000","cost":"0.000000","fee":"0.000000","price":"0.000000","stopprice":"0.000000","limitprice":"0.000000","misc":"","oflags":"fcib"},"ABCDE-ABCDE-2JGH3M":{"refid":null,"userref":0,"status":"open","opentm":1666646615.668582,"starttm":0,"expiretm":0,"descr":{"pair":"LINKEUR","type":"sell","ordertype":"limit","price":"8.30000","price2":"0","leverage":"none","order":"sell 1.00000000 LINKEUR @ limit 8.30000","close":""},"vol":"1.00000000","vol_exec":"0.00000000","cost":"0.000000","fee":"0.000000","price":"0.000000","stopprice":"0.000000","limitprice":"0.000000","misc":"","oflags":"fciq"},"ABCDE-623OO-ABCDE":{"refid":null,"userref":0,"status":"open","opentm":1666646572.9639573,"starttm":0,"expiretm":0,"descr":{"pair":"LINKEUR","type":"sell","ordertype":"limit","price":"8.20000","price2":"0","leverage":"none","order":"sell 1.00000000 LINKEUR @ limit 8.20000","close":""},"vol":"1.00000000","vol_exec":"0.00000000","cost":"0.000000","fee":"0.000000","price":"0.000000","stopprice":"0.000000","limitprice":"0.000000","misc":"","oflags":"fciq"},"ABCDE-4EHBG-ABCDE":{"refid":null,"userref":0,"status":"open","opentm":1666646537.55891,"starttm":0,"expiretm":0,"descr":{"pair":"LINKEUR","type":"sell","ordertype":"limit","price":"8.10000","price2":"0","leverage":"none","order":"sell 1.00000000 LINKEUR @ limit 8.10000","close":""},"vol":"1.00000000","vol_exec":"0.00000000","cost":"0.000000","fee":"0.000000","price":"0.000000","stopprice":"0.000000","limitprice":"0.000000","misc":"","oflags":"fciq"},"ABCDE-SPHMF-ABCDE":{"refid":null,"link_id":"ABCDE-YWJVW-ABCDE","userref":0,"status":"open","opentm":1666646453.770994,"starttm":0,"expiretm":0,"descr":{"pair":"LINKEUR","type":"sell","ordertype":"limit","price":"7.99900","price2":"0","leverage":"none","order":"sell 1.00000000 LINKEUR @ limit 7.99900","close":""},"vol":"1.00000000","vol_exec":"0.00000000","cost":"0.000000","fee":"0.000000","price":"0.000000","stopprice":"0.000000","limitprice":"0.000000","misc":"","oflags":"fcib"},"ABCDE-RVWQO-ABCDE":{"refid":null,"userref":0,"status":"open","opentm":1663311467.0131989,"starttm":0,"expiretm":0,"descr":{"pair":"ETHWUSD","type":"sell","ordertype":"limit","price":"1000.000","price2":"0","leverage":"none","order":"sell 357.00000000 ETHWUSD @ limit 1000.000","close":""},"vol":"357.00000000","vol_exec":"0.00000000","cost":"0.0000000","fee":"0.0000000","price":"0.0000000","stopprice":"0.0000000","limitprice":"0.0000000","misc":"","oflags":"fcib"}}}}
Now I can't work out how to work with this json, I'd like to go through it and deal with each of the items, like "ABCDE-AWSCG-ABCDE" and "ABCDE-POQX7-ABCDE" etc., with for each all of it's underlying information, I have no idea how to do this. Please note, I do not know the item names like "ABCDE-AWSCG-ABCDE" beforehand.