Closed delphsmith closed 3 years ago
I get the same issue - trying to work it out now. In the log file could you send the corresponding order code that looks like the following. We need to work out if it is on the API side, or some rounding / fee error at the python end. I can see in this line:
last_buy = price buy_count = buy_count + 1 fee = float(price) * 0.005 price_incl_fees = float(price) + fee buy_sum = buy_sum + price_incl_fees
Is this fee price hard coded - it could be an assumption that knocks this over. Although I can see from your order above that there should have been plenty in there. In any case, I will try and work this out as I have missed a few good chances.
PS The code is super cool. I am actually running 15 different coins at the same time and it seems pretty stable, apart from dropping the ball with these orders.
{'symbol': 'DOGEAUD', 'orderId': 8105981, 'orderListId': -1, 'clientOrderId': 'Rbgx3mG67I4JaMYERDndZ0', 'transactTime': 1618795726846, 'price': '0.00000000', 'origQty': '279.90000000', 'executedQty': '279.90000000', 'cummulativeQuoteQty': '123.39391500', 'status': 'FILLED', 'timeInForce': 'GTC', 'type': 'MARKET', 'side': 'BUY', 'fills': [{'price': '0.44085000', 'qty': '279.90000000', 'commission': '0.27990000', 'commissionAsset': 'DOGE', 'tradeId': 351872}]}
Hi, I don't seem to have log lines that looks like what you asked..
This does look like a strange issue and I'm not sure what to suggest. It looks looks like you sufficient funds so it doesn't really make sense why it is saying insufficient balance. Is this a constant issue or intermittent?
Hi Michael First time i try with USDT pair... and from what i see around, there are some issues with it, like mine...
I'll switch to BUSD instead
absolutely not related to my problem, but isn't there an error in Tranding.py line 539 :
self.df['eri_sell'] = ((self.df['elder_ray_bull'] > 0) & (self.df['elder_ray_bull'] < self.df['elder_ray_bull'].shift(1))) | ((self.df['elder_ray_bull'] < self.df['elder_ray_bull'].shift(1)))
shouldnt it be : ((self.df['elder_ray_BEAR'] < self.df['elder_ray_BEAR'].shift(1)))
This is the error I get
2021-04-26 16:00:00 | DOGEAUD 5m | Close: 0.35 | BUY DOGE balance before order: 0.0 AUD balance before order: 179.6703 Order quantity after rounding and fees: 511.2 27-04-2021 02:02:25 Binance marketBuy APIError(code=-2010): Account has insufficient balance for requested action. DOGE balance after order: 0.0 AUD balance after order: 179.6703
From the logs I have: 04/27/2021 02:02:23 AM - INFO: 2021-04-26 16:00:00 | DOGEAUD 5m | Close: 0.35 | BUY 04/27/2021 02:02:24 AM - DEBUG: 2021-04-26 16:00:00 | BTTBUSD (BULL) | 5m | Close: 0.0069217 | ^ EMA12/26: 0.00690296 > 0.00690221 ^ | ^ MACD: 0.0000 > -0.0000 ^ | v OBV: -2580268.0000 (-62.46%) v | ERI: buy | WAIT | Last Action: SELL 04/27/2021 02:02:25 AM - INFO: []
On a successful buy I get the following: 04/19/2021 11:28:45 AM - INFO: 2021-04-19 01:25:00 | DOGEAUD 5m | Close: 0.44 | BUY 04/19/2021 11:28:46 AM - INFO: {'symbol': 'DOGEAUD', 'orderId': 8105981, 'orderListId': -1, 'clientOrderId': 'Rbgx3mG67I4JaMYERDndZ0', 'transactTime': 1618795726846, 'price': '0.00000000', 'origQty': '279.90000000', 'executedQty': '279.90000000', 'cummulativeQuoteQty': '123.39391500', 'status': 'FILLED', 'timeInForce': 'GTC', 'type': 'MARKET', 'side': 'BUY', 'fills': [{'price': '0.44085000', 'qty': '279.90000000', 'commission': '0.27990000', 'commissionAsset': 'DOGE', 'tradeId': 351872}]} 04/19/2021 11:33:48 AM - DEBUG: *** Candlestick Detected: Three White Soldiers ("Strong - Reversal - Bullish Pattern - Up")
I am investigating. This happens loads for me so I am missing heaps of BUY signals.
@delphsmith, yes... looks like a typo there. I'll fix it.
@mebell, are you running more than one bot using the in the same sub-account? Maybe you are getting bots fighting to access the same funds. Could you have any limit orders set? That puts funds on hold and although you see a positive balance the funds are not accessible.
@whittlem yes - I am running quite a few bots on the same branch / account. It works quite well, obviously if you have spent all the funds it craps out but I modified it today to always buy with 75% of the balance (base_quantity = base_quantity * 0.75 in Binance.py). So the first time it jumps in it spends the most, and then 75 of what is left and so on. That way it will still jump on a decent coin. I then split the balances between, at the moment AUD or BUSD, so it can dip into different coins. The code is below. On average over ~15 coins it only jumps into two, three at most markets at the same time. I imagine this is not the intended use, but it would be good to have a higher level script to manage many bots. I believe using the same code base is not an issue. I haven't had any crashes today with the modifications above and turned a profit of $40.
import shlex import subprocess
coins = ['COMPBUSD', 'ETCBUSD', 'BNBAUD', 'CAKEBUSD', 'DOGEAUD', 'EGLDBUSD', 'ETHAUD', 'MKRBUSD', 'LINKAUD', 'XRPAUD', 'MATICBUSD', 'LTCBUSD', 'YFIBUSD', 'LUNABUSD', 'SNXBUSD','DOTBUSD', 'SOLBUSD', 'PSGBUSD', 'JUVBUSD', 'PAXGBUSD', 'BTTBUSD', 'FIOBUSD']
for c in coins: cmd = 'python3 pycryptobot.py --market '+c+' --granularity 5m --live 1 --sellupperpcnt 15' cmds = shlex.split(cmd) p = subprocess.Popen(cmds, start_new_session=True)
Thanks for the update. Quite a few people have asked for the amount it trades to be configurable. In the next update I'll add config option that allows you to specify the percentage of funds to trade.
@whittlem you did not correct the right one in your last update :)
You mean this?
def addElderRayIndex(self):
"""Add Elder Ray Index"""
if 'ema13' not in self.df:
self.addEMA(13)
self.df['elder_ray_bull'] = self.df['high'] - self.df['ema13']
self.df['elder_ray_bear'] = self.df['low'] - self.df['ema13']
# bear power’s value is negative but increasing (i.e. becoming less bearish)
# bull power’s value is increasing (i.e. becoming more bullish)
self.df['eri_buy'] = ((self.df['elder_ray_bear'] < 0) & (self.df['elder_ray_bear'] > self.df['elder_ray_bear'].shift(1))) | ((self.df['elder_ray_bull'] > self.df['elder_ray_bull'].shift(1)))
# bull power’s value is positive but decreasing (i.e. becoming less bullish)
# bear power’s value is decreasing (i.e., becoming more bearish)
self.df['eri_sell'] = ((self.df['elder_ray_bull'] > 0) & (self.df['elder_ray_bear'] < self.df['elder_ray_bear'].shift(1))) | ((self.df['elder_ray_bull'] < self.df['elder_ray_bull'].shift(1)))
What do you think it should be?
The bottom line should be :
self.df['eri_sell'] = ((self.df['elder_ray_bull'] > 0) & (self.df['elder_ray_bull'] < self.df['elder_ray_bull'].shift(1))) | ((self.df['elder_ray_bear'] < self.df['elder_ray_bear'].shift(1)))
no ?
It's the same thing isn't it? Just the or conditions are in a different order. I swapped it around for peace of mind. Should be okay now. Thanks.
Thanks for the update. Quite a few people have asked for the amount it trades to be configurable. In the next update I'll add config option that allows you to specify the percentage of funds to trade.
Hi Michael,
What is the config setting to control the amount the bot trades?
DOGE balance before order: 0.0 BUSD balance before order: 31.23 Order quantity after rounding and fees: 110.1
i pulled... this is the previous version's error... i wanted to ducument it.. surely i dont have 110 busd.. i have only 31... so some rounding issue was... hopefully fixed :)
@mebell hey Martin, can you share the exact section/line number of Binance.py that you added your tweak for the 75%?
I want to do the same, so i can work with my small budget for now.
Thanks, Patrick
@whittlem yes - I am running quite a few bots on the same branch / account. It works quite well, obviously if you have spent all the funds it craps out but I modified it today to always buy with 75% of the balance (base_quantity = base_quantity * 0.75 in Binance.py). So the first time it jumps in it spends the most, and then 75 of what is left and so on. That way it will still jump on a decent coin. I then split the balances between, at the moment AUD or BUSD, so it can dip into different coins. The code is below. On average over ~15 coins it only jumps into two, three at most markets at the same time. I imagine this is not the intended use, but it would be good to have a higher level script to manage many bots. I believe using the same code base is not an issue. I haven't had any crashes today with the modifications above and turned a profit of $40.
Try here in Binance.py:
base_quantity = base_quantity * 0.75
Dr Martin Bell | Lecturer School of Mathematical and Physical Sciences Room: 07.05.025; Phone 02 9514 2243 UNIVERSITY OF TECHNOLOGY, SYDNEY
On 29 Apr 2021, at 8:48 am, github-ptaylor @.***> wrote:
@mebell https://github.com/mebell hey Martin, can you share the exact section/line number of Binance.py that you added your tweak for the 75%?
I want to do the same, so i can work with my small budget for now.
Thanks, Patrick
@whittlem https://github.com/whittlem yes - I am running quite a few bots on the same branch / account. It works quite well, obviously if you have spent all the funds it craps out but I modified it today to always buy with 75% of the balance (base_quantity = base_quantity * 0.75 in Binance.py). So the first time it jumps in it spends the most, and then 75 of what is left and so on. That way it will still jump on a decent coin. I then split the balances between, at the moment AUD or BUSD, so it can dip into different coins. The code is below. On average over ~15 coins it only jumps into two, three at most markets at the same time. I imagine this is not the intended use, but it would be good to have a higher level script to manage many bots. I believe using the same code base is not an issue. I haven't had any crashes today with the modifications above and turned a profit of $40.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/whittlem/pycryptobot/issues/74#issuecomment-828830597, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZZ6QZQDSXV2GKLSKBZLJDTLCGDJANCNFSM43RCUB5A.
Hello
i got an error message when attempting to buy Algo on binance this morning :
2021-04-25 08:00:00 | ALGOUSDT 1h | Close: 1.15 | BUY
ALGO balance before order: 0.0 USDT balance before order: 199.98 Order quantity after rounding and fees: 172.84 25-04-2021 10:47:14 Binance marketBuy APIError(code=-2010): Account has insufficient balance for requested action. ALGO balance after order: 0.0 USDT balance after order: 199.98
as you can see, i had ~200 usdt in my acount thanks