HomePhabricator

[Cashtab] Improve price precision for Agora spot prices

Description

[Cashtab] Improve price precision for Agora spot prices

Summary:
Improve how we calculate and present spot prices for Agora offers in fiat and XEC

We want to render with appropriate significant figures. Because Agora offers may have very small unit prices, render with at least 4 places of precision, if applicable. (For example this is not applicable if we render the smallest unit price, 1 nanosatoshi, which is pointless to render with 3 more decimal places).

We render xec or fiat values greater than 1 with 2 decimal places (XEC has 2 places, this is a common decimal for fiat currencies...mb the only one).

We split out the logic for getting a formatted XEC price so that we can appropriately distinguish appropriate significant figures for XEC and fiat. Also we can directly call to get XEC prices, instead of force-calling getFormattedFiatPrice with null to mimic a failed API call as was done in some locations.

Update tests to confirm new expected behavior.

Test Plan: npm test

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

Subscribers: emack

Differential Revision: https://reviews.bitcoinabc.org/D17443

Details

Provenance
bytesofmanAuthored on Tue, Dec 31, 18:22
bytesofmanPushed on Wed, Jan 1, 00:20
Reviewer
Restricted Project
Differential Revision
D17443: [Cashtab] Improve price precision for Agora spot prices
Parents
rABC60400b6149ea: [Automated] Update electrum checkpoints
Branches
Unknown
Tags
Unknown