nautechsystems/nautilus_trader · error · anyhow::Error

missing dayBaseVlm

Error message

missing dayBaseVlm

What it means

This error is raised while normalizing a Hyperliquid `allDexAssetCtx` entry into domain data. The API's `dayBaseVlm` (24h base-asset volume) is an optional field, but the NautilusTrader Hyperliquid adapter requires it to build the asset context; when the exchange payload omits it (or the type is not present), normalization fails instead of silently producing a zero volume.

Source

Thrown at crates/adapters/hyperliquid/src/websocket/handler.rs:1323

        ctx: super::messages::PerpsAssetCtx,
    ) -> anyhow::Result<HyperliquidDexAssetCtx> {
        let mark_price = Price::from_decimal(ctx.shared.mark_px).map_err(anyhow::Error::msg)?;
        let oracle_price = Price::from_decimal(ctx.oracle_px).map_err(anyhow::Error::msg)?;
        let prev_day_price =
            Price::from_decimal(ctx.shared.prev_day_px).map_err(anyhow::Error::msg)?;
        let mid_price = ctx
            .shared
            .mid_px
            .map(|value| Price::from_decimal(value).map_err(anyhow::Error::msg))
            .transpose()?;
        let funding_rate = ctx.funding;
        let open_interest = ctx.open_interest;
        let premium = ctx.premium;
        let day_ntl_volume = ctx.shared.day_ntl_vlm;
        let day_base_volume = ctx
            .shared
            .day_base_vlm
            .ok_or_else(|| anyhow::anyhow!("missing dayBaseVlm"))?;
        let impact_prices = match ctx.shared.impact_pxs {
            Some(values) => match values.as_slice() {
                [bid, ask] => Some(HyperliquidImpactPrices {
                    bid: bid.parse::<Price>().map_err(anyhow::Error::msg)?,
                    ask: ask.parse::<Price>().map_err(anyhow::Error::msg)?,
                }),
                other => {
                    anyhow::bail!("expected 2 impact prices, received {}", other.len());
                }
            },
            None => None,
        };

        Ok(HyperliquidDexAssetCtx {
            dex: dex.to_string(),
            instrument_id,
            mark_price,
            oracle_price,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Check the raw Hyperliquid payload and confirm `dayBaseVlm` is present in the `assetCtxs` entry; log the JSON if unsure.
  2. Update the hyperliquid adapter / nautilus crate versions together so the payload schema and normalization stay in sync.
  3. If the field is legitimately optional for your asset, relax the code to treat a missing `day_base_vlm` as zero (e.g. `.unwrap_or_default()`) or skip the entry instead of erroring.
  4. Retry subscription; transient partial snapshots can be followed by complete ones.

Example fix

// before
let day_base_volume = ctx
    .shared
    .day_base_vlm
    .ok_or_else(|| anyhow::anyhow!("missing dayBaseVlm"))?;
// after
let day_base_volume = ctx.shared.day_base_vlm.unwrap_or_default();
Defensive patterns

Strategy: validation

Validate before calling

if payload.get("dayBaseVlm").is_none() {
    // skip or buffer this assetCtx entry
}

Try / catch

match result {
    Err(e) if e.to_string().contains("missing dayBaseVlm") => {
        // tolerate partial snapshot: skip entry or retry subscription
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling `normalize_all_dex_asset_ctx_entry` on a `ctx` whose `shared.day_base_vlm` is `None` — i.e. the WebSocket `allMids`/`assetCtxs` message for a DEX asset lacked the `dayBaseVlm` field.

Common situations: Hyperliquid API schema changes or partial payloads for newly listed/perp DEX assets where day volume stats are not yet populated; outdated adapter code not handling optional fields; replayed or synthesized test payloads missing the field.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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