How to get asset from dictionary on "Bingx" in Python #2
-
|
I wrote "def" that it fetch contracts like below: And it works correctly. Now I write another "def" like this, but I want to fetch 'asset', I put it below: But, it has type error!
Send_request in both the above functions will return the correct answer. I also put the reference link below: I also test to change 'key' name such as 'asset','data','balance', but they are wrong too. Please tell me how to fetch every fields of margindata dictionary like instruments. ***I not used any other library like ccxt,... . I just used this. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
|
What is the contents of "margindata"? Which endpoint are you using? |
Beta Was this translation helpful? Give feedback.
-
|
@allg97 Is your problem solved? |
Beta Was this translation helpful? Give feedback.

So what's happening here is that "b" that is being given to the "Balance" class is a string and it is not a json object. So your class cannot initialize correctly.
Here is how you can fix this: