Skip to content
Discussion options

You must be logged in to vote

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:

from bingx.api import BingxAPI

bingx = BingxAPI(API_KEY, SECRET_KEY, timestamp="local")

class Balance(dict):
    """
    Returns a python dict object
    """
    def __init__(self, data, exchange):
        if exchange == "bingx":
            balance_data = data['data']['balance']
            my_dict = {
                'balance': float(balance_data['balance']),
                'equity': float(balance_data['equity']),
                'unrealizedProfit': float(balance_data['unrealizedProfit']),
   …

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@allg97
Comment options

@amirinsight
Comment options

@allg97
Comment options

@amirinsight
Comment options

Answer selected by amirinsight
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants