# Money and currencies

> Exact amounts with a currency, decimal numbers, totals per currency, exchange rates and convert(), and converting existing number fields.

Source: https://docs.ligament.ai/guides/building-apps/money/

Ligament stores amounts exactly. A **money** field holds an amount and its currency, and a **decimal** field holds an exact number without a currency, such as a quantity, a rate or a percentage. Neither ever goes through a floating-point number, so `0.1 + 0.2` is `0.3`, and a total over 10,000 rows is right to the last cent.

For the JSON, CSV and API details, see [Money in the API](https://docs.ligament.ai/developers/money/index.md).

## Field types

| Type | Use it for | Example value |
| --- | --- | --- |
| Money | Prices, deal amounts, salaries, invoice totals | 1,234.50 USD |
| Decimal | Quantities, unit rates, percentages, scores | 0.125 |
| Number | Counts and other whole numbers you don’t add up as money | 42 |

Pick the type in **Build › Data** when you add a field, or set `type: 'money'` or `type: 'decimal'` in an app manifest.

### Currency

A money field gets its currency in one of two ways:

-   **A fixed currency**: every record uses the same one. A US sales pipeline might use USD.
-   **The record’s currency field**: a text or choice field on the same record holds an ISO 4217 code, so each record can have its own currency. The HR app’s salary works this way: the employee’s **Currency** field says THB, SGD, EUR or USD.

When an amount is saved and the record’s currency field is empty, it’s filled in from the amount. An amount in a different currency from the field’s is refused, never converted silently. To convert, use [`convert()`](#converting-between-currencies).

### Decimal places

Money uses the currency’s minor units: JPY has 0 places, USD and EUR 2, KWD 3. Unit prices and rates often need more, so a field can declare a larger **scale** (places), for example 4 for a per-unit price. Decimal fields default to 2 places.

Ligament never rounds what you type. If you enter more places than the field allows, it tells you, for example “USD amounts have at most 2 decimal places”, and nothing is saved.

### Rounding

Rounding only applies to values Ligament computes: formulas, averages and conversions. The default is **half-even**, also called banker’s rounding: 0.125 becomes 0.12 and 0.135 becomes 0.14. It avoids drifting upwards over many rows. A field can choose **half-up** instead, where 0.125 becomes 0.13, if your rules require it.

## How amounts look

Amounts are shown in your browser’s language and region, with the currency symbol or code. The same 1234.50 USD reads `$1,234.50` in American English, `1.234,50 $` in German, `US$1,234.50` in British English and `USD 1,234.50` in Australian English. Table columns of amounts are right-aligned with figures of equal width so they line up. Inputs accept the field’s places only, and you can type or paste grouping separators: they’re removed before the value is saved.

## Totals and reports

Amounts in different currencies are never added together.

-   **List totals and group subtotals** show one line per currency, such as `120,000.00 USD · 85,500.00 EUR`.
-   **Reports and dashboard blocks** (KPIs, charts) show a figure per currency. A chart that mixes currencies labels its bars with the currency, for example `Won (EUR)`.
-   **Rollups** (a parent’s sum of its children’s amounts) are exact. If the children are in more than one currency, the rollup is left empty rather than mixing them.
-   **Averages** are computed exactly and rounded to the field’s places with its rounding mode.

To compare across currencies, convert first: add a calculated money field with a fixed currency whose formula uses `convert()`. The totals of that field are then in one currency.

### Masked amounts

Money fields follow the same [field levels and masks](https://docs.ligament.ai/guides/access/index.md) as any other field. If you can’t read an amount in clear on every row of a list, that list shows **no total** for it, and reports show no figure. With rules that depend on the record (a manager reads the pay of the people below them), a list whose rows are all in clear for you, such as a manager’s own team, does show its total. A total never reveals a masked amount. Filtering on an amount you can’t read returns nothing, so a filter can’t be used to guess values either.

## Exchange rates

Exchange rates live in the **Exchange rates** module, which installs itself the first time an admin enters a rate. Each currency pair, such as EUR → USD, is one record, and its rate is [effective-dated](https://docs.ligament.ai/guides/effective-dating/index.md). Entering a new rate from a date adds a dated change, so every past rate stays available, and a conversion “as of” any date uses the rate that was in force then.

-   **Enter rates by hand.** Open **Exchange rates** in the data browser, or use the API or CLI below. Admins and owners can set rates, and everyone else can read them.
-   **Pull rates from a source.** The curated *Frankfurter* connector (European Central Bank reference rates) is **off by default**. An admin can enable it in **Build › Extensions › Connectors** and run a sync. Each rate that changed is written as a dated change with the source’s name.

A rate reads “1 base = rate quote”: EUR → USD 1.0845 means 1 EUR = 1.0845 USD. If only the opposite pair exists, Ligament uses its inverse (1 ÷ rate) and says so.

### Converting between currencies

In a calculated field’s formula:

```plaintext
convert({{amount}}, "USD")                  // today's rate
convert({{amount}}, "USD", {{close_date}})  // the rate in force on the close date
```

The result is rounded half-even to the target currency’s places. Every conversion records the rate and the date it took effect, and the record shows them under the value, for example *Converted from €1,250.00 at 1.0845 (manual rate of Nov 1, 2026)*. Converting to the same currency uses rate 1. If there’s no rate for the pair on that date, the formula reports “No exchange rate from EUR to USD on 2026-10-01” instead of guessing.

## Importing and exporting

-   **CSV export** writes a money field as two columns: the plain amount (`1234.50`, with no symbol or grouping and `.` for decimals) and `<field>_currency` (`USD`) right after it. Decimal fields are written exactly as stored.
-   **Imports** read amounts such as `$1,234.50`, `1.234,50 €`, `USD 1,234.50` or `(12.00)` for a negative amount. Every row is checked before anything is written. Rows that don’t fit are listed with the row number and the reason (“Row 14, Amount: USD amounts have at most 2 decimal places”), and nothing is imported until they’re fixed.
-   A spreadsheet cell stored as a number keeps only about 15 significant digits. If a longer number arrives, the import asks you to store that column as text in the spreadsheet.

## Converting existing number fields

Older apps may hold amounts in **Number** or **Currency** fields as plain numbers. Admins convert them in **Settings › Data › Money fields**:

1.  The page lists fields that look like amounts: every Currency field, and Number fields named like money (amount, price, cost, salary, revenue, fee, budget, total and similar).
2.  Pick a field, then choose a fixed currency or a currency field. **Check conversion** runs a dry run over every record and every dated version. It shows how many values convert exactly and lists any that wouldn’t, such as a value with more places than the currency allows, or text that isn’t a number.
3.  If the check is clean, **Convert** applies it in one step. Values are copied exactly; nothing is rounded. If anything changed since the check, the conversion is refused and you run the check again.

Fix any listed values first (or pick a currency with more places). A conversion is never applied with values that would change.

First-party apps such as CRM, HR and Customers core already use money fields. Upgrading one converts its existing values the same way. The upgrade preview shows the plan, and the upgrade stops if any value wouldn’t convert exactly.
