Price conversion

Conversion is informational. It never changes what is credited, charged or paid out: those amounts are always exact integer units of the token.

Endpoints

  • GET /convert/?value=&from=&to= converts between any two supported currencies.
  • GET /{ticker}/convert/?value=&from= converts into the ticker's own asset, using its decimals.

Both are described with examples in the API reference.

from and to are case-insensitive. value is a positive plain decimal with at most 30 integer and 18 fraction digits (no sign, exponent or separators).

Supported currencies

Fiat currencies: usd, eur, gbp, cad, jpy, aed, myr, idr, thb, chf, sgd, rub, zar, try, lkr, ron, bgn, huf, czk, php, pln, ugx, mxn, inr, hkd, cny, brl, dkk, twd, aud, ngn, sek, nok, uah, vnd.

Priced assets: bnb, btc, eth, trx, usdc, usdt.

Rounding

  • Fiat results are rounded half up to 2 decimals. Token results are rounded half up to the asset's decimals.
  • exchange_rate is the number of to units per one from unit, rounded half up to 12 decimals with trailing zeros trimmed.

Freshness and failure

Prices come from CoinGecko and are cached for a short time. If no fresh price exists, or conversion is disabled, the endpoints answer HTTP 503 with {"status":"error","error":"Price data is temporarily unavailable"}. They never return a stale or guessed value.

In callbacks

  • Every callback carries price, the USD price of one whole token with up to 8 decimals, when a fresh price existed at event creation.
  • Confirmed callbacks of orders created with convert=1 also carry value_coin_convert and value_forwarded_coin_convert. They are JSON objects serialized as strings, keyed by upper-case fiat code with 2-decimal values, for example {"EUR":"90.00","USD":"100.02"}.
  • Without a fresh price the callback is still sent on time, without price and the convert fields. They are never added later.
  • convert=1 is refused with HTTP 400 at create when conversion is disabled.