Search code examples
pythonapibinance

Binance API get_symbol_ticker() takes 1 positional argument but 2 were given


I get the following error when trying to get information about a coins price, using the following code.

ticker = client.get_symbol_ticker(stock.symbol)

Also, here is the stock object.

class Stock:
    def __init__(self, symbol):
        self.symbol = symbol
        self.alreadyHave = False
        self.prices = []
        self.priceBoughtAt = 0
        self.quantityBought = 0
        self.marketClosed = False
        self.predictedPrices = []
        # self.positiveTweets = 1
        # self.negativeTweets = 0

Solution

  • get_symbol_ticker() takes named parameters as shown in the docs.

    Try calling it with:

    ticker = client.get_symbol_ticker(symbol=stock.symbol)