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

Order Size Invalid #40

Open ebweinstein opened 3 years ago

ebweinstein commented 3 years ago

I get this message: "Exception: 200-{"code":"300000","msg":"Order size invalid."}"

However, I am trading $50 in USDT to buy ETH. There is no minimum order on KuCoin for $50.

What is the problem?

abayomi185 commented 3 years ago

Hey, I don't understand why that is the case with Kucoin too. Please try a higher value or a different pairing.

It's difficult to integrate the min quantity size because the pairing and the coin needs to be determined before checking.

ebweinstein commented 3 years ago

Thanks for your response. To further explore, I went through the front-end web site of KuCoin and bought 1 USDT of ETH with a market order just fine. The minimum ETH buy at KuCoin is .0001. So the minimum is 27c USD. I tried the Simple Pump and Dump program with $50 and it said order size too small. I know it connects to my account fine because it displays my balance. Any other possible suggestions?

ebweinstein commented 3 years ago

Here is the error message:

? Please select trade configuration? market-trade-one

Your USDT balance is 48.87420854

Please ensure Config is correct before proceeding

? Please enter coin for Pump? eth Traceback (most recent call last): File "bot-kucoin.py", line 290, in asyncio.run(main()) File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run return loop.run_until_complete(main) File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "bot-kucoin.py", line 230, in main buy_order = market_order(selected_coin_pair, 'buy') File "bot-kucoin.py", line 144, in market_order order_id = trade.create_market_order(selected_coin_pair, 'buy', clientOid=str(uuid.uuid4()), size=str(buy_qty)) File "/usr/local/lib/python3.8/dist-packages/kucoin/trade/trade.py", line 164, in create_market_order return self._request('POST', '/api/v1/orders', params=params) File "/usr/local/lib/python3.8/dist-packages/kucoin/base_request/base_request.py", line 93, in _request return self.check_response_data(response_data) File "/usr/local/lib/python3.8/dist-packages/kucoin/base_request/base_request.py", line 110, in check_response_data raise Exception("{}-{}".format(response_data.status_code, response_data.text)) Exception: 200-{"code":"300000","msg":"Order size invalid."}

Here is my CONFIG:

################# KUCOIN CONFIG ####################

trade_configs: market-trade-one:

Coin pairing for trade

pairing: USDT
#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: .1
#Profit margin multiplier; 0.5 equals 50% gain
profit_margin: 0.001
#Amount from wallet to use for trade sell; range 0 to 1
sell_qty_from_wallet: 1
#Refresh interval in milliseconds to check market for current price
refresh_interval: 100
#Timeout in milliseconds if profit margin doesn't reach intended value; 25 seconds
sell_fallback_timeout_ms: 25000
ebweinstein commented 3 years ago

OK it is the math.floor function in the market_order function, rounding my amount to the nearest integer down to 0. I changed math.floor to round() to 4 decimals and this worked.

However, I ran it, and it successfully placed the order, but does not seem to have sold after several minutes, when I expected it to sell after 25 seconds or less. Any ideas?

ebweinstein commented 3 years ago

I was able to programmatically get both the a) max number of decimals and round down from there and b) get the minimum for the particular pair. It's very easy to implement and highly recommend this is added. It's only a few lines of code

symbol_list = client.get_symbol_list() symbol_list = [e for e in symbol_list if str(e["symbol"]) == str(selected_coin_pair)] symbol_list[0]['baseIncrement'] symbol_list[0]['baseMinSize']

Then you can

1) have a condition for base MinSize

2) And just round down the buy_qty and sell_qty using this function, where decimals is the length of baseIncrement - 3:

def round_down(value, decimals): factor = 1 / (10 * decimals) return (value // factor) factor

abayomi185 commented 3 years ago

Hi, this is great! I'll implement it in the Node version of the bot