CyberPunkMetalHead / Binance-volatility-trading-bot

This is a fully functioning Binance trading bot that measures the volatility of every coin on Binance and places trades with the highest gaining coins If you like this project consider donating though the Brave browser to allow me to continuously improve the script.
MIT License
3.41k stars 776 forks source link

KeyError: 'BTTEUR' #177

Closed costicraciunescu closed 3 years ago

costicraciunescu commented 3 years ago

Hi, My base currency is set to EUR and from time to time I get the below error for various pairs and the bot stops completely

Traceback (most recent call last):
  File "C:\TradingBot\Binance-volatility-trading-bot\Binance Detect Moonings.py", line 592, in <module>
    orders, last_price, volume = buy()
  File "C:\TradingBot\Binance-volatility-trading-bot\Binance Detect Moonings.py", line 292, in buy
    volume, last_price = convert_volume()
  File "C:\TradingBot\Binance-volatility-trading-bot\Binance Detect Moonings.py", line 274, in convert_volume
    volume[coin] = float(QUANTITY / float(last_price[coin]['price']))
KeyError: 'BTTEUR'

Here is my config.yml


# These options apply to how the script will operate.
script_options:
  # Switch between testnet and mainnet
  # Setting this to False will use REAL funds, use at your own risk
  TEST_MODE: False
  LOG_TRADES: True
  LOG_FILE: 'trades.txt'

  # Set this to true if you are accessing binance from within the United States of America
  # Need to change TLD
  AMERICAN_USER: False

# These options apply to the trading methods the script executes
trading_options:

  # select your base currency to use for trading (trade for example USDT pairs)
  PAIR_WITH: EUR

  # Total amount per trade (your base currency balance must be at least MAX_COINS * QUANTITY)
  # Binance uses a minimum of 10 USDT per trade, add a bit extra to enable selling if the price drops.
  # Recommended: no less than 12 USDT. Suggested: 15 or more.
  QUANTITY: 15

  # List of trading pairs to exclude
  # by default we're excluding the most popular fiat pairs
  FIATS:
    - EURUSDT
    - GBPUSDT
    - JPYUSDT
    - USDUSDT
    - DOWN
    - UP

  # Maximum number of trade 'slots' at any time (your USDT balance must be at least MAX_COINS * QUANTITY)
  MAX_COINS: 1

  # the amount of time in MINUTES to calculate the difference from the current price (minimum: 1).
  TIME_DIFFERENCE: 2

  # Number of times to check for TP/SL during each TIME_DIFFERENCE (minimum: 1).
  # Don't spam the Binance API, you will be banned (max 1200 requests per minute per IP).
  RECHECK_INTERVAL: 10

  # the difference in % between the first and second checks for the price.
  CHANGE_IN_PRICE: 10

  # define in % when to sell a coin that's not making a profit.
  STOP_LOSS: 5

  # define in % when to take profit on a profitable coin.
  TAKE_PROFIT: .8

  # Use custom tickers.txt list for filtering pairs.
  CUSTOM_LIST: True

  # Name of custom tickers list
  TICKERS_LIST: 'tickers.txt'

  # whether to use trailing stop loss or not; default is True
  USE_TRAILING_STOP_LOSS: True

  # when hit TAKE_PROFIT, move STOP_LOSS to TRAILING_STOP_LOSS percentage points below TAKE_PROFIT hence locking in profit
  # when hit TAKE_PROFIT, move TAKE_PROFIT up by TRAILING_TAKE_PROFIT percentage points
  TRAILING_STOP_LOSS: .4
  TRAILING_TAKE_PROFIT: .1

  # Trading fee in % per trade.
  # If using 0.75% (using BNB for fees) you must have BNB in your account to cover trading fees.
  # If using BNB for fees, it MUST be enabled in your Binance 'Dashboard' page (checkbox).
  TRADING_FEE: .075

  SIGNALLING_MODULES:
    - pausebotmod
    - signalsamplemod

Any hints would be much appreciated

Thanks, C.

cemonurrr commented 3 years ago

Same problem ;

Traceback (most recent call last):
  File "C:\binance-bot\Binance Detect Moonings.py", line 592, in <module>
    orders, last_price, volume = buy()
  File "C:\binance-bot\Binance Detect Moonings.py", line 292, in buy
    volume, last_price = convert_volume()
  File "C:\binance-bot\Binance Detect Moonings.py", line 274, in convert_volume
    volume[coin] = float(QUANTITY / float(last_price[coin]['price']))
KeyError: 'TOMOUSDT'

anyone who can help ?

sunnyhasija commented 3 years ago

Same problem on linux:

Traceback (most recent call last):
  File "/home/cantos/Downloads/Binance-volatility-trading-bot-main/Binance Detect Moonings.py", line 592, in <module>
    orders, last_price, volume = buy()
  File "/home/cantos/Downloads/Binance-volatility-trading-bot-main/Binance Detect Moonings.py", line 292, in buy
    volume, last_price = convert_volume()
  File "/home/cantos/Downloads/Binance-volatility-trading-bot-main/Binance Detect Moonings.py", line 274, in convert_volume
    volume[coin] = float(QUANTITY / float(last_price[coin]['price']))
KeyError: 'ICPUSDT'
Zajano commented 3 years ago

I believe this is happening because of external_signals() being used to add coins to the volitile_coins list, but not to the historical_prices list - which causes the key error when referencing the coin in last_price (since that's built from historical_prices).

Created PR #181 as a quick-fix similar to the previous try/except fixes

ShogunMan commented 3 years ago

Not an issue, check faq, docs and discord.