Skip to content
Advertisement

Get order parameters from Python-Binance

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 :

JavaScript

And I get this result:

JavaScript

Tried to print just the status:

JavaScript

But it returns an error:

JavaScript

Advertisement

Answer

Try this: pprint.pprint(orders[0]['status'])

order variable is a list that contains dictionary. To get access to first element of the list use [0]. Now you only get value from dictionary. You can do this using [dictionary_key] in this example ['status']. Combining this you can print status.

If you are not sure which type is your variable use simply print(type(variable_name))

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement