Merge pull request #412 from tiagosiebler/demowspublic
fix(v3.10.31, #411): demo trading wss should only be used for private topics.
This commit is contained in:
@@ -20,6 +20,7 @@ const logger = {
|
|||||||
const wsClient = new WebsocketClient(
|
const wsClient = new WebsocketClient(
|
||||||
{
|
{
|
||||||
market: 'v5',
|
market: 'v5',
|
||||||
|
// demoTrading: true,
|
||||||
},
|
},
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.30",
|
"version": "3.10.31",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.30",
|
"version": "3.10.31",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.6.6",
|
"axios": "^1.6.6",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"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.",
|
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
|||||||
@@ -406,12 +406,7 @@ export function getWsUrl(
|
|||||||
return wsUrl;
|
return wsUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://bybit-exchange.github.io/docs/v5/demo
|
|
||||||
const isDemoTrading = wsClientOptions.demoTrading;
|
const isDemoTrading = wsClientOptions.demoTrading;
|
||||||
if (isDemoTrading) {
|
|
||||||
return 'wss://stream-demo.bybit.com/v5/private';
|
|
||||||
}
|
|
||||||
|
|
||||||
const isTestnet = wsClientOptions.testnet;
|
const isTestnet = wsClientOptions.testnet;
|
||||||
const networkKey = isTestnet ? 'testnet' : 'livenet';
|
const networkKey = isTestnet ? 'testnet' : 'livenet';
|
||||||
|
|
||||||
@@ -475,6 +470,11 @@ export function getWsUrl(
|
|||||||
return WS_BASE_URL_MAP.contractUSDT.public[networkKey];
|
return WS_BASE_URL_MAP.contractUSDT.public[networkKey];
|
||||||
}
|
}
|
||||||
case WS_KEY_MAP.v5Private: {
|
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];
|
return WS_BASE_URL_MAP.v5.private[networkKey];
|
||||||
}
|
}
|
||||||
case WS_KEY_MAP.v5SpotPublic: {
|
case WS_KEY_MAP.v5SpotPublic: {
|
||||||
|
|||||||
Reference in New Issue
Block a user