diff --git a/examples/ws-public-v5.ts b/examples/ws-public-v5.ts index 9a8dff82..e7b08e47 100644 --- a/examples/ws-public-v5.ts +++ b/examples/ws-public-v5.ts @@ -20,6 +20,7 @@ const logger = { const wsClient = new WebsocketClient( { market: 'v5', + // demoTrading: true, }, logger, ); diff --git a/package-lock.json b/package-lock.json index d0632e66..3f9ed248 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bybit-api", - "version": "3.10.30", + "version": "3.10.31", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bybit-api", - "version": "3.10.30", + "version": "3.10.31", "license": "MIT", "dependencies": { "axios": "^1.6.6", diff --git a/package.json b/package.json index 6d71d267..35bdc940 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bybit-api", - "version": "3.10.30", + "version": "3.10.31", "description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/util/websocket-util.ts b/src/util/websocket-util.ts index b6084d34..5b3c02d1 100644 --- a/src/util/websocket-util.ts +++ b/src/util/websocket-util.ts @@ -406,12 +406,7 @@ export function getWsUrl( return wsUrl; } - // https://bybit-exchange.github.io/docs/v5/demo const isDemoTrading = wsClientOptions.demoTrading; - if (isDemoTrading) { - return 'wss://stream-demo.bybit.com/v5/private'; - } - const isTestnet = wsClientOptions.testnet; const networkKey = isTestnet ? 'testnet' : 'livenet'; @@ -475,6 +470,11 @@ export function getWsUrl( return WS_BASE_URL_MAP.contractUSDT.public[networkKey]; } case WS_KEY_MAP.v5Private: { + // https://bybit-exchange.github.io/docs/v5/demo + if (isDemoTrading) { + return 'wss://stream-demo.bybit.com/v5/private'; + } + return WS_BASE_URL_MAP.v5.private[networkKey]; } case WS_KEY_MAP.v5SpotPublic: {