Open cipig opened 3 years ago
Thanks for creating the issue! Yes, it's possible, I think we will do this in the near future.
this one looks fixed to me created sell order for 4 GRS (balance was 12), it didn't match and was converted to a maker order then i found a better offer and sold all 12 GRS to that one... after order matched and GRS were sent out, the first order (sell 4 GRS) was cancelled am i missing something? if not, we can close this
If I understand the source issue correctly, we haven't improved the app to reduce max_vol/cancel orders as soon as the order has matched. I think the following problem is not gone away:
If a taker matches the first order with volume 5 and tries to match the second one too shortly after, the second swap will fail with
If I understand the source issue correctly, we haven't improved the app to reduce max_vol/cancel orders as soon as the order has matched. I think the following problem is not gone away:
If a taker matches the first order with volume 5 and tries to match the second one too shortly after, the second swap will fail with
see https://github.com/KomodoPlatform/komodo-defi-framework/issues/732#issuecomment-2248032734 i guess the problem there comes from multiple swaps with same coin (eg LTC) running in parallel... if the volume of other orders (also on other pairs, but with same coin like LTC) is not reduced (only necessary if remaining LTC balance is not enough to cover the second swap too) when first LTC order is matched, then it can lead to this kind of failed swaps
EDIT: i fear it can still happen, even if we would reduce volume of all open orders after a match... eg when i/my bot calls setprice
again (after volume was reduced) and uses the actual balance to determine the volume of the order... if that balance includes LTC that was already "reserved" for a running swap (even if not yet sent, nor confirmed), then the volume of the order will be too high and can lead to such failed swaps... so we can only avoid them completely if my_balance
(or a new call, only for this purpose) shows only balance that is available for orders/swaps (so balance minus everything that is already reserved for a swap)
A maker can post multiple orders with an aggregated volume that is higher than his balance, eg if his balance of KOIN is 10, he can post one sell order with volume 5, and a second one with volume 9. If a taker matches the first order with volume 5 and tries to match the second one too shortly after, the second swap will fail with
maker_swap:321] !check_balance_for_maker_swap check_balance:76] Not enough KOIN for swap
Here is an example:
https://dexapi.cipig.net/public/error.php?uuid=11cbe174-0298-4ea4-ab88-03181501c0e7
Would it be possible to reduce the max_volume of all open orders after a match if the remaining balance would not be sufficient? Simply cancelling those orders would also be OK. This is not a big issue though, since
NegotiateFailed
does not lead to a ban any more and i also changed my bot to avoid such situations, but would be nice to have.