I've reviewed this post: How to key into deeply nested dictionary and list structure and attempted to break down this list structure, however I continue to fail as this example has the final "me" in [] while my problem does not :(
session.my_position(symbol="BTCUSDT")
{'ret_code': 0, 'ret_msg': 'OK', 'ext_code': '', 'ext_info': '', 'result': [{'user_id': 3424844, 'symbol': 'BTCUSDT', 'side': 'Buy', 'size': 0, 'position_value': 0, 'entry_price': 0, 'liq_price': 0, 'bust_price': 0, 'leverage': 1, 'auto_add_margin': 0, 'is_isolated': True, 'position_margin': 0, 'occ_closing_fee': 0, 'realised_pnl': -0.2655184, 'cum_realised_pnl': -973.98619164, 'free_qty': 0, 'tp_sl_mode': 'Full', 'unrealised_pnl': 0, 'deleverage_indicator': 0, 'risk_id': 1, 'stop_loss': 0, 'take_profit': 0, 'trailing_stop': 0, 'position_idx': 1, 'mode': 'BothSide'}, {'user_id': 3424844, 'symbol': 'BTCUSDT', 'side': 'Sell', 'size': 0, 'position_value': 0, 'entry_price': 0, 'liq_price': 0, 'bust_price': 0, 'leverage': 1, 'auto_add_margin': 0, 'is_isolated': True, 'position_margin': 0, 'occ_closing_fee': 0, 'realised_pnl': -0.3662503, 'cum_realised_pnl': -1121.1239092, 'free_qty': 0, 'tp_sl_mode': 'Full', 'unrealised_pnl': 0, 'deleverage_indicator': 0, 'risk_id': 1, 'stop_loss': 0, 'take_profit': 0, 'trailing_stop': 0, 'position_idx': 2, 'mode': 'BothSide'}], 'time_now': '1655352862.461627', 'rate_limit_status': 116, 'rate_limit_reset_ms': 1655352862459, 'rate_limit': 120}
I believe it should be:
session.my_position(symbol="BTCUSDT")['result']['entry_price']
however it returns:
Traceback (most recent call last): File "", line 1, in TypeError: list indices must be integers or slices, not str
I've also tried:
session.my_position(symbol="BTCUSDT")['result'][2][0]
session.my_position(symbol="BTCUSDT")['result'][1][0]
session.my_position(symbol="BTCUSDT")['result'][0][0]
session.my_position(symbol="BTCUSDT")['result'][0][2]
I just can't figure out how to get down to that next level below result :( Please help.