Tradable balance check is not working
Closed this issue · 9 comments
The tradable balance check is not working properly as the bot still tries to place orders even when there is not enough balance.
Ok, that's indeed the most recent version.
Did you try the following formula:
10(8 + priceAssetDecimals - amountAssetDecimals)
I tried with tranche_size * price / 10 ** 6 and it works for checking the buying balance. For checking the selling balance it is enough the balance_amount >= tranche_size works, because there is no need to multiply by the price.
Great, but does the above formula work for you?
Still sometimes it doesn't work for checking the selling side balance and I am not able to find the reason. I tried different things, but nothing worked. For checking the buying side balance it never fails.
Could the reason be that the matcher takes some time before updating the tradable balance? Do we have a way to stop the script until we get confirmation from the matcher?
I doubt that this is the point. Tradable balance is the balance on the account.
I logged tradable balance after each step and it was diminishing after every sell order posted to the matcher.
That's not a blackbot problem.
Now after extensive testing I found that I need to use tranche_size*(price/10**(4 + PAIR.asset2.decimals - PAIR.asset1.decimals) for this check to work.