nautechsystems/nautilus_trader · info

crypto tick scheme is valid

Error message

crypto tick scheme is valid

What it means

Panic site for the CRYPTO_0_01_TICK_SCHEME static, which constructs FixedTickScheme::new(0.01). The constructor rejects non-finite/non-positive ticks; 0.01 is valid by construction, so this expect should never fire. It exists to convert the Result into a plain value for a global constant and doubles as a guard against regressions in the tick validation logic.

Source

Thrown at crates/model/src/instruments/tick_scheme.rs:203

            (30_000.0, 100_000.0, 10.0),
            (100_000.0, 300_000.0, 50.0),
            (300_000.0, 1_000_000.0, 100.0),
            (1_000_000.0, 3_000_000.0, 500.0),
            (3_000_000.0, 10_000_000.0, 1_000.0),
            (10_000_000.0, 30_000_000.0, 5_000.0),
            (30_000_000.0, f64::INFINITY, 10_000.0),
        ],
        4,
        10_000,
    )
    .expect("TOPIX100 tick scheme tiers are valid by construction")
});

static FIXED_TICK_SCHEME: LazyLock<FixedTickScheme> =
    LazyLock::new(|| FixedTickScheme::new(1.0).expect("fixed tick scheme is valid"));

static CRYPTO_0_01_TICK_SCHEME: LazyLock<FixedTickScheme> =
    LazyLock::new(|| FixedTickScheme::new(0.01).expect("crypto tick scheme is valid"));

static FIXED_PRECISION_TICK_SCHEMES: LazyLock<Vec<FixedTickScheme>> = LazyLock::new(|| {
    (0..=FIXED_PRECISION)
        .map(|precision| {
            let tick = 10_f64.powi(-i32::from(precision));
            FixedTickScheme::new(tick).expect("fixed precision tick scheme is valid")
        })
        .collect()
});

#[derive(Debug, Clone, Copy, PartialEq)]
pub struct FixedTickScheme {
    tick: f64,
}

impl Eq for FixedTickScheme {}

impl FixedTickScheme {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Check recent diffs to FixedTickScheme::new for an over-strict validity check (e.g. rejecting small ticks via epsilon comparison).
  2. Verify the constant 0.01 wasn't changed to 0.0 or NaN.
  3. Run the module's tests to reproduce and fix the validation regression.
  4. No user-side action needed — this is library-internal.
Defensive patterns

Strategy: validation

Validate before calling

// Library-internal static; nothing for users to validate.
// If you maintain this code:
assert!(0.01_f64.is_finite() && 0.01 > 0.0);

Prevention

When it happens

Trigger: Untriggerable in normal use; only reachable if FixedTickScheme::new's validation is modified to reject the hard-coded 0.01 tick, then any use of the crypto tick scheme static panics on first access.

Common situations: Seen only after edits to tick_scheme.rs validation code or the constant, surfacing as a panic during the first price-rounding operation that touches the static.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/95295449645d28f1. Report an issue: GitHub.