abayomi185 / simple-pump-and-dump-bot

Simple pump-and-dump bot for Binance and Kucoin Cryptocurrency Exchange
Apache License 2.0
78 stars 21 forks source link

IndexError: list index out of range #1

Closed ryzen3100 closed 3 years ago

ryzen3100 commented 3 years ago

Hi, When I run the program I get this error after the first order (I am connected to testnet):

? Please enter coin for Pump?  BNB

{
    "clientOrderId": "20YfDAlXrzif6vo6GXbZx1",
    "cummulativeQuoteQty": "0.00000000",
    "executedQty": "0.00000000",
    "fills": [],
    "orderId": 1137,
    "orderListId": -1,
    "origQty": "4.00000000",
    "price": "0.00000000",
    "side": "BUY",
    "status": "EXPIRED",
    "symbol": "BNBBTC",
    "timeInForce": "GTC",
    "transactTime": 1620078883161,
    "type": "MARKET"
}

{
    "clientOrderId": "HZIIMv2DVYCjk1hi4EP2tE",
    "cummulativeQuoteQty": "0.00000000",
    "executedQty": "0.00000000",
    "fills": [],
    "orderId": 1138,
    "orderListId": -1,
    "origQty": "99.00000000",
    "price": "0.00000000",
    "side": "SELL",
    "status": "EXPIRED",
    "symbol": "BNBBTC",
    "timeInForce": "GTC",
    "transactTime": 1620078894680,
    "type": "MARKET"
}

Traceback (most recent call last):
  File ".\bot-binance.py", line 230, in <module>
    insert_into_db(order=buy_order)
  File ".\bot-binance.py", line 180, in insert_into_db
    ("Binance", order['clientOrderId'], order['orderId'], order['fills'][0]['tradeId'],
IndexError: list index out of range
abayomi185 commented 3 years ago

Hey

I'm happy you're trying this project out.

I've had a look at the error. It occurs when adding the order details to your records database. It seems the testnet does not have an entry in the fills array and that is causing the error.

You can comment out line 230 and 231 while you test or otherwise; your trading records are available on Binance.

insert_into_db(order=buy_order)
insert_into_db(order=sell_order)

The database section was designed to be done after the critical operations for situations like this that could occur.

If you have any suggestions for improvements, I'm happy to hear them and improve the bot.

ryzen3100 commented 3 years ago

It worked thank you! However after a few trades, now I am getting this error (LTC/BTC pair):

Your BTC balance is 0.02559400
binance.exceptions.BinanceAPIException: APIError(code=-1013): Invalid quantity.

This is my config file:

 #Coin pairing for trade
    pairing: BTC
    #Currently, only market is available, keep unchanged
    order_type: market
    #Amount from wallet to use for trade buy; range 0 to 1
    buy_qty_from_wallet: 0.005
    #Profit margin multiplier; 2 equals 100% gain
    profit_margin: 1.1
    #Amount from wallet to use for trade sell; range 0 to 1
    sell_qty_from_wallet: 0.01
    #Refresh interval in milliseconds to check market for current price
    refresh_interval: 20
    #Timeout in milliseconds if profit margin doesn't reach intended value
    sell_fallback_timeout_ms: 10000
abayomi185 commented 3 years ago

Hey, this error has to do with how Binance manages trade orders. This link should explain it.

https://use.autoview.with.pink/hc/en-us/articles/360003301752-Error-1013-Filter-Failure-MIN-NOTIONAL-or-Invalid-Quantity

There are minimum quantities for buy and sell orders using their API and on the website.

Your percent values for buy_qty_from_wallet and sell_qty_from_wallet are too small relative to the balance you've shown.

abayomi185 commented 3 years ago

@ryzen3100 please update your version of the bot if you haven't already. A major flaw with exiting trades before the config time has been fixed.

ryzen3100 commented 3 years ago

@ryzen3100 please update your version of the bot if you haven't already. A major flaw with exiting trades before the config time has been fixed.

Thank you! I will give it a try. 👍

ryzen3100 commented 3 years ago

Is the

#Amount from wallet to use for trade buy; range 0 to 1
    buy_qty_from_wallet: 0.75

a multiplier (holdings * 0.75) or the actual amount for crypto to use ( 0.75 BTC)?

abayomi185 commented 3 years ago

It's a multiplier; (holdings * 0.75)

abayomi185 commented 3 years ago

Avoid using 1.0