Page MenuHomePhabricator

[Cashtab] Support buying agora offers above spot, within reason
ClosedPublic

Authored by bytesofman on Thu, Jan 30, 00:16.

Details

Summary

Agora has some unique properties compared to other exchanges. One of these: users may set a "min buy" parameter when they create an offer.

It makes sense that an offer with a lower "min buy" may reasonably have a higher price than offer with a higher "min buy" (economies of scale).

Support buying above spot, up to 25% over spot.

We could update this parameter in the future depending on how it is being used. The main use case now seems to be users would like to buy XECX for prices < 1% above spot that have lower min quantities.

Test Plan

npm test

Deployed to test site, check version for 3.12.15

Check XECX page
https://cashtab-local-dev.netlify.app/#/token/c67bf5c2b6d91cfb46a5c1772582eff80d88686887be10aa63b0945479cf4ed4

We can buy ("OK" button enabled) an offer above spot, but we do see a warning that it is above spot

image.png (473×329 px, 55 KB)

We cannot buy an offer more than 25% above spot (OK button disabled), and we see warning + alert

image.png (473×329 px, 53 KB)

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

version bump, preserve above spot warning for prices above spot, even those that are not disabled

bytesofman added inline comments.
cashtab/src/components/Agora/OrderBook/index.tsx
990 ↗(On Diff #52439)

the check logic looks pretty complicated (was before this diff too)

arguably we should move it to a function. But, so far, it isn't repeated. And we are just comparing two numbers, with some extra checks that are mostly type related.

This revision is now accepted and ready to land.Thu, Jan 30, 05:56