OnLink
ConceptsRails

FX

KES against USDT, quoted off a live rate, and USD to KES conversions on the collections product. When we cannot price, we decline rather than guess.

Two pairs, on two different products, priced in two different ways:

  • KES against USDT, on the USDT rails product. The rate is rate on a quote, expressed as KES per USDT, and it is locked until the quote expires. Most of this page is about this pair.
  • USD to KES, on the collections product, in one direction only. A conversion's rate is fixed when the conversion executes, not when you ask; see USD to KES conversions below.

Quotes come off a live rate

A quote is only ever issued against a live rate source. There is no fallback to a cached or default rate, because a stale rate is a rate neither side agreed to.

If we cannot price at that moment, the quote request fails rather than returning a figure we do not stand behind. Treat that as a transient condition: surface it to your user as "we could not price this right now", and let them retry.

Never derive the other leg yourself

Supply one leg and read the other off the response. The derived leg rounds in OnLink's favour, so a number you computed will occasionally disagree with the one the order executes at — and the response is the one that is true.

Precision

  • rate — KES per USDT. A quote's rate carries 2 decimal places; the order that quote is spent on persists rate at 4 decimal places instead. Both describe the same trade — read whichever resource you have, and do not assume the two are byte-identical strings.
  • kesAmount — 2 decimal places.
  • usdtAmount — 6 decimal places.

All strings. See Money for why, and for how to hold them without losing value.

The rate is locked, then spent

The rate on a quote holds until expiresAt and is consumed by the order that uses it. Nothing re-prices silently: an expired quote is a 409, never a fresh rate you did not see.

USD to KES conversions

A conversion turns US dollars in your USD account into shillings in your KES account. It is priced differently from an order:

  • The quote is indicative. GET /v1/conversions/quote tells you the rate you would get now, and holds nothing. The rate is fixed when the conversion executes.
  • rate is KES per 1 USD, to 2 decimal places, and target is exactly source × rate, rounded down to the cent. Both are null on the conversion until the rate is fixed, and never change afterwards.
  • A rate that moves too far is not traded. If the rate at execution has moved too far from the one read when you created the conversion, in either direction, the conversion fails with rate_moved_beyond_tolerance and your USD is returned.
  • No rate, no conversion. When no usable rate is available, quoting and creating are refused 503 CONVERSION_RATE_UNAVAILABLE, and nothing moves.

A conversion carries no fee line: its rate is the whole of its price, and is not itemised further. See Fees.

On this page