altangent / ccxws Goto Github PK
View Code? Open in Web Editor NEWWebSocket client for 38 cryptocurrency exchanges
License: MIT License
WebSocket client for 38 cryptocurrency exchanges
License: MIT License
Coinex hangs when you subscribe to all markets, Gate.io limits to 50 requests/sec. We need to add a semaphore to throttle subscriptions inside of BasicMultiClient.
Semaphore will need to wait connection connection of the BasicClient before moving releasing the semaphore.
OKEx disconnection after 10s or so. May be ping related. Or may need a semaphore to throttle large subscribes.
Exchange
ALL
Subscription type
AlLL
Describe the bug
ccxt uses [BASE]/[QUOTE] for pair symbols / id, are we able to follow as well?
for Bibox currently, one needs to pass in [BASE]_[QUOTE] to work...
internally, there should be a function to convert from ccxt symbol / id, to the one used by the exchange.
I can do it for bibox and make change if you wish, every public facing function on the exchange with market as input parameter will need to have the conversion if the format is not [BASE]/[QUOTE]
To Reproduce
Steps to reproduce the behavior:
use ETH/BTC as market id
Expected behavior
There will be error similar to "channel not valid" in chinese
Additional context
N.A.
First of all thank you for the amazing integration across various exchanges.
I looked through the code and see subscribeTicker, subscribeTrade etc but dont find klines anywhere. Do you have any plans of integrating klines from each exchange?
Thannks
Exchange
OKEx
Describe the bug
OKEx v1 feeds are no longer available. The new API documentation states
Please note that the current version of this document is v3 and it will be updated regularly. Traders are advised to check this document from time to time for latest updates.
So it looks like the library needs to migrate to the new API since the old one is offline now.
New documentation: https://www.okex.com/docs/en/#spot_ws-general
The V3 API uses the V3 REST API, this corresponds ot the okex3 ccxt client as well.
Exchange
OKEx
Subscription type
All
Describe the bug
Reconnection error with bad JSON causes process crash.
2018-10-30T04:39:42.949Z - info: connected to wss://real.okex.com:10441/websocket
undefined:1
-�A
^
SyntaxError: Unexpected token � in JSON at position 1
at JSON.parse (<anonymous>)
at OKExClient._onMessage (/usr/src/trades/trade-engine/node_modules/ccxws/src/exchanges/okex-client.js:116:21)
at emitOne (events.js:116:13)
at SmartWss.emit (events.js:211:7)
at WebSocket._wss.on.msg (/usr/src/trades/trade-engine/node_modules/ccxws/src/smart-wss.js:70:43)
at emitOne (events.js:116:13)
at WebSocket.emit (events.js:211:7)
at Receiver.receiverOnMessage (/usr/src/trades/trade-engine/node_modules/ws/lib/websocket.js:720:20)
at emitOne (events.js:116:13)
at Receiver.emit (events.js:211:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node src`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-10-30T04_39_43_198Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @blocktap/[email protected] engine: `cd trade-engine; npm start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @blocktap/[email protected] engine script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-10-30T04_39_43_208Z-debug.log
Exchange API URL
https://github.com/coinsuperapi?tab=repositories
Additional information about Websocket connection
Looks to support Tickers, Trades, and L2 Updates (+Snapshot at start)
Requires using an API key to connect.
Refer to Contributing Guide for additional information.
src/exchanges
that follows CCXWS library interface (refer to README)src/exchanges
to validate subscribe/unsubscribe methods and that data parsing is correctindex.js
Top 1 volume on Coinmarketcap right now.
Exchange URL
https://bitmax.io
Exchange API URL
https://bitmax-exchange.github.io/bitmax-pro-api/#websocket
Refer to Contributing Guide for additional information.
Exchange
Bitfinex
Subscription type
Level2 orderbook updates
Describe the bug
Library returns channel number as a price of the update (557880.00000000 price for BTC/USDT pair)
Expected behavior
A clear and concise description of what you expected to happen.
Additional context
Bitfinex returns for updates [ channel_id, price, count, amout ]
, and the current code parses it as: let [price, count, size] = msg;
Refactor integration test to be fixture based. We should run consistent tests between exchanges. Fixtures should control what features are allowed and what the expected outputs are for each object type
We should also migrate away from jest in factor of mocha + chai + sinon. The rationale for this change is to remove the massive dependency bloat caused by jest. Migrated fixture tests should be done with mocha.
Bitstamp will end support in the next few months on its existing WS feed.
https://www.bitstamp.net/article/new-websocket/
Documentation for new feed:
https://www.bitstamp.net/websocket/v2/
Bitstamp uses its implementation of websocket server for real time data streaming. Server is accessible on the following address: wss://ws.bitstamp.net.
Huobi, for some reason is using 21 digit ints (https://api.huobi.pro/market/trade?symbol=btcusdt) which inexplicably even overflows unsigned 64-bit ints (max value 18446744073709552000). So we'll need to use something like https://www.npmjs.com/package/json-bignum to perform the deserialization without precision loss.
Please provide as much information as possible to make the addition of the exchange easier:
Exchange URL
Exchange API URL
https://github.com/Biboxcom/API_Docs_en/wiki/WS_API_Reference
Additional information about Websocket connection
Ticker: https://github.com/Biboxcom/API_Docs_en/wiki/WS_API_Reference#subscribe-ticker-bibox_sub_spot_pair_ticker
Trades: https://github.com/Biboxcom/API_Docs_en/wiki/WS_API_Reference#subscribe-deals-bibox_sub_spot_pair_deals
L2 Snapshots: https://github.com/Biboxcom/API_Docs_en/wiki/WS_API_Reference#subscribe-depth-bibox_sub_spot_pair_depth
Does not appear to have L2 updates, only snapshots, but will want to verify this.
Implementation similar to OKEx, will need to run inflate on payload.
Refer to Contributing Guide for additional information.
src/exchanges
that follows CCXWS library interface (refer to README)src/exchanges
to validate subscribe/unsubscribe methods and that data parsing is correctindex.js
Exchange
Bittrex
Subscription type
Trades, Level2 orderbook updates for BTC/LTC
Describe the bug
Received an error in invoking Hub method 'corehub.QueryExchangeState'. Might be a SignalR hub issue.
To Reproduce
Steps to reproduce the behaviour:
Error:
info: cloudflare connection to https://bittrex.com/
info: subscribing to level2 updates Bittrex BTCLTC
info: connected to wss://socket.bittrex.com/signalr
error: snapshot failed BTCLTC There was an error invoking Hub method 'corehub.QueryExchangeState'.
error: subscribe failed BTCLTC There was an error invoking Hub method 'corehub.SubscribeToExchangeDeltas'.
Here's the code snippet:
async subscribe(intent, uuid, full_instrument){
this.bittrexClient = new ccxws.bittrex();
let market = {
id: "BTC-LTC",
base: "LTC",
quote: "BTC",
};
this.bittrexClient.subscribeLevel2Updates(market);
this.bittrexClient.on("l2updates", snapshot => console.log(snapshot));
}
Expected behavior
Expected to receive and print JSON objects of the bids and asks price from Bittrex exchange to the console.
Refer to: https://www.zb.com/i/developer/websocketApi#config
Supports tickers, l2 orderbooks, and trades.
Should be implemented via BasicClient with minimal customization required.
Exchange
All exchanges that support tickers
Subscription type
ticker
Describe the bug
The last update time kept internally in the watcher is not updated on ticker
events, therefore clients that only subscribe to those are reconnected every 90 seconds.
To Reproduce
ticker
event with a client that supports that (e.g. the Bittrex one)info: watcher initiating reconnection
then disconnects and reconnects the client.Expected behavior
The client connection should be kept alive by ticker
messages as well
Additional context
I'll provide a PR to fix the issue. In case this behaviour was intentional, I'll find a way around the problem :)
Exchange
kraken
Subscription type
L2updates and L2snapshots
Describe the bug
bitfinex/kraken have different updates. When using bitfinex and L2updates and L2snapshots, i get a working, valid orderbook. When I use kraken in the same system, it doesnt work/update. What is going on there? Do i need to incorporate trades?
** steps to reproduce**
cant really reproduce as its production code, but is there documentation missing? I'm leaning towards implementing the websockets of kraken myself as binance and bitfinex both work but kraken is just not working properly.
Is there something i'm missing?
Exchange
Bitmex
Subscription type
Level2 orderbook updates
Describe the bug
Bitmex uses the symbol to uniquely identify contracts in the bitmex-client, lines 92 to 131, the symbol is used to set a market variable, but the symbol is ignored when creating the l2snapshot or l2update. This means that the term of the bitmex contract is ignored, as that resides in the symbol as opposed to inside the base and quote identifiers.
We need the symbol to propagate through on the l2update and l2snapshot.
To Reproduce
Steps to reproduce the behavior:
Run the bitmex client
l2Update and l2snapshot do not have symbol
Expected behavior
l2update and l2snapshot should have symbol
Additional context
Add any other context about the problem here.
Poloniex will silently drop the socket connection without triggering reconnection logic. Investigate whether their API supports a ping/pong mechanism.
Please provide as much information as possible to make the addition of the exchange easier:
Exchange URL
https://idex.market/
Exchange API URL
https://docs.idex.market/
Additional information about Websocket connection
Refer to Contributing Guide for additional information.
src/exchanges
that follows CCXWS library interface (refer to README)src/exchanges
to validate subscribe/unsubscribe methods and that data parsing is correctindex.js
When I try to get data by your lib, I geting warnings like this:
This is how I try to fetch data:
const ccxws = require("ccxws");
export default function wsUpdate() {
const binance = new ccxws.Binance();
const market = {
id: "USDT-BTC", // remote_id used by the exchange
base: "BTC", // standardized base symbol for Cardano
quote: "USDT" // standardized quote symbol for Bitcoin
};
binance.subscribeTrades(market);
binance.on("trades", trade => console.log(trade));
}
Exchange Name
CEX.io
Exchange API URL
https://cex.io/websocket-api-dsl
wss://ws.cex.io/ws
Describe the technology used by the exchange use for realtime updates?
Does each market require it own connection?
No
Describe how subscriptions occur
Standard subscription payload as shown below. However, there are two modes for accessing data. You can use the "Old Pair-Room Subscription" to access a partial order book, trades, and ticker. You need to be authenticated to access the full order book subscription.
{
"e": "subscribe",
"rooms": [
"pair-BTC-USD"
]
}
Can you subscribe to tickers?
Yes, each market has its own ticker feed
Can you subscribe to candles?
Yes
Are trades and order book updates provided in a unified market feed?
Yes
There is the "Old Pair-Room Subscription" as described here:
This is the oldest subscription, on which Server is sending almost all public data to WebClient.
The data, in fact, represents Order Book, Market Depth, Trade History and History Updates, 1d OHLCV updates. Therefore, the subscription is overlapping with new OHLCV subscriptions, Order Book subscription for authenticated user.
Authenticated user can use either new, old or both.
There is also the authenticated order book feed that allow full depth snapshots and updates.
Can you subscribe to trades?
Yes, trades are broadcast as part of a unified market feed
Can you subscribe to level2 snapshots?
Yes, level2 snapshots are broadcast as part of an unified market feed - however this is only a partial orderbook
Yes, a level2 snapshot is broadcast at the start of level2 update subscription - authentication required
Can you subscribe to level2 updates?
Yes, there is a feed for level2 updates - authentication required
Can you subscribe to level3 snapshots?
No
Can you subscribe to level3 updates?
No
Exchange
Binance
Subscription type
Ticker
Describe the bug
The timestamp in the ticker message "is in microseconds", but should be in milliseconds according to the documentation. (all other exchanges report it in milliseconds).
To Reproduce
Expected behavior
The timestamp should be in milliseconds. Looking at the code I can see that the value retrieved from the Binance feed is then multiplied by 1000 (src/exchanges/binance-client.js:239
). Was this done on purpose or is it maybe a leftover from a previous version of the Binance API?
I can raise a PR to fix this if you agree that the * 1000
should be removed.
Cheers!
Exchange
Bittrex
Subscription type
trades
Describe the bug
crawler/node_modules/ccxws/src/exchanges/bittrex-client.js:216
onerror: err => winston.error("error", err).error,
^/src/exchanges/bittrex-client.js:216
onerror: err => winston.error("error", err).error,
^
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
Exchange URL
https://www.gate.io/
Exchange API URL
Tickers - https://www.gate.io/docs/websocket/index.html?javascript#ticker-api
Trades - https://www.gate.io/docs/websocket/index.html?javascript#trade-api
L2 Snapshot - https://www.gate.io/docs/websocket/index.html?javascript#depth-api
Describe the technology used by the exchange use for realtime updates?
Documentation: https://www.gate.io/docs/websocket/index.html?javascript#
Socket URL: wss://ws.gate.io/v3/
Uses JSON RPC
Uses Websockets
Simple WebSocket test
function socket_send_cmd(socket, cmd, params) {
if (!params)
params = [];
var msg = {
id: client_id,
method: cmd,
params: params
};
socket.send(JSON.stringify(msg));
}
var socket = new WebSocket('wss://ws.gate.io/v3');
socket.onopen = function () {
console.log("Connected");
socket_send_cmd(socket, 'trades.subscribe', ["ETH_USDT", "BTC_USDT"]);
};
socket.onmessage = function (e) {
console.log('Server: ' + e.data);
}
Refer to Contributing Guide for additional information.
src/exchanges
that follows CCXWS library interface (refer to README)src/exchanges
to validate subscribe/unsubscribe methods and that data parsing is correctindex.js
Last supported market for Poloniex appears to be 239. Need to add the new markets to the client's MARKET_IDS map. Refer to https://docs.poloniex.com/#currency-pair-ids
240 | USDC_XRP
241 | USDC_XMR
242 | USDC_STR
243 | USDC_DOGE
244 | USDC_LTC
245 | USDC_ZEC
246 | BTC_FOAM
247 | USDC_FOAM
248 | BTC_NMR
249 | BTC_POLY
250 | BTC_LPT
251 | BTC_GRIN
252 | USDC_GRIN
Please provide as much information as possible to make the addition of the exchange easier:
Exchange URL
https://www.bitmart.com/
Exchange API URL
https://github.com/bitmartexchange/api-docs/tree/master/websocket
Additional information about Websocket connection
Refer to Contributing Guide for additional information.
src/exchanges
that follows CCXWS library interface (refer to README)src/exchanges
to validate subscribe/unsubscribe methods and that data parsing is correctindex.js
Exchange Name
Coinex
Exchange URL
https://www.coinex.com/
Exchange API URL
Tickers - https://github.com/coinexcom/coinex_exchange_api/wiki/021ticker
Trades - https://github.com/coinexcom/coinex_exchange_api/wiki/045deals
L2 Snapshot - https://github.com/coinexcom/coinex_exchange_api/wiki/022depth
Describe the technology used by the exchange use for realtime updates?
Does each market require it own connection?
Yes
Describe how subscriptions occur
#Request
{
"method":"deals.subscribe",
"params":[
"BTCBCH" #1.market: See<API invocation description·market>
],
"id":16
}
It is standard JSON RPC subscribe. But it will unsubscribe if you subscribe to more than one feed per connection.
Can you subscribe to tickers?
Yes, each market has its own ticker feed
https://github.com/coinexcom/coinex_exchange_api/wiki/053state
Can you subscribe to candles?
Yes
https://github.com/coinexcom/coinex_exchange_api/wiki/046kline
Are trades and order book updates provided in a unified market feed?
No, it is 2 separate feeds
Market depth / orderbook - https://github.com/coinexcom/coinex_exchange_api/wiki/044depth
Transactions / trades / ticks/ match - https://github.com/coinexcom/coinex_exchange_api/wiki/045deals
Can you subscribe to trades?
Yes
https://github.com/coinexcom/coinex_exchange_api/wiki/045deals
Can you subscribe to level2 snapshots?
Yes, a level2 snapshot can be manually requested (Ex: Bittrex)
https://github.com/coinexcom/coinex_exchange_api/wiki/044depth
Can you subscribe to level2 updates?
Yes, there is a feed for level2 updates (Ex: Bitfinex)
https://github.com/coinexcom/coinex_exchange_api/wiki/044depth
Can you subscribe to level3 snapshots?
No
Can you subscribe to level3 updates?
No
Please provide as much information as possible to make the addition of the exchange easier:
Exchange API URL
https://docs.kucoin.com/#public-channels
Additional information about Websocket connection
Looks to support tickers, trades, l2 order book, and l3 order books
Refer to Contributing Guide for additional information.
src/exchanges
that follows CCXWS library interface (refer to README)src/exchanges
to validate subscribe/unsubscribe methods and that data parsing is correctindex.js
I using client.close() but it's auto resconnected!
The trade event should be outputting industry standard data:
Exchange
No
Subscription type
No
Describe the bug
Flaky tests caused when change/percentChange are negative. This will need to be fixed in all test files.
expect(Math.abs(parseFloat(ticker.change))).toBeGreaterThan(0);
expect(Math.abs(parseFloat(ticker.changePercent))).toBeGreaterThan(0);
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Tests should not be flaky
Screenshots
N/A
Desktop (please complete the following information):
N/A
Exchange
okex
Subscription type
Level2 orderbook updates
Describe the bug
Mismatch in exchanges id for ccxt
and ccxws
.
To Reproduce
We use ccxt
for fetching markets list and ccxws
to listen market data. If we get markets list from ccxt
for okex and then we subscribe to Level2 updates in ccxws
library - we get this error:
warn: failure response {"event":"error","message":"Channel spot/depth:eth_btc doesn't exist","errorCode":30040}
Expected behavior
Success subscription.
Additional context
In documentation ETH-BTC
market mentioned, as we see eth_btc
substituted in subscription.
okex3
exchange class fetches correct data
now, ccxws couldn't support tickers? have any roadmap?
Exchange API URL
https://github.com/fatbtc/fatbtc-api-websocket
Additional information about Websocket connection
Looks to support Tickers, Trades, and L2 orderbooks (not sure if snapshots or update+snapshot)
Refer to Contributing Guide for additional information.
src/exchanges
that follows CCXWS library interface (refer to README)src/exchanges
to validate subscribe/unsubscribe methods and that data parsing is correctindex.js
Ensure there is parity between the client name in ccxws and ccxt.
Exchange
Upbit
Subscription type
Trades
Describe the bug
Error parsing upbit json response, process exited on error.
This happened after a few successful days of consuming upbit trades socket.
I think node process should not stop on such kinds of errors?
info: connected to wss://api.upbit.com/websocket/v1
undefined:1
x�e�Mo�0
����-JB[5�Cڄh�=���6 !��>[[U}�_��?^���������P��v�۱�w���n(xJ!2ɥL�?�2ړA0.c��<���Ƌ4/8���,eAFW����ZdAx�͝�<g+�;$k�G��o��
Nڔ2���ꦟ\wY���
-��Q�!�S�cdN�v��w�QD�N ��խ��^yܜ��S?���b�
^
SyntaxError: Unexpected token x in JSON at position 0
at JSON.parse (<anonymous>)
at UpbitClient._onMessage (/usr/src/app/node_modules/ccxws/src/exchanges/upbit-client.js:72:17)
at emitOne (events.js:116:13)
at SmartWss.emit (events.js:211:7)
at WebSocket._wss.on.msg (/usr/src/app/node_modules/ccxws/src/smart-wss.js:70:43)
at emitOne (events.js:116:13)
at WebSocket.emit (events.js:211:7)
at Receiver.receiverOnMessage (/usr/src/app/node_modules/ws/lib/websocket.js:720:20)
at emitOne (events.js:116:13)
at Receiver.emit (events.js:211:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node ws.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-04-18T03_04_14_107Z-debug.log
To Reproduce
Steps to reproduce the behavior:
No idea, this fixed after restart and happened only once.
Expected behavior
Log error, but do not stop proccess
Following exchanges are missing the restart method:
This method should exist and restart any connections that exist. This also ensures uniformity of client interface.
Please provide as much information as possible to make the addition of the exchange easier:
Exchange API URL
https://www.kraken.com/features/websocket-api
Additional information about Websocket connection
ws.kraken.com - Once the socket is open you can subscribe to a channel by sending a subscribe request message.
Supports, ticker, ohlcv, trade, l2 orderbook updates (snapshot provided at start).
Refer to Contributing Guide for additional information.
src/exchanges
that follows CCXWS library interface (refer to README)src/exchanges
to validate subscribe/unsubscribe methods and that data parsing is correctindex.js
Please provide as much information as possible to make the addition of the exchange easier:
Exchange URL
https://www.ethfinex.com/api_docs
Exchange API URL
https://www.ethfinex.com/api_docs
Additional information about Websocket connection
Implements similar interface to Bitfinex. Client should be implemented in similar manner.
Refer to Contributing Guide for additional information.
src/exchanges
that follows CCXWS library interface (refer to README)src/exchanges
to validate subscribe/unsubscribe methods and that data parsing is correctindex.js
ccxws can export all class, make it easy for developers to extend.
for example:
ticker trade smart-wss.js etc..
Exchange API URL
https://github.com/bw-exchange/api_docs_en/wiki
https://github.com/bw-exchange/api_docs_en/wiki/WebSocket-API-Subscribe-instructions
https://github.com/bw-exchange/api_docs_en/wiki/WebSocket-API-Reference
Additional information about Websocket connection
Supports tickers, trades, and L2 orderbook with an initial snapshot.
Refer to Contributing Guide for additional information.
Notice the following error intermittently - but no auto reconnect after it occurs:
connecting to wss://stream.binance.com:9443/stream?streams=!ticker@arr
events.js:167
throw er; // Unhandled 'error' event
^
RangeError: Invalid WebSocket frame: invalid status code 1005
....
at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
Is it in the roadmap and if so when do you plan to release. Thank you for the great work.
Please provide as much information as possible to make the addition of the exchange easier:
Exchange URL
https://cobinhood.com
Exchange API URL
https://cobinhood.github.io/api-public/
Refer to Contributing Guide for additional information.
src/exchanges
that follows CCXWS library interface (refer to README)src/exchanges
to validate subscribe/unsubscribe methods and that data parsing is correctindex.js
Add a new column to the exchange table in the README after the exchange name column. This column will include the API version that the client supports, such as 1, 2, 3, etc.
v0.26.4
Exchange
Binance, Kraken, Coinbase Pro, Poloniex. This seems to be on every exchange but I haven't tried all of them
Subscription type
trades
Describe the bug
The "fullId" documented Trade event property is not included. This makes it difficult or impossible to know if the trade event is for the specific market you subscribed to if you've subscribed to multiple.
Here are a couple payloads received:
Trade {
exchange: 'CoinbasePro',
quote: 'ETH',
base: 'BTC',
tradeId: '8137331',
unix: 1565828460948,
side: 'buy',
price: '0.01861000',
amount: '0.02361238',
buyOrderId: '1a8ff9efbf64423a92fa24f8c867ead0',
sellOrderId: '9437194088d448a3af35aebb11584266' }
{
exchange: 'Binance',
quote: 'ETH',
base: 'BTC',
tradeId: '126287492',
unix: 1565828362478,
side: 'buy',
price: '0.01861000',
amount: '0.10600000',
buyOrderId: undefined,
sellOrderId: undefined }
Trade {
exchange: 'Kraken',
quote: 'ETH',
base: 'BTC',
tradeId: '1565828233337300000',
unix: 1565828233337,
side: 'buy',
price: '0.018590',
amount: '13.50000000',
buyOrderId: undefined,
sellOrderId: undefined,
rawUnix: '1565828233.337347' }
To Reproduce
this.ccxws.subscribeTrades(ccwxsMarket);
this.ccxws.on('trade', (trade) => {
console.log('---trade=', trade);
});
Expected behavior
The documented "fullId" property should be on the event payload.
Please provide as much information as possible to make the addition of the exchange easier:
Exchange API URL
https://docs.upbit.com/docs/upbit-quotation-websocket
Additional information about Websocket connection
Documentation in Korean. WebSocket supports Tickers, Trades, and L2 Orderbooks Updates (snapshot provided on connection).
BasicClient can probably be used, it looks like the socket allows subscribing to more than one feed per connection.
Refer to Contributing Guide for additional information.
src/exchanges
that follows CCXWS library interface (refer to README)src/exchanges
to validate subscribe/unsubscribe methods and that data parsing is correctindex.js
I've had CCXWS running on multiple exchanges and assets for a while now, and recently noticed that some exchanges (Binance in this case) will throw an error and cause my script to crash, even with a try catch around it. Below is the snippet I receive. I am trying to add logic to my code so I can catch this error and handle it myself and believe this is a bug. If it isn't, please let me know how to handle it as there doesn't appear to be any documentation and what I've tried so far hasn't worked (try catch and websocket.on('error')).
`info: watcher initiating reconnection
info: reconnecting
info: closing connection to wss://stream.binance.com:9443/stream?streams=bnbusdt@aggTrade
info: attempting connection
info: connecting to wss://stream.binance.com:9443/stream?streams=bnbusdt@aggTrade
events.js:183
throw er; // Unhandled 'error' event
^
RangeError: Invalid WebSocket frame: invalid status code 1005
at Receiver.controlMessage (/var/www/html/discord-node/node_modules/ccxws/node_modules/ws/lib/receiver.js:441:18)
at Receiver.getData (/var/www/html/discord-node/node_modules/ccxws/node_modules/ws/lib/receiver.js:329:42)
at Receiver.startLoop (/var/www/html/discord-node/node_modules/ccxws/node_modules/ws/lib/receiver.js:133:22)
at Receiver._write (/var/www/html/discord-node/node_modules/ccxws/node_modules/ws/lib/receiver.js:69:10)
at doWrite (_stream_writable.js:397:12)
at writeOrBuffer (_stream_writable.js:383:5)
at Receiver.Writable.write (_stream_writable.js:290:11)
at TLSSocket.socketOnData (/var/www/html/discord-node/node_modules/ccxws/node_modules/ws/lib/websocket.js:795:35)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at TLSSocket.Readable.push (_stream_readable.js:208:10)
at TLSWrap.onread (net.js:607:20)
error: Forever detected script exited with code: 1
error: Script restart attempt #179`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.