lukechilds / hyperdex-bugtracker

0 stars 1 forks source link

Trade posted with incorrect amount #14

Closed jansako closed 6 years ago

jansako commented 6 years ago

I have posted a trade with the price and amount as shown in the 'Sell Revs' box. The trade, however posted unexpectedly with a different trade amount (and lower price, but I assume that is WAD after taking DEX fee?)

If the max trade amount is decided by Hyperdex to be the 'max UTXO - tx fees', that is OK, but needs to be made clear to the user (perhaps a little (!) icon next to the trade amount that shows the explanation as a tooltip?)

Note: BarterDex allows you to place an order larger than your biggest UTXO, it will then execute multiple swaps in series until the total set trade amount. Trouble is sometimes it gets overzealous and sells a lot more that you expect (when there is liquidity, that is).

image

lukechilds commented 6 years ago

I have posted a trade with the price and amount as shown in the 'Sell Revs' box. The trade, however posted unexpectedly with a different trade amount (and lower price, but I assume that is WAD after taking DEX fee?)

If the max trade amount is decided by Hyperdex to be the 'max UTXO - tx fees', that is OK, but needs to be made clear to the user (perhaps a little (!) icon next to the trade amount that shows the explanation as a tooltip?)

We don't change any values, we pass them directly to marketmaker, it is determining that this swap is the best it can do with you UTXOs. This had me very confused the first time I came across it too.

If you sent the same parameters via the CLI, you'd get the same result.

Note: BarterDex allows you to place an order larger than your biggest UTXO, it will then execute multiple swaps in series until the total set trade amount. Trouble is sometimes it gets overzealous and sells a lot more that you expect (when there is liquidity, that is).

We intentionally haven't implemented any kind of looping/auto buying functionality because this isn't something that should be handled by the UI. It should be handled by marketmaker. Ideally either the matching should be improved in marketmaker so there's no need to do multiple trades, or if that's not possible, the splitting and multiple trades should be handled transparently by marketmaker.

Seperation of concerns, marketmaker should do the trading, HyperDEX should send/display commands. Adding business logic to the UI to workaround shortcomings of the trading engine is not a good solution.