Skip to content

Money and currencies

IDEALX keeps every amount as an integer number of minor units (cents, pence, fils) with its currency, and never uses floating-point numbers for money. On the wire that becomes one of two exact forms.

In requests and responses: decimal strings

Section titled “In requests and responses: decimal strings”

Amounts are decimal strings in major units, always with their currency:

{ "amount": "1250.00", "currency": "AUD" }
  • The number of decimals follows the currency ("1250.00" AUD, "1250" for a currency without minor units).
  • Negative amounts carry a sign: "-12.50" is money out (activity and transaction amounts are signed).
  • Send amounts the same way, as strings: { "amount": "500.00", "currency": "AUD" }. A number, or more decimals than the currency has, answers 422.

Quantities, prices and rates are decimal strings too: "quantity": "25", "quantity": "0.01250000" for a coin, "limitPrice": "101.2500", "rate": "0.6512". Never parse them into floats; use a decimal type:

Language Use
TypeScript / JavaScript Keep the string, or a decimal library (decimal.js, big.js); BigInt on minor units for sums
Python decimal.Decimal(value)
Java / Kotlin BigDecimal
C# decimal
Go shopspring/decimal, or integers in minor units

Webhook payloads are compact and carry minor units as an integer string named units, with the currency:

{ "accountId": "acc_…", "units": "25000", "currency": "AUD" }

"25000" AUD is A$250.00. For a digital asset (crypto.received), units counts the coin’s smallest unit at the precision IDEALX keeps for it, alongside its instrumentId. Read the account’s activity for the amount in major units.

Currencies are ISO 4217 codes (AUD, GBP, AED, USD…). An account has a main currency from its country; portfolios can hold cash in other currencies once the account has a currency account for them (GET /v1/accounts/{id}/currency-accounts).

Fields named …InAccountCurrency, shown or valueBase are converted at today’s middle rate, as an estimate, and are null when there is no rate. Converting money for real goes through POST /v1/accounts/{id}/fx at a quoted rate that includes IDEALX’s margin.

Where Unit Example
Returns (returns.oneYear…) Percent, a number with up to four decimals 7.4213 is 7.42%
Allocation (percent) Percent, two decimals 34.5
Weights, drift, bands (weightBp, driftBp, bandBp, nowBp, afterBp) Basis points, integers 2500 is 25%
Interest and coupon rates (rate, couponRate) Percent, decimal string "4.60"