Power-Trade / api-docs

0 stars 1 forks source link

Calculation of Account Health has gaps, display could be improved [Web] #18

Open laisee opened 8 months ago

laisee commented 8 months ago

On Web site I can enter an AVAX perpetual trade order. When I change the order quantity shows different values for Account Health after trade execution.

Enter order qty for 10, see health is "88%"

Screenshot 2024-02-13 at 11 21 45 am

Enter order qty for 100, see health is "100%"

Screenshot 2024-02-13 at 11 22 04 am

Enter order qty for 80, see health is "11%"

Screenshot 2024-02-13 at 11 22 55 am

Enter order qty for 90, see health is "0%"

Screenshot 2024-02-13 at 11 23 24 am

Also, the margin balance is not being recalculated - depending on the order quantity entered.

klugjo commented 8 months ago

Enter order qty for 100, see health is "100%"

This is a "known" limitation of the system. If the order were to blow up your account, the system is incapable of calculating the margin available. cc @kernelbee

Also, the margin balance is not being recalculated - depending on the order quantity entered.

@laisee can you give me more details on what that means ? I am not too sure what that means, thanks

laisee commented 8 months ago

here are some screen shots taken from prod web UI

ADA Perpetual with order qty 10 - health @ 98%, margin is non-zero

Screenshot 2024-02-14 at 3 33 01 pm

ADA Perpetual with order qty 100 - health @ 97%, margin is non-zero

Screenshot 2024-02-14 at 3 33 10 pm

ADA Perpetual with order qty 1000 - health @ 83%, margin is non-zero

Screenshot 2024-02-14 at 3 33 26 pm

ADA Perpetual with order qty 10000 - health now back @ 98% margin value at zero

Screenshot 2024-02-14 at 3 33 36 pm

reduce order quantity to 1000 and health / margin both recalculated to previous values

Screenshot 2024-02-14 at 3 34 20 pm
klugjo commented 8 months ago

Thanks @laisee so no issue on the web app.

Only issue here is that system limitation around calculating margin and account health when the result would liquidate the account.

This is a known bug

laisee commented 8 months ago

If the order size will cause liquidation should it not show new account health as 0? As a trader I'd prefer to see visible clues and even a warning that my trade is beyond account limits. Another option is to use a slider with 25/50.75/100 percentage of available account collateral that can be applied to a trade.

On Wed, 14 Feb 2024 at 15:44, Klughertz Jonathan @.***> wrote:

Thanks @laisee https://github.com/laisee so no issue on the web app.

Only issue here is that system limitation around calculating margin and account health when the result would liquidate the account.

This is a known bug

— Reply to this email directly, view it on GitHub https://github.com/Power-Trade/api-docs/issues/18#issuecomment-1943230190, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNBV2ULXUZSADLA2ZPHYXDYTRTMRAVCNFSM6AAAAABDFZGUMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBTGIZTAMJZGA . You are receiving this because you were mentioned.Message ID: @.***>

klugjo commented 8 months ago

I agree with you, unfortunately it is an API limitation that prevents us from doing that (instead of telling us that the account would blow up, it tells us nothing, making it undistinguishable from a "no margin usage for the trade" scenario). Hopefully a fix will be available soon

laisee commented 8 months ago

Understand - can change this issue to "Improvement in Account Health calculation & display". Then leave it open till API allows improvement. How does that sound?

klugjo commented 8 months ago

sounds good thanks

klugjo commented 6 months ago

@laisee this has been improved:

In case there is not enough margin you get this message:

image

We are still unable to compute exactly how much margin you would need when you don't have enough but at least you get notified that the order would not go through.

For cases where there are enough funds to cover margin, correct number is displayed:

image
laisee commented 3 months ago

Re-tested, found some improvements but still issues which can leave traders potentially losing funds without enough guidance. See example below where projected account health gaps after entering 346+ contracts and any number above that shows same "91%" projected health.

Issues:

  1. Traders can't see their funds will be liquidated i.e. no warning
  2. UI should not allow traders to pick new positions that will liquidate their funds - should be a slider allowing 25/50/75 % of available funds to be used, like many other exchanges.

Enter LONG AVAX Perp trade with 34 contracts -> new health is 82%

Screenshot 2024-07-22 at 17 25 54

Enter LONG AVAX Perp trade with 300 contracts -> new health is 16%

Screenshot 2024-07-22 at 17 26 10

Enter LONG AVAX Perp trade with 343 contracts -> new health is 05%

Screenshot 2024-07-22 at 17 26 21

Enter LONG AVAX Perp trade with 348 contracts -> new health is 91%

Screenshot 2024-07-22 at 17 26 32

Enter LONG AVAX Perp trade with 3488 contracts -> new health is 91%

Screenshot 2024-07-22 at 17 26 56