# Data Formats & Precision

### Numeric Precision

| Domain        | Native Decimals     | Display Decimals | Notes                               |
| ------------- | ------------------- | ---------------- | ----------------------------------- |
| USD amounts   | 6                   | 2                | `500000000` native = `"500.00"` UI  |
| Token amounts | Varies              | Varies           | SOL = 9 decimals, USDC = 6 decimals |
| Oracle prices | `(price, exponent)` | Varies           | Compute: `price × 10^exponent`      |
| Leverage      | Basis points (BPS)  | 2                | `50000` BPS = `"5.00"` leverage     |
| Percentages   | —                   | 5                | `"0.03600"` = 0.036%                |

***

### UI String Format

All `*Ui` fields are human-readable decimal strings (e.g., `"148.52"`, `"500.00"`). Parse as floats or display directly.

***

### KMB Formatting

Fields ending in `Kmb` format large numbers for display:

| Raw Value    | Formatted  |
| ------------ | ---------- |
| `999.50`     | `"999.50"` |
| `1500`       | `"1.50K"`  |
| `2500000`    | `"2.50M"`  |
| `3000000000` | `"3.00B"`  |

***

### Base64 Account Data

The `positionAccountData` and `orderAccountData` fields in enriched responses contain raw Anchor account bytes encoded as base64. Use these when enrichment fields are `null`:

javascript

```javascript
import { Program } from '@coral-xyz/anchor';
import { Buffer } from 'buffer';

const rawBytes = Buffer.from(positionAccountData, 'base64');
const position = program.coder.accounts.decode('position', rawBytes);
```
