I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

Reply To: Negative available balance after trade

dashed-slug.net Forums Exchange extension support Negative available balance after trade Reply To: Negative available balance after trade



Thank you for your feedback.

This is not enough information for me to understand the issue you are facing, but here’s a few facts about the matching engine (maybe relevant):

– All fees are charged on the base currency, same as on all exchanges. The maker fee is the fee paid by the participant who placed the first limit order on the order book. The user who placed the second matching limit order, or a market order, pays the taker fee. This is again subtracted from the base currency balance.

– In both cases, the balance, and thus the available balance, of both users, decreases by the fees paid. This is to be expected.

– The exchange will only allow users to place an order that leaves them with positive balance, assuming that the largest of the two fees is paid (maker or taker).

– As the matching engine is running, if the base balance or quote balance of the user who places the order goes negative, the trade is cancelled and any trade is reverted.

The thread is titled “negative available balance”. To be clear, are you saying that, after users trade on the exchange, and without other manipulation of the DB, the users get negative available balances? If so, was there a problem with the balance of the market maker, or with the balance of the market taker?

Could you give me a complete example that I can follow, to reproduce the problem? If possible, please send me the following information:

1. Initial example base and quote balances of two hypothetical users.

2. What orders were placed? Let’s agree on some example amounts, prices, and also whether these were both limit orders, or a limit and a market order.

3. Go to Wallets -> Transactions. After a successful match, there should be four trade transactions related to the trade. Can I see these four rows?

4. What are the base and quote balances of the two users after the trade?

5. Does this occur on the unmodified latest version of the exchange?

Please test with the unmodified exchange, and that includes the templates and all other code in the exchange, parent plugin, and coin adapters. Better to do this on an integration server, not a production server.

I ask for all these details, because the last time we discussed a similar issue, I could not find a problem with the matching engine. I was also unable to spot any errors in the code.

If there is such a serious error, I need some more information to find it. I also ran some additional tests before writing this reply, and could not reproduce such an issue, so I don’t know where to look. Looking forward to your reply with additional details.

Thank you.

with regards