* Classify a futures stream endpoint into public, market, or private category * per Binance USDⓈ-M Futures WebSocket URL split (2026-03-06)
(endpoint: string)
| 300 | * per Binance USDⓈ-M Futures WebSocket URL split (2026-03-06) |
| 301 | */ |
| 302 | classifyFuturesStream(endpoint: string): 'public' | 'market' | 'private' { |
| 303 | // Public: bookTicker and depth streams (high-frequency) |
| 304 | if (endpoint.includes('@bookTicker') || endpoint === '!bookTicker' |
| 305 | || endpoint.includes('@depth')) { |
| 306 | return 'public'; |
| 307 | } |
| 308 | // Private: listenKey is a long alphanumeric string (60+ chars, no @ or !) |
| 309 | if (/^[A-Za-z0-9]{20,}$/.test(endpoint)) { |
| 310 | return 'private'; |
| 311 | } |
| 312 | // Market: aggTrade, markPrice, kline, ticker, miniTicker, forceOrder, etc. |
| 313 | return 'market'; |
| 314 | } |
| 315 | |
| 316 | getFStreamSingleUrl(category?: 'public' | 'market' | 'private') { |
| 317 | if (category) { |
no outgoing calls
no test coverage detected