nautechsystems/nautilus_trader · error

Venue '{venue_name}' has book_type {:?} but no order book da

Error message

Venue '{venue_name}' has book_type {:?} but no order book data configured

What it means

A venue is configured with a non-null order book type (e.g. L1/L2/L3), but no order book data (data config covering book/quote data for that venue) was added to the backtest. The engine validates that any venue declaring a book type can actually be fed book data.

Source

Thrown at crates/backtest/src/node.rs:373

            );

            if needs_book_data {
                let venue_name = venue_config.name().to_string();
                let has_book_data = config.data().iter().any(|dc| {
                    let is_book_type = matches!(
                        dc.data_type(),
                        NautilusDataType::OrderBookDelta | NautilusDataType::OrderBookDepth10
                    );

                    if !is_book_type {
                        return false;
                    }

                    // Unfiltered config (no instrument filter) covers all venues
                    let ids = dc.get_instrument_ids().unwrap_or_default();
                    ids.is_empty() || ids.iter().any(|id| id.venue.to_string() == venue_name)
                });
                anyhow::ensure!(
                    has_book_data,
                    "Venue '{venue_name}' has book_type {:?} but no order book data configured",
                    venue_config.book_type()
                );
            }
        }
    }
    Ok(())
}

fn run_oneshot(engine: &mut BacktestEngine, config: &BacktestRunConfig) -> anyhow::Result<()> {
    for data_config in config.data() {
        let data = load_data(data_config, config.start(), config.end())?;
        if data.is_empty() {
            log::warn!("No data found for config: {:?}", data_config.data_type());
            continue;
        }
        engine.add_data(data, data_config.client_id(), false, false)?;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Add order book data for the venue via node.add_data(...) with a data config covering the venue's instruments.
  2. If no book modeling is needed, change the venue's book_type to NoBook (or omit it) in the venue config.
  3. Check that the data config's instrument filter is not empty/excluding the venue's instrument IDs.

Example fix

// before
node.add_venue(venue_builder().book_type(BookType::L2_MBP)); // no book data added
// after
node.add_venue(venue_builder().book_type(BookType::L2_MBP));
node.add_data(book_l2_data_for_venue());
Defensive patterns

Strategy: validation

Validate before calling

# python side, before building the node
for venue_cfg in venue_configs:
    if venue_cfg.book_type != BookType.NO_BOOK:
        assert any(d.covers_book_data_for(venue_cfg.name) for d in data_configs), \
            f"venue {venue_cfg.name} needs book data"

Try / catch

try:
    node = BacktestNode(config)
except ValueError as e:
    if "no order book data configured" in str(e):
        raise SystemExit(f"Add book data or set book_type=NO_BOOK: {e}")
    raise

Prevention

When it happens

Trigger: Calling BacktestNode::new with a venue configured with book_type L1_MBP/L2_MBP/L3_MBP while no data config with book data (or no data config whose instrument IDs include that venue) was added via add_data.

Common situations: Configuring book_type for a venue but forgetting to load/order L1 or L2 book data; data added only for other venues; instrument-filtered data configs that exclude the venue's instruments so the coverage check fails.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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