Grid bot eat all quote

Hi gainium,

I’m having an issue with this bot :

https://app.gainium.io/grid/664f911f98f03868c8ce3449

So I discovered that it consumes the free fdusd used as quote. Bot is on btc fdusd market of binance. Set as long and collecting gains in base = btc.

This is not expected as the bot have its own dedicated liquidity set at startup. So it should not (over) consume the free quote over time. I tried to stop, add free quote and start but it’s obvious that after some days, no more quote is available and bot raise errors coz not enough liquidity. Liquidity is not disappearing of course, it just move from quote to base over time and this is a problem.

I think I may know why but I would like confirmation. I think that due to decimals and gains collected in base, it needs to not sell (bot long) all its base but a part and due to decimals story, it just can’t match the exact amount, leading to either sell too much or not enough base back to quote.

In my case, bot probably consume more quote than expected coz it doesn’t sell enough of the base, meaning it collects too much gain in base leading to not enough quote that are then consumed from free fdusd.

Is that correct? If yes, could you implement a way to resynchronize it after a while? Coz for now, calculations are not fully correct, will preserve more base than expected and I need it to better match expectations coz I have a way to “lock” those gains in base to be used in a higher grid. I mean, I just don’t really want to collect gain in quote because of it : when you are long, collecting gains in base looks more logical.

Also, is it expected to be not a problem when collecting gains in quote? I think yes coz it will just sell the full position of the levels and not a part when collecting gains in quote : no issue to match the real amount of gains.

Thanks,
PiX

The problem is that the grid step is too small. The exchange rounds all orders, which means you cannot retrieve the exact amount of the quote when you sell. In this case, you can see that in some transactions, it’s missing 70 cents.

There is nothing we can do about this. I recommend that you increase the grid spacing and leave enough quote to compensate for the missing quote on each transaction. Alternatively, you can profit in quote.

You cannot profit in BTC with such a small budget per line and grid step; it will inevitably eat your quote.

It’s all about the minimum order size, lot step size and other parameters that affect how much exactly of a currency we can buy and sell. I’ve created a tool to help with that. I was even thinking about whether and how take profit and stop loss percentages could be taken into account to make sure that a deal can be closed at almost the exact price we want, but it’s still work in progress.

1 Like

Hi and thanks for your responses.

So for btc fdusd, there are 5 decimals in btc amount, price is not a problem, min order is not a problem.

I acknowledge that the a too low budget is a problem when running a long bot that collect gain in btc. Probably the same for a short bot collecting in fdusd. All that is definitely due to the partial sell of the position (kind of crossing if long with gain into btc).

My solution is to no more collect in btc yeah. So far so good.

But, because of that, I’m going to create a feature request. Coz here is my situation : 3 bots, one on binance where I detected the issue exposed here (fixed by collecting gain in fdusd). 2 other bots still collecting in base but no problem found. No problem found coz more liquidity : I now have an issue in detecting potential drift.

So how can I detect a drift (bot eating quote)? I need to monitor the free usdc (bybit). But no chart available for free usdc, just the total. So I will write down the amount of currently free usdc and recheck periodically to ensure no not eat it where it should not (coz I really want to get gain in base).

That’s why I would like you to add an option, for dashboard, to add not the total fdusd but the free fdusd (so we could chose either total or free or any other value from portfolio page). This would be great.

Thx,
PiX

I have another question.

I created this bot : Gainium app

The same but collecting gain in fdusd (no more in btc).
I’m seeing that it buy an amount of btc and sell it higher, but not the same btc amount. Why and where are those not sold btc dust?

Because of that, bot still eat fdusd and I don’t see the reason why it’s not selling the exact same amount of the buy now.

Also, this is since binance, bybit never had that issue, I don’t get it. I agree that those bots are not having huge budget, but it doesn’t tell me why btc amount is different in buy and sell when being long (start with fdusd) and collecting in fdusd.

Edit :

I just checked an old bot on bybit and I understand your round problem : 5 decimals in binance vs 6 in bybit is causing a problem :

But again, why is it trying not to sell the full amount bought previously? What’s the logical behind?

I’m guessing you don’t have the fee order activated. The fee is paid in btc, so you cannot sell as much as you buy. If you activate the fee order the bot will keep btc to be used as fees independent of the grid, and in that case it will sell as much as it bought.

You mean this?

To pay fees? I’m using market with 0 fees (and no displacement). And I don’t understand the option in the screenshot as it says to add an order to pay fees. But what when there is 0 fees to pay? I guess I should still not enable that. But then, it’s not selling the full buy amount. Did I missed something or should I just try the above option (maybe not explained correctly?)?

Edit :

I just (re) read this : Fee Orde (Reduce Dust)

It’s not useful in my case, coz I’m with 0 fees only so far (on both binance and bybit). This option should not be enabled in my case (or is it going to disable dust and not really create the order to pay fees when in market without fees (correctly discovered when entering the bot, displaying 0 fees in blue popup)?

So I definitely think it’s either a missing feature to implement or better explanation of the fee order. What your thoughts?

Edit :

I restarted my bot with that fee option. So far, didn’t saw any order executed for fees. So I guess it’s just a missing explanation of that option.

Restarted after 7am

If you are using a pair with 0 fees the difference must be due to rounding. At the time of the buy a rounding is applied by the exchange, and another one at the time of the sell. But it’s usually negligible amounts.

From bybit to binance, I have that issue of rounding. But I guess it’s due to fees only, coz no reason to sell less and also on bybit where rounding is not causing problems (6 decimals VS 5). I’m waiting for transaction to be completed to recheck with order fee (that, after restart, never created that order fee :sweat_smile::face_with_monocle:.

Looks better :blush:

Last thing : maybe allowing more decimal in the usd value would be better (just 1? Probably require more).

Else, looks good for me (if no order specific for the fees with the order fee option turned on).

Thanks,
PiX

The number of decimals and rounding is dictated by the exchange, I’m afraid we can’t do much more.

Yeah I understand (for btc, 5 decimals), but I was speaking about the fdusd values of trades displayed in the transaction list of gainium. I can’t believe that it’s just 1 decimal, it’s more of course else the bot will gain nothing, should be visible in orders but I don’t see my orders anymore with binance sub account, will try to show you later. Else balance show plenty decimals :

Edit :

OK, this is an open order (bug for history orders), there are tons of decimals for fdusd. So why so few in gainium?

Edit :

Look here, probably more decimal than just 1 (for those 11.5 fdusd) :

Edit :

Ok look that, rounded at 11.5 by gainium, not binance :


Yes we round numbers in the front end so they can fit in view. But is just for display purposes we have the full number.

Wow OK, I missed that…

So yeah it’s fine like that.
Thanks Ares :smiling_face: