{"record":{"id":"51279867c4af16c6","repo":"nautechsystems/nautilus_trader","slug":"vip-level-vip-insufficient-for-50-depth-subscrip","errorCode":null,"errorMessage":"VIP level {vip} insufficient for 50 depth subscription (requires VIP4)","messagePattern":"VIP level (.+?) insufficient for 50 depth subscription \\(requires VIP4\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/okx/src/websocket/client.rs","lineNumber":1434,"sourceCode":"    ///\n    /// # Errors\n    ///\n    /// Returns an error if:\n    /// - Subscription request fails\n    /// - depth is 50 but VIP level is below 4\n    pub async fn subscribe_book_with_depth(\n        &self,\n        instrument_id: InstrumentId,\n        depth: u16,\n    ) -> anyhow::Result<()> {\n        let vip = self.vip_level();\n\n        if !matches!(depth, 0 | 50 | 400) {\n            anyhow::bail!(\"Invalid depth {depth}, must be 0, 50, or 400\");\n        }\n\n        if depth == 50 && vip < OKXVipLevel::Vip4 {\n            anyhow::bail!(\"VIP level {vip} insufficient for 50 depth subscription (requires VIP4)\");\n        }\n\n        let channel = select_book_channel(depth as usize, vip);\n        self.subscribe_inst_id(ws_channel_for_book(channel), instrument_id.symbol.inner())\n            .await?;\n        Ok(())\n    }\n\n    /// Subscribes to best bid/ask quote data for an instrument.\n    ///\n    /// Provides tick-by-tick updates of the best bid and ask prices using the bbo-tbt channel.\n    /// Supports all instrument types: SPOT, MARGIN, SWAP, FUTURES, OPTION.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the subscription request fails.\n    ///\n    /// # References","sourceCodeStart":1416,"sourceCodeEnd":1452,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/okx/src/websocket/client.rs#L1416-L1452","documentation":"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.","triggerScenarios":"Subscribing with depth=50 while the configured OKX API key belongs to an account below VIP4 (vip_level() returns < Vip4).","commonSituations":"Retail accounts copying institutional configs; a demo/test account with lower tier being used with a production config that requests depth 50.","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"],"exampleFix":"// before\nclient.subscribe_book(instrument_id, 50).await?;\n// after\nclient.subscribe_book(instrument_id, 400).await?; // no VIP gate","handlingStrategy":"validation","validationCode":"if depth == 50 && client.vip_level() < OKXVipLevel::Vip4 {\n    depth = 400; // fall back to an ungated depth\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match requested depth to the account tier configured per environment","Check OKX VIP tier requirements before enabling 50-level book subscriptions"],"tags":["okx","websocket","permissions"],"backgroundTag":"insufficient-permissions","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}