edeng23 / binance-trade-bot

Automated cryptocurrency trading bot
GNU General Public License v3.0
7.87k stars 2.18k forks source link

TypeError: list indices must be integers or slices, not str #392

Open Cerlo opened 3 years ago

Cerlo commented 3 years ago

Hello,

I have this error message : TypeError: list indices must be integers or slices, not str

Traceback (most recent call last): File "/home/binance_bot/Binance/binance-trade-bot/binance_trade_bot/scheduler.py", line 25, in _run_job super()._run_job(job) File "/home/binance_bot/.local/lib/python3.8/site-packages/schedule/__init__.py", line 172, in _run_job ret = job.run() File "/home/binance_bot/.local/lib/python3.8/site-packages/schedule/__init__.py", line 661, in run ret = self.job_func() File "/home/binance_bot/Binance/binance-trade-bot/binance_trade_bot/strategies/multiple_coins_strategy.py", line 43, in scout self._jump_to_best_coin(coin, coin_price) File "/home/binance_bot/Binance/binance-trade-bot/binance_trade_bot/auto_trader.py", line 139, in _jump_to_best_coin ratio_dict = self._get_ratios(coin, coin_price) File "/home/binance_bot/Binance/binance-trade-bot/binance_trade_bot/auto_trader.py", line 126, in _get_ratios transaction_fee = self.manager.get_fee(pair.from_coin, self.config.BRIDGE, True) + self.manager.get_fee( File "/home/binance_bot/Binance/binance-trade-bot/binance_trade_bot/binance_api_manager.py", line 50, in get_fee base_fee = self.get_trade_fees()[origin_coin + target_coin] File "/home/binance_bot/.local/lib/python3.8/site-packages/cachetools/decorators.py", line 26, in wrapper v = func(*args, **kwargs) File "/home/binance_bot/Binance/binance-trade-bot/binance_trade_bot/binance_api_manager.py", line 43, in get_trade_fees return {ticker["symbol"]: ticker["taker"] for ticker in self.binance_client.get_trade_fee()["tradeFee"]} TypeError: list indices must be integers or slices, not str

Do you have any idea on what is happening?

kj-lai commented 3 years ago

Have you tried leaving the current_coin = empty?

arturoller commented 3 years ago

I have the same error regardless of whether I have something in current_coin or not.

arturoller commented 3 years ago

I will add that the python version is 3.8

arturoller commented 3 years ago

In the file ./binance_trade_bot/binance_api_manager.py I have replaced in get_trade_fees: return {ticker["symbol"]: ticker["taker"] for ticker in self.binance_client.get_trade_fee()["tradeFee"]}

On: return {ticker["symbol"]: float(ticker["takerCommission"]) for ticker in self.binance_client.get_trade_fee()}

And it works for me

Hirogurimu commented 2 years ago

In the file ./binance_trade_bot/binance_api_manager.py I have replaced in get_trade_fees: return {ticker["symbol"]: ticker["taker"] for ticker in self.binance_client.get_trade_fee()["tradeFee"]}

On: return {ticker["symbol"]: float(ticker["takerCommission"]) for ticker in self.binance_client.get_trade_fee()}

And it works for me

hello can you help me