Skip to main content
This guide shows how to fetch live NGN exchange rates and build a bidirectional currency converter, the same feature NGN Market uses on its forex page. Users can type an amount in NGN and see the equivalent in USD, GBP, EUR, and more, or convert the other way around. Endpoint used:
  • GET /forex/current (Free plan): all current NGN rates in one call

How the rates work

Each rate is how many naira one unit of the foreign currency buys, and inverse_rate is the reverse. For example:
This means $1 = ₦1,603.50, so to convert:
  • USD → NGN: amount_usd × rate
  • NGN → USD: amount_ngn ÷ rate (or amount_ngn × inverse_rate)

Step 1: Fetch all rates

One call returns every supported currency pair.

Sample response (trimmed)

Step 2: Conversion logic

React component (bidirectional)

Typing in either input updates the other in real time.
React

Vanilla JavaScript (with a rate table)

Display all rates alongside the converter:
JavaScript

Tips

Cache rates for the session. Forex rates update daily, so one fetch per page load is sufficient. No need to poll on an interval like equity prices. Always show the rate date. The response includes a date (and a last_updated per currency). Display it near your rates so users know how fresh the data is. Cross-pair conversion routes through NGN. All rates are naira per unit, so to convert USD → GBP you multiply by the USD rate to get naira, then divide by the GBP rate. The convert() function above handles this automatically.

Forex current reference

Full response spec for GET /forex/current

Forex history reference

Historical NGN rates with date range filtering