fix(v4.0.0-beta.4): demo trading wss should only be used for private connections
This commit is contained in:
@@ -17,7 +17,12 @@ const logger = {
|
||||
* - Heartbeats/ping/pong/reconnects are all handled automatically.
|
||||
* If a connection drops, the client will clean it up, respawn a fresh connection and resubscribe for you.
|
||||
*/
|
||||
const wsClient = new WebsocketClient({}, logger);
|
||||
const wsClient = new WebsocketClient(
|
||||
{
|
||||
// demoTrading: true,
|
||||
},
|
||||
logger,
|
||||
);
|
||||
|
||||
wsClient.on('update', (data) => {
|
||||
console.log('raw message received ', JSON.stringify(data));
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "bybit-api",
|
||||
"version": "4.0.0-beta.3",
|
||||
"version": "4.0.0-beta.4",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "bybit-api",
|
||||
"version": "4.0.0-beta.3",
|
||||
"version": "4.0.0-beta.4",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^1.7.9",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bybit-api",
|
||||
"version": "4.0.0-beta.3",
|
||||
"version": "4.0.0-beta.4",
|
||||
"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",
|
||||
|
||||
@@ -241,7 +241,7 @@ export function getWsUrl(
|
||||
}
|
||||
|
||||
// https://bybit-exchange.github.io/docs/v5/demo
|
||||
const demoTradingPrivateEndpoint = 'wss://stream-demo.bybit.com/v5/private';
|
||||
const DEMO_TRADING_ENDPOINT = 'wss://stream-demo.bybit.com/v5/private';
|
||||
|
||||
const isDemoTrading = wsClientOptions.demoTrading;
|
||||
const isTestnet = wsClientOptions.testnet;
|
||||
@@ -250,13 +250,13 @@ export function getWsUrl(
|
||||
switch (wsKey) {
|
||||
case WS_KEY_MAP.v5Private: {
|
||||
if (isDemoTrading) {
|
||||
return demoTradingPrivateEndpoint;
|
||||
return DEMO_TRADING_ENDPOINT;
|
||||
}
|
||||
return WS_BASE_URL_MAP.v5.private[networkKey];
|
||||
}
|
||||
case WS_KEY_MAP.v5PrivateTrade: {
|
||||
if (isDemoTrading) {
|
||||
return demoTradingPrivateEndpoint;
|
||||
return DEMO_TRADING_ENDPOINT;
|
||||
}
|
||||
return WS_BASE_URL_MAP[wsKey].private[networkKey];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user