Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError('index 0 is out of bounds for axis 0 with size 0') #793

Closed
leohrs opened this issue Apr 20, 2023 · 26 comments
Closed

IndexError('index 0 is out of bounds for axis 0 with size 0') #793

leohrs opened this issue Apr 20, 2023 · 26 comments

Comments

@leohrs
Copy link

leohrs commented Apr 20, 2023

Trying to run in SHIBBRL market on binance, but I keep getting
"IndexError('index 0 is out of bounds for axis 0 with size 0')" when the bot starts.
happens both on Docker Desktop windows or directly on prompt. Version 8.0.5.
Only tried binance so far.
Also, I only get this message if running on an existing market in which I have sufficient funds and in live mode, meaning:
• if I run in test mode it works.
• If i choose another quote_currency, it'll prompt that I have insufficient funds.
• If i try a non-existing market, it'll give me "non-existing market" message.

my config file:

"binance": {
"api_url": "https://api.binance.com",
"config": {
"autorestart": 1,
"base_currency": "SHIB",
"disablebuynearhigh": 1,
"enableinsufficientfundslogging": 1,
"enabletelegrambotcontrol": 1,
"granularity": "15m",
"live": 1,
"nobuynearhighpcnt": 1,
"nosellmaxpcnt": 3,
"nosellminpcnt": -13,
"quote_currency": "BRL",
"selllowerpcnt": -21,
"telegram": 1,
"trailingbuypcnt": 1,
"trailingstoploss": -1,
"trailingstoplosstrigger": 3,
"disablelog": 0,
"use_sell_fee": 1,
"buypercent": 99,
"termwidth": 180,
"termcolor": 1,
"verbose": 0,
"log": 1,
"debug": 1
},
"api_key_file": "binance.key"
},
"telegram": {
"token": "REMOVED",
"user_id": "REMOVED",
"client_id": "REMOVED",
"datafolder": "",
"logger_level": "DEBUG"
},
"scanner" : {
"atr72_pcnt" : 1.0,
"exitaftersell" : 1,
"enableleverage" : 0,
"use_default_scanner" : 1,
"maxbotcount" : 6,
"exchange_bot_count": 3,
"autoscandelay" : 0,
"enable_buy_next": 1,
"autostart": 0,
"terminal_start_process": ""
}
}

@thiazzz
Copy link

thiazzz commented Apr 21, 2023

I have the same. Did you already find a solution?

@MirekF
Copy link

MirekF commented Apr 21, 2023 via email

@leohrs
Copy link
Author

leohrs commented Apr 21, 2023

So far no solution, at least here. It seems that all config is fine, might be something with binance API handling maybe?

@leohrs
Copy link
Author

leohrs commented Apr 21, 2023

update: same config works fine in kucoin

@whittlem
Copy link
Owner

I need to go through verification with Binance again. I stopped using Binance after it said I need to go through verification again. I need to sort this out to be able to troubleshoot this.

@FenarkSEC
Copy link

I am having the same issue as well, using the Helm chart on a Kubernetes cluster.

@thiazzz
Copy link

thiazzz commented Apr 22, 2023

I could provide a temporary API key from a subaccount in Binance for testing? Would that make it easier to investigate and solve?

@achillebnt
Copy link

Maybe i found the problem: doing some debug i see in line 191 it try to set variable quote_min by index name MIN_NOTIONAL but dataframe doesn't have that index, instead it return this:

0 PRICE_FILTER
1 LOT_SIZE
2 ICEBERG_PARTS
3 MARKET_LOT_SIZE
4 TRAILING_DELTA
5 PERCENT_PRICE_BY_SIDE
6 NOTIONAL
7 MAX_NUM_ORDERS
8 MAX_NUM_ALGO_ORDERS

df[df["filterType"] == "MIN_NOTIONAL"][["minNotional"]].values[0][0]

@afgvdp
Copy link

afgvdp commented Apr 24, 2023

Same problem here. If it helps, the "opentrades" bot runs normally, but I am not able to start a bot manually or trough telegram.

I'll share the JSON from the "opentrades" bots, and the "scanner" bots.

This one WORKS:

{
"botcontrol": {
"status": "active",
"manualsell": false,
"manualbuy": false,
"started": "2023-04-23T16:36:32.134203",
"startmethod": "telegram",
"watchdog_ping": "2023-04-24T07:34:01.420447"
},
"preventlosstriggered": false,
"exchange": "binance",
"margin": "-11.2487%",
"delta": "-45.57",
"price": 2.948,
"df_high": " ",
"from_df_high": " ",
"trailingstoplosstriggered": false,
"change_pcnt_high": 0.0,
"indicators": {
"EMA": true,
"BULL": false,
"MACD": true
},
"signal": "WAIT"
}

This one, DOESN'T work:

{
"botcontrol": {
"status": "active",
"manualsell": false,
"manualbuy": false,
"started": "2023-04-23T23:23:48.310596",
"startmethod": "telegram"
},
"preventlosstriggered": false,
"exchange": "binance",
"margin": "",
"delta": "",
"price": 0.0,
"df_high": " ",
"from_df_high": " ",
"trailingstoplosstriggered": false,
"change_pcnt_high": 0.0
}

@whittlem
Copy link
Owner

Maybe i found the problem: doing some debug i see in line 191 it try to set variable quote_min by index name MIN_NOTIONAL but dataframe doesn't have that index, instead it return this:

0 PRICE_FILTER 1 LOT_SIZE 2 ICEBERG_PARTS 3 MARKET_LOT_SIZE 4 TRAILING_DELTA 5 PERCENT_PRICE_BY_SIDE 6 NOTIONAL 7 MAX_NUM_ORDERS 8 MAX_NUM_ALGO_ORDERS

df[df["filterType"] == "MIN_NOTIONAL"][["minNotional"]].values[0][0]

Thanks, I will take a look.

@whittlem
Copy link
Owner

Guys, can you confirm if this is a Telegram issue or a general issue? I used the config at the top and I don't get an error message when I run the bot on that market for live or test modes. If the issue happens just as the bot starts, I don't get it.

Config:

{
  "binance": {
    "api_url": "https://api.binance.com",
    "config": {
      "autorestart": 1,
      "base_currency": "SHIB",
      "disablebuynearhigh": 1,
      "enableinsufficientfundslogging": 1,
      "enabletelegrambotcontrol": 1,
      "granularity": "15m",
      "live": 0,
      "nobuynearhighpcnt": 1,
      "nosellmaxpcnt": 3,
      "nosellminpcnt": -13,
      "quote_currency": "BRL",
      "selllowerpcnt": -21,
      "telegram": 1,
      "trailingbuypcnt": 1,
      "trailingstoploss": -1,
      "trailingstoplosstrigger": 3,
      "disablelog": 0,
      "use_sell_fee": 1,
      "buypercent": 99,
      "termwidth": 180,
      "termcolor": 1,
      "verbose": 0,
      "log": 1,
      "debug": 0
    },
    "api_key_file": "binance.key"
  },
  "telegram": {
    "token": "<removed>",
    "client_id": "<removed>"
  }
}

Running bot like this:
% python3 pycryptobot.py

@whittlem
Copy link
Owner

Maybe i found the problem: doing some debug i see in line 191 it try to set variable quote_min by index name MIN_NOTIONAL but dataframe doesn't have that index, instead it return this:

0 PRICE_FILTER 1 LOT_SIZE 2 ICEBERG_PARTS 3 MARKET_LOT_SIZE 4 TRAILING_DELTA 5 PERCENT_PRICE_BY_SIDE 6 NOTIONAL 7 MAX_NUM_ORDERS 8 MAX_NUM_ALGO_ORDERS

df[df["filterType"] == "MIN_NOTIONAL"][["minNotional"]].values[0][0]

You are right about this... I was able to re-create this with a script.

import sys

sys.path.insert(0, ".")

from controllers.PyCryptoBot import PyCryptoBot  # noqa: E402
from models.TradingAccount import TradingAccount  # noqa: E402
from models.AppState import AppState  # noqa: E402
from models.exchange.binance import AuthAPI as BAuthAPI, PublicAPI as BPublicAPI  # noqa: E402

app = PyCryptoBot(exchange="binance")
account = TradingAccount(app)
state = AppState(app, account)
state.minimum_order_quote()

And returns this:

Traceback (most recent call last):
  File "<removed>/pycryptobot/examples/script-binance_v2.py", line 13, in <module>
    state.minimum_order_quote()
  File "<removed>/pycryptobot/./models/AppState.py", line 191, in minimum_order_quote
    df[df["filterType"] == "MIN_NOTIONAL"][["minNotional"]].values[0][0]
IndexError: index 0 is out of bounds for axis 0 with size 0

Although I'm not getting an error running the bot I can see the error above. I'll fix this and hopefully it fixed it for all of you. Thanks, this helped a lot.

@MirekF
Copy link

MirekF commented Apr 24, 2023 via email

@whittlem
Copy link
Owner

I believe it's fixed. Doing a release now.

@leohrs
Copy link
Author

leohrs commented Apr 24, 2023 via email

@whittlem
Copy link
Owner

8.0.7 is available now. Docker image is building now. The issue should be fixed.

@afgvdp
Copy link

afgvdp commented Apr 24, 2023

/addnew from telegram - WORKS
/scanner and open bot - WORKS

Thank you!

@afgvdp
Copy link

afgvdp commented Apr 24, 2023

Found a issue with the new release 8.0.7

The Index 0 is fixed, but now the Telegram Bot don't recognize the active bots. I think that maybe could be the same problem as this one:

#727 (comment)

@afgvdp
Copy link

afgvdp commented Apr 25, 2023

In 8.0.7 BOTs are not buying due to "Insufficient Funds":

Bot1 2023-04-25 02:15:00 POLYXUSDT 15m *** Skipping LIVE Buy Order -- Insufficient Funds ***

Manual Buy doesn't work either.

@demkoma20
Copy link

I am still getting indexError when I stopped previous session and set LIMIT sell order.
On lower price levels I tried to start but got IndexError. When I unlock funds from LIMIT order bot works but start where ends. And that's what I don't want.

@whittlem
Copy link
Owner

In 8.0.7 BOTs are not buying due to "Insufficient Funds":

Bot1 2023-04-25 02:15:00 POLYXUSDT 15m *** Skipping LIVE Buy Order -- Insufficient Funds ***

Manual Buy doesn't work either.

This may sound like a thick question, but I have to ask. You definitely have sufficient funds? E.g., at least 10 of the quote currently (as a guide)

@whittlem
Copy link
Owner

This week is super busy for me but I'll take a look next week. If anyone can help narrow down the problem, that would help. For example, is it Binance only? Is it Docker or CLI or both? Is it happening with the Telegram bot only or both?, If you can provide more info to help me recreate what you are seeing that would help. If you can provide your config.json and the way you are running your bots that would help as well.

@afgvdp
Copy link

afgvdp commented Apr 27, 2023

In 8.0.7 BOTs are not buying due to "Insufficient Funds":
Bot1 2023-04-25 02:15:00 POLYXUSDT 15m *** Skipping LIVE Buy Order -- Insufficient Funds ***
Manual Buy doesn't work either.

This may sound like a thick question, but I have to ask. You definitely have sufficient funds? E.g., at least 10 of the quote currently (as a guide)

Hi Michael, it was solved in the Chat. Another guy told me to ser "buymaxsize". I did it and problem solved!

@demkoma20
Copy link

This week is super busy for me but I'll take a look next week. If anyone can help narrow down the problem, that would help. For example, is it Binance only? Is it Docker or CLI or both? Is it happening with the Telegram bot only or both?, If you can provide more info to help me recreate what you are seeing that would help. If you can provide your config.json and the way you are running your bots that would help as well.

I tried only on Binance. Without Telegram or Docker/Kubernetes, running in shell through python3 ./pycryptobot.py --logfile cryptobot-BTCUSDT.log --market BTCUSDT --granularity 3600
Issue is occured when:

  1. 1st bot run - success
  2. Stop bot
  3. Previously bought funds by bot are locked in LIMIT order
  4. 2nd bot run - fail
  5. Unlock funds
  6. Bot run - success and started where ends

@whittlem
Copy link
Owner

whittlem commented May 1, 2023

I'm getting same "*** Skipping LIVE Buy Order -- Insufficient Funds ***" message. There is definitely a bug. I'm troubleshooting it and just waiting for the next buy signal to see what happens.

@whittlem
Copy link
Owner

whittlem commented May 3, 2023

Fixed for me in 8.0.9. Give it a try and let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants