nautechsystems/nautilus_trader · error
VIP level {vip} insufficient for 50 depth subscription (requ
Error message
VIP level {vip} insufficient for 50 depth subscription (requires VIP4) What it means
OKX restricts the 50-level depth book channel to VIP4 and above accounts. The client queries the account's VIP level and refuses the subscription when the tier is too low, since OKX would reject it server-side.
Source
Thrown at crates/adapters/okx/src/websocket/client.rs:1434
///
/// # Errors
///
/// Returns an error if:
/// - Subscription request fails
/// - depth is 50 but VIP level is below 4
pub async fn subscribe_book_with_depth(
&self,
instrument_id: InstrumentId,
depth: u16,
) -> anyhow::Result<()> {
let vip = self.vip_level();
if !matches!(depth, 0 | 50 | 400) {
anyhow::bail!("Invalid depth {depth}, must be 0, 50, or 400");
}
if depth == 50 && vip < OKXVipLevel::Vip4 {
anyhow::bail!("VIP level {vip} insufficient for 50 depth subscription (requires VIP4)");
}
let channel = select_book_channel(depth as usize, vip);
self.subscribe_inst_id(ws_channel_for_book(channel), instrument_id.symbol.inner())
.await?;
Ok(())
}
/// Subscribes to best bid/ask quote data for an instrument.
///
/// Provides tick-by-tick updates of the best bid and ask prices using the bbo-tbt channel.
/// Supports all instrument types: SPOT, MARGIN, SWAP, FUTURES, OPTION.
///
/// # Errors
///
/// Returns an error if the subscription request fails.
///
/// # ReferencesView on GitHub (pinned to 18893faf8b)
Solutions
- Use depth 0 or 400, which have no VIP requirement
- Upgrade the OKX account to VIP4 if 50-level depth is truly required
- Configure the depth per account tier in your environment config
Example fix
// before client.subscribe_book(instrument_id, 50).await?; // after client.subscribe_book(instrument_id, 400).await?; // no VIP gate
Defensive patterns
Strategy: validation
Validate before calling
if depth == 50 && client.vip_level() < OKXVipLevel::Vip4 {
depth = 400; // fall back to an ungated depth
} Prevention
- Match requested depth to the account tier configured per environment
- Check OKX VIP tier requirements before enabling 50-level book subscriptions
When it happens
Trigger: Subscribing with depth=50 while the configured OKX API key belongs to an account below VIP4 (vip_level() returns < Vip4).
Common situations: Retail accounts copying institutional configs; a demo/test account with lower tier being used with a production config that requests depth 50.
Understand the failure class
Background: "You do not have permission" / 403 Forbidden errors: authenticated but not allowed — causes and fixes across open-source libraries — this error's family across 31 libraries.
Related errors
- Invalid `BarSpecification` for channel, was {bar_spec}
- errors.join("; ")
- Timeout waiting for account {account_id} to be registered af
- `api_key`, `api_secret`, `api_passphrase` credentials must b
- Cannot connect while previous WebSocket handler task is stil
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/51279867c4af16c6.
Report an issue: GitHub.