March 23, 2021 at 4:32 pm #10273
Hi, we set a trading fee (maker / taker default) why goes this amount from the aviable balance, after a filled trade? it is hard to explain for the user.March 24, 2021 at 7:30 am #10275alexgKeymaster
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.
with regardsMarch 26, 2021 at 12:27 pm #10287
curoius .. i wanted to make some screenshoots to explain what i mean but actuall it seeems to be goodApril 8, 2021 at 9:40 am #10346
So now i can show you.
User did a trade and sell or buy some coins. Now he have an negavite aviable amount. Iam not sure how to rebuild this. Other User trades a lot and goes not negative
Attachments:You must be logged in to view attached files.April 9, 2021 at 6:44 am #10351alexgKeymaster
Thank you for the screenshot. I believe you, but unless I know what the user did I cannot reproduce the issue. This is why I insist on more data (see my posts above).
If I cannot reproduce the issue, I cannot solve it. I have attempted to reproduce the issue multiple times.
If you can send me all the user’s data in the
wp_wallets_txs, wp_wallets_orders and wp_wallets_trades tables, then I will be able to reproduce it and possibly understand what happened.
Another possibility is that you could manually deposit 60 satoshi to the user, and see if this happens again. Since you say that other users do not face the same problem, it could be a one-time thing, possibly dependent on to the data in the database.
- You must be logged in to reply to this topic.