Closed dhp42895 closed 11 months ago
Python instance method has a hidden positional argument: self
. That's why it throws the TypeError
.
Back to your question, you can find get_avg_price
's signature at https://python-binance.readthedocs.io/en/latest/binance.html#binance.client.AsyncClient.get_avg_price .
get_avg_price(**params)
And it turns out this method doesn't accept any positional argument at all (except self
), therefore, you have to pass symbol as a keyword argument.
Ah I see! Thank you so much for your help.
Describe the bug When instantiating a client and using the get_avg_price or get_symbol_ticker functions, there is a type error stating that one positional argument is required yet two were given, even though I have only given one positional argument.
To Reproduce import config from binance import Client test = Client(api_key=config.API_KEY, api_secret=config.API_SECRET) test.get_avg_price("BTCUSDT")
Expected behavior I expect to get the symbol price ticker or average price ticker.
Environment (please complete the following information):
Logs or Additional context Output: File "c:_Personal\trading\sandbox.py", line 36, in
test.get_avg_price("BTCUSDT")
TypeError: get_avg_price() takes 1 positional argument but 2 were given