altangent / ccxws

WebSocket client for 38 cryptocurrency exchanges
MIT License
619 stars 187 forks source link

[Bug]Kucoin Client cannot handle ticker message #234

Open purplesmoke05 opened 3 years ago

purplesmoke05 commented 3 years ago

Hi, thank you for good library, I found error message below. It seems that "changePrice" and "changeRate" type is string.

TypeError: Cannot read property 'toFixed' of undefined
    at KucoinClient._processTicker (/workspace/node_modules/ccxws/src/exchanges/kucoin-client.js:431:27)
    at KucoinClient._processMessage (/workspace/node_modules/ccxws/src/exchanges/kucoin-client.js:295:12)
    at KucoinClient._onMessage (/workspace/node_modules/ccxws/src/exchanges/kucoin-client.js:262:14)
    at SmartWss.<anonymous> (/workspace/node_modules/ccxws/src/exchanges/kucoin-client.js:117:14)
    at SmartWss.emit (events.js:310:20)
    at WebSocket.<anonymous> (/workspace/node_modules/ccxws/src/smart-wss.js:78:43)
    at WebSocket.emit (events.js:310:20)
    at Receiver.receiverOnMessage (/workspace/node_modules/ws/lib/websocket.js:825:20)
    at Receiver.emit (events.js:310:20)
    at Receiver.dataMessage (/workspace/node_modules/ws/lib/receiver.js:437:14)

Screenshot from 2021-01-01 03-14-49

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