Money and currencies
Ce contenu n’est pas encore disponible dans votre langue.
Thresholds are the heart of transaction monitoring — “more than GHS 50,000”, “just under the reporting limit”. For a threshold to mean anything, every amount has to be stored exactly and compared in the same currency. This page explains how SpeculaPro does that, and what you need to send it.
Three rules for money
Section titled “Three rules for money”- Amounts are whole numbers of the smallest unit. No decimals, ever.
- Every amount is also converted into your base currency, and the rate used is stored.
- Thresholds are compared in the base currency, so one rule works across every currency your customers use.
Minor units
Section titled “Minor units”Every amount is stored as an integer count of the currency’s minor unit — pesewas for the cedi, cents for the dollar.
| Amount | Currency | Stored as |
|---|---|---|
| GHS 12.50 | GHS |
1250 |
| GHS 50,000.00 | GHS |
5000000 |
| USD 300.00 | USD |
30000 |
| XOF 25,000 | XOF (no minor unit) |
25000 |
Why not decimals?
Section titled “Why not decimals?”Decimal and floating-point arithmetic in computers can produce tiny rounding errors — 0.1 plus 0.2 is not exactly 0.3. In a system that adds up thousands of payments to compare against a threshold, those errors can tip a total over or under the line. Whole numbers never round.
Base currency and conversion
Section titled “Base currency and conversion”Each workspace has a base currency — GHS for a Ghanaian institution. Every transaction is stored with:
| Field | Meaning | Example |
|---|---|---|
| Amount (minor units) | In the transaction’s own currency | 30000 |
| Currency | ISO code | USD |
| Amount in base (minor units) | Converted into the base currency | 465000 |
| Base currency | The workspace’s | GHS |
| FX rate | The rate used | 15.5 |
In that example, USD 300.00 at 15.5 cedis to the dollar is stored as GHS 4,650.00.
The FX rate table
Section titled “The FX rate table”Each workspace keeps a table of daily exchange rates: for each date, how many units of the base currency one unit of another currency is worth, and where the rate came from — for example the Bank of Ghana’s published rate.
Rates are kept forever. That is what makes every conversion reproducible: years later you can show exactly which rate turned a USD transfer into the cedi figure a rule compared against its threshold.
Worked example: a threshold across currencies
Section titled “Worked example: a threshold across currencies”Rule A3 Large cross-border transfer has threshold_amount set to
GHS 50,000. Three transfers arrive the same day; the rate is 15.5 GHS/USD and
16.8 GHS/EUR.
| Transfer | Original | In base | Hits? |
|---|---|---|---|
| 1 | USD 3,000 | GHS 46,500 | No |
| 2 | EUR 3,200 | GHS 53,760 | Yes |
| 3 | GHS 52,000 | GHS 52,000 | Yes |
One threshold, set once in cedis, applies correctly to all three.
Calendar days and timezones
Section titled “Calendar days and timezones”Rules that say “per day” or “per month” — daily KYC tier limits, for example — count days in the workspace timezone (Africa/Accra by default). A transaction at 23:30 in Accra counts towards that day, even if a server elsewhere would call it the next day.