ccxws icon indicating copy to clipboard operation
ccxws copied to clipboard

[Bug]Bitmex Client cannot handle quote message because of undefined property

Open purplesmoke05 opened this issue 3 years ago • 2 comments

Hi. I love this repository and I found a bug. I got below error message...

https://github.com/altangent/ccxws/blob/c7908b43d55a82c76b4ae9c851c5b76a94352e0c/src/exchanges/bitmex-client.js#L436

| TypeError: Cannot read property 'symbol' of undefined
|     at BitmexClient._onQuoteMessage (/app/node_modules/ccxws/src/exchanges/bitmex-client.js:436:33)
|     at BitmexClient._onMessage (/app/node_modules/ccxws/src/exchanges/bitmex-client.js:123:12)
|     at SmartWss.<anonymous> (/app/node_modules/ccxws/src/basic-client.js:191:16)
|     at SmartWss.emit (events.js:310:20)
|     at WebSocket.<anonymous> (/app/node_modules/ccxws/src/smart-wss.js:78:43)
|     at WebSocket.emit (events.js:310:20)
|     at Receiver.receiverOnMessage (/app/node_modules/ws/lib/websocket.js:825:20)
|     at Receiver.emit (events.js:310:20)
|     at Receiver.dataMessage (/app/node_modules/ws/lib/receiver.js:437:14)

purplesmoke05 avatar Dec 30 '20 15:12 purplesmoke05

Hi, thanks for submitting an issue! Can you provide the market you were subscribing to when this happened?

bmancini55 avatar Dec 30 '20 18:12 bmancini55

I was subscribing random symbols so I debugged. And I found messages websocket received below. It seems that messages symbol contain "." character have no data field, so I do not have to subscribe these symbols...

'{"table":"quote","action":"partial","keys":[],"types":{"timestamp":"timestamp","symbol":"symbol","bidSize":"long","bidPrice":"float","askPrice":"float","askSize":"long"},"foreignKeys":{"symbol":"instrument"},"attributes":{"timestamp":"sorted","symbol":"grouped"},"filter":{"symbol":".BADAXBT"},"data":[]}'

'{"table":"quote","action":"partial","keys":[],"types":{"timestamp":"timestamp","symbol":"symbol","bidSize":"long","bidPrice":"float","askPrice":"float","askSize":"long"},"foreignKeys":{"symbol":"instrument"},"attributes":{"timestamp":"sorted","symbol":"grouped"},"filter":{"symbol":".BXRPXBT30M"},"data":[]}'

'{"table":"quote","action":"partial","keys":[],"types":{"timestamp":"timestamp","symbol":"symbol","bidSize":"long","bidPrice":"float","askPrice":"float","askSize":"long"},"foreignKeys":{"symbol":"instrument"},"attributes":{"timestamp":"sorted","symbol":"grouped"},"filter":{"symbol":".BXRPXBT_NEXT"},"data":[]}'

'{"table":"quote","action":"partial","keys":[],"types":{"timestamp":"timestamp","symbol":"symbol","bidSize":"long","bidPrice":"float","askPrice":"float","askSize":"long"},"foreignKeys":{"symbol":"instrument"},"attributes":{"timestamp":"sorted","symbol":"grouped"},"filter":{"symbol":".BETHXBT"},"data":[]}'

'{"table":"quote","action":"partial","keys":[],"types":{"timestamp":"timestamp","symbol":"symbol","bidSize":"long","bidPrice":"float","askPrice":"float","askSize":"long"},"foreignKeys":{"symbol":"instrument"},"attributes":{"timestamp":"sorted","symbol":"grouped"},"filter":{"symbol":".BADAT"},"data":[]}'

'{"table":"quote","action":"partial","keys":[],"types":{"timestamp":"timestamp","symbol":"symbol","bidSize":"long","bidPrice":"float","askPrice":"float","askSize":"long"},"foreignKeys":{"symbol":"instrument"},"attributes":{"timestamp":"sorted","symbol":"grouped"},"filter":{"symbol":".BXRP_NEXT"},"data":[]}'

'{"table":"quote","action":"partial","keys":[],"types":{"timestamp":"timestamp","symbol":"symbol","bidSize":"long","bidPrice":"float","askPrice":"float","askSize":"long"},"foreignKeys":{"symbol":"instrument"},"attributes":{"timestamp":"sorted","symbol":"grouped"},"filter":{"symbol":".XBT"},"data":[]}'

purplesmoke05 avatar Dec 31 '20 17:12 purplesmoke05