AfriRate
v0.1.0Exchange rates, inflation and central-bank gold prices for 28 African countries.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_countries List covered countries
List every African country AfriRate covers, with its ISO code and how many rate sources feed it. Call this first when the user names a country in prose and you need its code.
list_currencies List known currencies
List every currency AfriRate quotes, with its symbol and decimal precision.
get_rate Latest exchange rates
Latest exchange rates, either every pair for one country (country="ZW") or one pair across every source that publishes it (base="USD", quote="KES"). Each row carries a `stale` flag — when it is true the source has been failing and the value is the last one published, so say so when you quote it.
| Parameter | Type | Description |
|---|---|---|
base | string | Base currency code, e.g. USD |
country | string | ISO 3166-1 alpha-2 country code, e.g. ZW |
quote | string | Quote currency code, e.g. ZWG |
get_inflation Latest inflation figures
Latest published inflation for a country: month-on-month, year-on-year and the CPI index, split into food and non-food where the statistics agency publishes it. Zimbabwe publishes separate USD and ZWG series, which arrive as separate rows distinguished by `denomination`.
| Parameter | Type | Description |
|---|---|---|
country * | string | ISO 3166-1 alpha-2 country code, e.g. ZW |
get_gold Latest gold-coin prices
Latest central-bank gold-coin prices for a country — Zimbabwe’s Mosi-oa-Tunya coin is the main series. Useful as a store-of-value reference where the local currency is unstable.
| Parameter | Type | Description |
|---|---|---|
country * | string | ISO 3166-1 alpha-2 country code, e.g. ZW |
convert Convert an amount between currencies
Convert an amount between two currencies using published African rates. Tries the direct pair, then the inverse, then a cross through USD, and tells you which path it used and which source it trusted. No AfriRate endpoint does this — it is computed here. Passing `country` when you know it costs one upstream request instead of up to six, which matters against a 10-per-minute budget.
| Parameter | Type | Description |
|---|---|---|
amount * | number | Amount to convert |
from * | string | Currency to convert from, e.g. USD |
to * | string | Currency to convert to, e.g. ZWG |
country | string | Restrict to sources from this country, e.g. ZW for the RBZ official rate |
source | string | Restrict to one source by its code as get_rate shows it, e.g. rbz or cbk. Usually leave this out. |
compare_corridor Compare one pair across sources and countries
Compare the same currency pair across every source that publishes it, and optionally across several countries at once, then report the best and worst quote and the spread between them. This is what 28-country coverage is actually for: answering "where is this corridor cheapest" in one call instead of twenty. Most pairs are published by a single central bank, in which case this says so rather than reporting a spread of zero. Naming countries costs one upstream request each against a 10-per-minute budget; omitting them costs two in total.
| Parameter | Type | Description |
|---|---|---|
base * | string | Base currency, e.g. USD |
quote * | string | Quote currency, e.g. KES |
countries | array | Restrict to these countries’ sources. Omit to compare every source publishing the pair. |
watch_rate Watch a rate across conversations
Remember a rate the user cares about and a condition on it — above a level, below a level, or a move of some percent — so a later conversation can ask what changed. Returns a watchlist id: give it to the user and keep it, because check_watches needs it and it is the only key to the list. Pass an existing `watchlist` to add to it; omit it to start a new one. The rate is resolved the same way as convert (direct, inverse, cross through USD). There is no push notification: a watch fires when check_watches is called and finds the condition holds. To set several watches, set one first and pass i…
| Parameter | Type | Description |
|---|---|---|
condition * | string | above: fire when the rate rises above value. below: when it falls below value. moves_pct: when it moves at least value percent either way from today. |
from * | string | Base currency, e.g. USD |
to * | string | Quote currency, e.g. ZWG |
value * | number | The level (for above/below) or the percent (for moves_pct) |
country | string | Only use sources from this country, e.g. ZW |
watchlist | string | Watchlist id from an earlier watch_rate, e.g. wl_k3x9p2m7qa. Holding the id is what grants access. |
check_watches Check a watchlist: what changed since last time
Re-read every rate on a watchlist and report, for each: whether its condition now holds, how far it has moved since the watch was set, and how far since the previous check — which may have been in an earlier conversation. Also says when a source has published nothing new since the last check, so a quiet source is not mistaken for a steady rate. Call it at the start of a conversation when the user has a watchlist id.
| Parameter | Type | Description |
|---|---|---|
watchlist * | string | Watchlist id from an earlier watch_rate, e.g. wl_k3x9p2m7qa. Holding the id is what grants access. |
remove_watch Remove a watch
Remove one watch from a watchlist by its id (w1, w2, …), or every watch with id "all".
| Parameter | Type | Description |
|---|---|---|
watch_id * | string | The watch to remove, e.g. w2, or "all" |
watchlist * | string | Watchlist id from an earlier watch_rate, e.g. wl_k3x9p2m7qa. Holding the id is what grants access. |