> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tracefinance.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Money and currencies

> How monetary amounts are represented in the API.

## Overview

Monetary amounts in the Trace Finance API are represented as **decimal strings** in the asset's canonical scale, paired with an ISO 4217 currency code or stablecoin ticker. This single shape works uniformly for fiat (2 decimals) and stablecoins (6 decimals).

<Warning>
  Always parse amounts with a decimal-precision library (`BigDecimal`, `decimal.Decimal`, `Decimal.js`). Never use JavaScript `Number` or any 64-bit float — values like `0.1 + 0.2` lose precision, and high-decimal tokens overflow the safe-integer range.
</Warning>

## How it works

### Amount object

Every amount in a response uses the same structure:

```json theme={"theme":"tokyo-night"}
{
  "value": "0.11",
  "asset": "BRL",
  "decimals": 2
}
```

| Field      | Type    | Description                                                                           |
| ---------- | ------- | ------------------------------------------------------------------------------------- |
| `value`    | string  | Decimal amount in the asset's canonical scale. Always a string to preserve precision. |
| `asset`    | string  | ISO 4217 currency code or stablecoin ticker.                                          |
| `decimals` | integer | Number of decimal places for the asset.                                               |

### In request bodies

Quote and operation requests take amounts as a **decimal-string scalar** paired with a separate asset field — not the full object:

```json theme={"theme":"tokyo-night"}
{
  "sourceAmount": "500.00",
  "sourceAsset": "BRL"
}
```

The number of fractional digits must not exceed the asset's precision (table below). Exceeding it returns `INVALID_AMOUNT_PRECISION`.

### Decimal precision per asset

| `asset` | `decimals` | Example `value` |
| ------- | ---------- | --------------- |
| `BRL`   | 2          | `"5000.00"`     |
| `USDT`  | 6          | `"100.000000"`  |
| `USDC`  | 6          | `"1.500000"`    |

## Examples

A deposit of R\$ 1.250,00:

```json theme={"theme":"tokyo-night"}
{
  "amount": {
    "value": "1250.00",
    "asset": "BRL",
    "decimals": 2
  }
}
```

A withdrawal of 500 USDT:

```json theme={"theme":"tokyo-night"}
{
  "amount": {
    "value": "500.000000",
    "asset": "USDT",
    "decimals": 6
  }
}
```
