Open extra topbar

Negative available balance after trade

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

Negative available balance after trade

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10273
    LeinAd
    Participant

    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.

    #10275
    alexg
    Keymaster

    Hello,

    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

    #10287
    LeinAd
    Participant

    curoius .. i wanted to make some screenshoots to explain what i mean but actuall it seeems to be good

    #10346
    LeinAd
    Participant

    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.
    #10351
    alexg
    Keymaster

    Hello,

    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.

    with regards

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.