# How to Choose Between High-Precision and Standard-Precision Modes in Nautilus Trader

> Learn how to choose between high-precision and standard-precision modes in Nautilus Trader. Optimize performance or gain decimal accuracy for your trading strategies. Select the right precision easily.

- Repository: [Nautech Systems/nautilus_trader](https://github.com/nautechsystems/nautilus_trader)
- Tags: how-to-guide
- Published: 2026-02-16

---

**High-precision mode uses 128-bit integers to store up to 16 decimal places and is required for crypto assets quoting beyond 9 decimal places, while standard-precision mode uses 64-bit integers for up to 9 decimals and offers 3–5% better performance; the mode is locked at compile time via the `HIGH_PRECISION` environment variable or Cargo feature flag.**

Nautilus Trader stores financial values such as **Price**, **Quantity**, and **Money** as fixed-point integers to eliminate floating-point errors. When building the framework, you must choose between high-precision and standard-precision modes, which determines the maximum number of decimal places and the underlying bit width used for these critical types. This decision is made at compile time and affects everything from crypto asset support to backtest performance.

## Understanding the Two Precision Modes

The framework implements two distinct precision modes that change the backing integer type for all financial calculations.

### High-Precision Mode (128-bit)

High-precision mode utilizes **128-bit integers** (`i128`/`u128`) to represent values with up to **16 decimal places**. This mode supports a value range of approximately ±1.7 × 10¹⁶ and is essential for trading instruments that quote at sub-satoshi or wei-level precision, such as cryptocurrency pairs on Binance or DeFi tokens. According to the source code in `nautilus_trader/model/objects.pyx` (lines 84‑87), this mode sets `FIXED_PRECISION` to 16.

### Standard-Precision Mode (64-bit)

Standard-precision mode employs **64-bit integers** (`i64`/`u64`) supporting up to **9 decimal places** with a range of approximately ±9 × 10⁹. This provides baseline execution speed and is sufficient for traditional equities, futures, and fiat forex pairs that do not quote beyond the ninth decimal place. In this mode, `FIXED_PRECISION` is set to 9 as defined in the same `objects.pyx` file.

## Three Factors to Consider When Choosing

Selecting the appropriate precision mode requires evaluating your specific trading domain and infrastructure constraints.

### 1. Numeric Requirements of Your Trading Instruments

Analyze the decimal precision required by your target venues. Crypto assets, DeFi tokens, and any market quoting more than 9 decimal places—such as wei-level ERC-20 tokens—mandate high-precision mode. Traditional equities, futures, and most fiat-denominated venues never exceed 9 decimals, making standard-precision sufficient and more memory-efficient.

### 2. Target Platform Limitations

Platform constraints often dictate the available mode. On **Linux** and **macOS**, the official Python wheels are built with high-precision by default. However, on **Windows**, the C/C++ toolchain cannot compile `__int128` types, forcing the build to standard-precision. As implemented in [`build.py`](https://github.com/nautechsystems/nautilus_trader/blob/main/build.py) (lines 53‑57), the script detects Windows and automatically disables high-precision even if the environment variable is set, printing a warning to the console.

### 3. Performance vs. Accuracy Trade-off

Standard-precision mode runs approximately **3–5 % faster** in back-tests and uses less memory due to the smaller integer width. High-precision incurs a small CPU cost for 128-bit arithmetic but guarantees that every decimal place the market provides is preserved exactly, preventing rounding errors in high-frequency crypto strategies.

## How to Configure the Precision Mode at Build Time

The precision mode is locked during compilation and cannot be altered at runtime. You must set the configuration before building the package.

### Using the HIGH_PRECISION Environment Variable

When installing from source or building Python wheels, set the environment variable to control the mode. The logic in [`build.py`](https://github.com/nautechsystems/nautilus_trader/blob/main/build.py) (lines 52‑58) reads this variable to determine the Rust compiler flags.

```bash

# Enable high-precision (default on Linux/macOS)

export HIGH_PRECISION=true
pip install .

# Force standard-precision (64-bit)

export HIGH_PRECISION=false
pip install .

```

### Enabling the Cargo Feature Flag

When building the Rust crates directly—for example, when integrating the core engine into a custom Rust application—use the `high-precision` feature declared in [`Cargo.toml`](https://github.com/nautechsystems/nautilus_trader/blob/main/Cargo.toml) (line 88).

```toml
[dependencies]
nautilus-core = { version = "*", features = ["high-precision"] }

```

```bash
cargo build --release --features "high-precision"

```

## Verifying Your Active Precision Mode at Runtime

After installation, confirm which mode is active by inspecting the constants exported from the Cython extension. In `nautilus_trader/model/objects.pyx` (lines 83‑87), the module exposes `HIGH_PRECISION` as a boolean and `FIXED_PRECISION` as an integer.

```python
from nautilus_trader.model.objects import HIGH_PRECISION, FIXED_PRECISION

print(f"High-precision mode: {HIGH_PRECISION}")      # True → 128-bit, False → 64-bit

print(f"Maximum decimal places: {FIXED_PRECISION}")  # 16 or 9

```

You can also test the practical limit by attempting to create a `Price` with precision exceeding the compiled maximum:

```python
from nautilus_trader.model.objects import Price

# This succeeds only if FIXED_PRECISION ≥ 15

price = Price(0.000000123456789, precision=15)
print(price)  # 0.000000123456789

```

If the wheel was built in standard-precision mode, the final example raises a `ValueError` because `FIXED_PRECISION` is 9.

## Summary

- **High-precision mode** (`i128`/`u128`) supports up to 16 decimal places and is required for crypto assets quoting beyond 9 decimals, but incurs a 3–5 % performance penalty.
- **Standard-precision mode** (`i64`/`u64`) supports up to 9 decimal places, offers baseline speed, and is the only option available on Windows due to toolchain limitations.
- The mode is selected at **compile time** via the `HIGH_PRECISION` environment variable (read in [`build.py`](https://github.com/nautechsystems/nautilus_trader/blob/main/build.py) lines 52‑58) or the `high-precision` Cargo feature (defined in [`Cargo.toml`](https://github.com/nautechsystems/nautilus_trader/blob/main/Cargo.toml) line 88).
- Verify the active mode at runtime by importing `HIGH_PRECISION` and `FIXED_PRECISION` from `nautilus_trader.model.objects` (lines 83‑87).

## Frequently Asked Questions

### Can I switch between precision modes at runtime?

No. The precision mode is determined at compile time when the Rust extensions are built. Once you install the package, the backing integer width (64-bit or 128-bit) is fixed for the duration of the process. To change modes, you must rebuild the package with the desired configuration.

### Why does Windows only support standard-precision?

The Windows C and C++ toolchain does not provide the `__int128` type that Rust uses to implement 128-bit integers on other platforms. As a result, the build script in [`build.py`](https://github.com/nautechsystems/nautilus_trader/blob/main/build.py) (lines 53‑57) detects Windows and automatically forces standard-precision mode, printing a warning if `HIGH_PRECISION=true` was requested.

### Will high-precision mode slow down my backtests?

Yes, but the impact is modest. High-precision mode is approximately 3–5 % slower than standard-precision mode during backtests because 128-bit arithmetic requires more CPU cycles and memory bandwidth. For most strategies, the accuracy benefits outweigh this cost, but high-frequency simulations may benefit from standard-precision.

### How do I know if my trading venue requires high-precision?

Check the maximum number of decimal places quoted by your target instruments. If any asset—such as cryptocurrency pairs on Binance, Deribit, or DeFi tokens—quotes beyond 9 decimal places (e.g., wei-level precision for ERC-20 tokens), you must use high-precision mode. Traditional equities, futures, and forex pairs rarely exceed 4-5 decimal places, making standard-precision sufficient.