tiagosiebler / bybit-api

Node.js SDK for the Bybit APIs and WebSockets, with TypeScript & browser support.
https://www.npmjs.com/package/bybit-api
MIT License
244 stars 80 forks source link

failed to subscribe #336

Closed Knaackee closed 4 months ago

Knaackee commented 4 months ago

At first, thanks for the great work.

I am getting the following error. Any idea ?

[
  'Websocket connected',
  {
    category: 'bybit-ws',
    wsKey: 'v5Private',
    testnet: true,
    market: 'v5'
  }
]
connection opened open: v5Private
[ 'Sending auth request...' ]
[
  "Getting auth'd request params",
  { category: 'bybit-ws', wsKey: 'v5Private' }
]
[
  'Subscribing to topics',
  { category: 'bybit-ws', wsKey: 'v5Private', topics: [ 'position' ] }
]
"(position) failed to subscribe"
tiagosiebler commented 4 months ago

Hi @Knaackee - you have testnet set to true, are your API keys for testnet?

Most of the time it's something wrong with your API keys. The WS client also emits error events for something like this, there might be more information there on the failure. Recommend adding an error event listener if you haven't already:

 wsClient.on('error', (data) => {
   console.error('ws exception: ', data);
 });
Knaackee commented 4 months ago

I had the wrong keys. Thank you!