nautechsystems/nautilus_trader · error

SPOT wallet balances carry no pair identity and cannot be at

Error message

SPOT wallet balances carry no pair identity and cannot be attributed for a bulk position report request

What it means

SPOT on Bybit has no positions, so the adapter synthesizes position reports from wallet balances. A bulk (no instrument_id) SPOT position report request cannot attribute balances to pairs, so the adapter bails when the spot-position-reports flag is enabled but no specific instrument ID is given.

Source

Thrown at crates/adapters/bybit/src/http/client.rs:4705

    /// # Errors
    ///
    /// This function returns an error if the request fails, or if SPOT position reports are enabled
    /// and no instrument is specified, because wallet balances carry no pair identity.
    ///
    /// # References
    ///
    /// <https://bybit-exchange.github.io/docs/v5/position>
    pub async fn request_position_status_reports(
        &self,
        account_id: AccountId,
        product_type: BybitProductType,
        instrument_id: Option<InstrumentId>,
    ) -> anyhow::Result<Vec<PositionStatusReport>> {
        // Handle SPOT position reports via wallet balances if flag is enabled
        if product_type == BybitProductType::Spot {
            if self.use_spot_position_reports.load(Ordering::Relaxed) {
                let Some(instrument_id) = instrument_id else {
                    anyhow::bail!(
                        "SPOT wallet balances carry no pair identity and cannot be attributed for a bulk position report request"
                    );
                };
                return self
                    .generate_spot_position_reports_from_wallet(account_id, instrument_id)
                    .await;
            } else {
                // Return empty vector when SPOT position reports are disabled
                return Ok(Vec::new());
            }
        }

        let ts_init = self.generate_ts_init();
        let mut reports = Vec::new();

        // Build query parameters based on whether a specific instrument is requested
        let symbol = if let Some(id) = instrument_id {
            let symbol_str = id.symbol.as_str();

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Pass a specific instrument_id when requesting SPOT position reports
  2. Iterate over your SPOT instruments and request one report per instrument
  3. Disable use_spot_position_reports if bulk behavior is expected and SPOT positions are not needed

Example fix

// before
client.generate_position_status_reports(account_id, BybitProductType::Spot, None).await?;
// after
for id in spot_instruments {
    client.generate_position_status_reports(account_id, BybitProductType::Spot, Some(id)).await?;
}
Defensive patterns

Strategy: validation

Validate before calling

anyhow::ensure!(
    !(product_type == BybitProductType::Spot && instrument_id.is_none()),
    "SPOT position reports require a specific instrument_id"
);

Prevention

When it happens

Trigger: Calling generate_position_status_reports (or the reconciliation path) with product_type Spot, use_spot_position_reports enabled, and instrument_id = None.

Common situations: Full account reconciliation that requests all position reports without instrument filter on a SPOT account; enabling the spot reports flag but leaving the bulk request path in place.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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