nautechsystems/nautilus_trader · error

Kraken Spot does not support the demo environment

Error message

Kraken Spot does not support the demo environment

What it means

Environment validation in Kraken clients: the demo (testnet-style) environment was selected while product_type is Spot. Kraken Spot has no demo environment, so the combination is rejected during configuration validation.

Source

Thrown at crates/adapters/kraken/src/config.rs:310

    ///
    /// Returns an error if `default_leverage` is set on a Cash account or the demo environment is
    /// used for Spot.
    pub fn validate(&self) -> anyhow::Result<()> {
        validate_product_environment(self.product_type, self.environment)?;

        if self.default_leverage.is_some() && self.spot_account_type == AccountType::Cash {
            anyhow::bail!("default_leverage requires spot_account_type=Margin");
        }
        Ok(())
    }
}

fn validate_product_environment(
    product_type: KrakenProductType,
    environment: KrakenEnvironment,
) -> anyhow::Result<()> {
    if product_type == KrakenProductType::Spot && environment == KrakenEnvironment::Demo {
        anyhow::bail!("Kraken Spot does not support the demo environment");
    }
    Ok(())
}

#[cfg(test)]
mod tests {
    use rstest::rstest;

    use super::*;

    const DATA_API_KEY: &str = "data-api-key-sentinel";
    const DATA_API_SECRET: &str = "data-api-secret-sentinel";
    const EXEC_API_KEY: &str = "exec-api-key-sentinel";
    const EXEC_API_SECRET: &str = "exec-api-secret-sentinel";

    #[rstest]
    fn test_data_config_debug_redacts_credentials() {
        let config = KrakenDataClientConfig {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set `environment` to Live (or the supported sandbox value) for Spot, or
  2. Switch `product_type` to Futures if the demo environment is actually needed
  3. Call validate() early to fail fast before connecting

Example fix

// before
let config = KrakenDataClientConfig {
    product_type: KrakenProductType::Spot,
    environment: KrakenEnvironment::Demo,
    ..Default::default()
};
// after
let config = KrakenDataClientConfig {
    product_type: KrakenProductType::Spot,
    environment: KrakenEnvironment::Live,
    ..Default::default()
};
Defensive patterns

Strategy: validation

Validate before calling

if product_type == KrakenProductType::Spot && environment == KrakenEnvironment::Demo {
    panic!("Spot+Demo is not supported by Kraken");
}
cfg.validate().expect("invalid Kraken config");

Try / catch

config.validate().unwrap_or_else(|e| {
    eprintln!("Kraken config invalid: {e}");
    std::process::exit(1);
});

Prevention

When it happens

Trigger: Configuring the Kraken adapter with `product_type: Spot` and `environment: Demo`; caught when the config's `validate()` (via `validate_product_environment`) runs during client construction.

Common situations: Reusing a Futures demo config for Spot; assuming a Spot paper-trading endpoint exists; testing setups copied from other adapters.

Related errors


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