bmino/binance-triangle-arbitrage

Balance Error.

Closed this issue · 5 comments

Hi,

First off, awesome work, thanks! I've noticed an issue though and I don't think it's my config file? I've set up a test, operating with a "PROFIT" goal of -0.3, just to get some transactions going through the bot. However, I've found that when it tries to make the B->C purchase, there are insufficient funds. I'm testing with small amounts but here is my output from the execution.log:

[8/25/2021, 2:21:15 PM] INFO: --------------------------------------------------
[8/25/2021, 2:21:24 PM] INFO: Initialized
[8/25/2021, 2:21:24 PM] INFO: Attempting to execute ETH-TRX-USDT with an age of 20 ms and expected profit of -0.2772%
[8/25/2021, 2:21:24 PM] INFO: Buying 359 TRXETH @ market price
[8/25/2021, 2:21:24 PM] INFO: Successfully bought 359.00000000 TRXETH @ a quote of 0.00967505 in 27 ms
[8/25/2021, 2:21:24 PM] INFO: Selling 359 TRXUSDT @ market price
[8/25/2021, 2:21:24 PM] ERROR: Account has insufficient balance for requested action.

Here the bot is trying to sell the 359 TRX for USDT but the actual result from the ETH-TRX trade resulted in 358.641 TRX, not 359. My "FEE" setting is: "FEE": 0.075. Would this be a floating point issue?

Thanks in advance.

I should also say I'm using BNB so 0.075 for the fee should be correct. I would assume that there's something going on in the return of the response near line 52 in BinanceApi.js, if there is an issue and not my config etc.

Thanks.

bmino commented

Are you sure you are using BNB to pay for fees? That delta is exactly 0.1% which would make sense if the fee was instead taken from the swap quantity.

As a note too, the FEE config is only used to make execution decisions (if the position is above your profit threshold) so wouldn't affect the swapped amount

Hey @bmino, thanks for the response! Oh my god, you are of course absolutely correct, sorry for being so silly. I'll re-asses that setting in my account and try again. My assumption was that, by holding BNB Binance would default to using that to pay for fees.

One other thing though that I'm confused about though, I've read through the configuration readme and I'm confused on INVESTMENT.[BASE].MAX. I assumed that I could set that to be like, a million BTC (for example) and it would always be able to operate as I'm testing with like, 0.001 BTC. That's obviously not the case because when I set it to greater than my volume, the bot errors. Can you explain how that works? And if it makes a successful trade, or multiple, will this be updated?

Again, thanks, you legend!

bmino commented

Checkout the config readme here. Basically that value is the maximum amount that the bot will check for an optimal position

Gotcha, thanks again!