This repository was archived by the owner on Sep 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 182
This repository was archived by the owner on Sep 9, 2023. It is now read-only.
Is this a correct way of implementing ccws in Node.js? #332
Copy link
Copy link
Open
Description
const ccxws = require("ccxws");
const binance = new ccxws.BinanceClient();
const kucoin = new ccxws.KucoinClient();
// select binance markets
const subscribeData1 = {
id: "ETHUSDT",
base: "ETH",
quote: "USDT",
};
// select kucoin markets
const subscribeData2 = {
id: "LTCBTC",
base: "LTC",
quote: "BTC",
};
// handle the trade and order book events from websocket
binance.on("trade", (trade) => console.log(trade));
kucoin.on("l2snapshot", (snapshot) => console.log(snapshot));
// subscribe to the trade and order book events
binance.subscribeTrades(subscribeData1);
kucoin.subscribeLevel2Snapshots(subscribeData2);
I created a client file following a tutorial on Medium.com . I got response from Binance but not from Kucoin.
Output:
....
Trade {
exchange: 'Binance',
quote: 'USDT',
base: 'ETH',
tradeId: '735481432',
sequenceId: undefined,
unix: 1659513082185,
side: 'sell',
price: '1627.68000000',
amount: '0.50510000',
buyOrderId: undefined,
sellOrderId: undefined
}
Trade {
exchange: 'Binance',
quote: 'USDT',
base: 'ETH',
tradeId: '735481433',
sequenceId: undefined,
unix: 1659513082224,
side: 'sell',
price: '1627.68000000',
amount: '0.19220000',
buyOrderId: undefined,
sellOrderId: undefined
}
Trade {
exchange: 'Binance',
quote: 'USDT',
base: 'ETH',
tradeId: '735481434',
sequenceId: undefined,
unix: 1659513082298,
side: 'sell',
price: '1627.69000000',
amount: '0.15000000',
buyOrderId: undefined,
sellOrderId: undefined
}
Trade {
exchange: 'Binance',
quote: 'USDT',
base: 'ETH',
tradeId: '735481435',
sequenceId: undefined,
unix: 1659513082365,
side: 'sell',
price: '1627.70000000',
amount: '0.19220000',
buyOrderId: undefined,
sellOrderId: undefined
}
....
After I commented out lines related to Binance, I got nothing in response.
Please let me know the correct way of implementing ccxws in Node.js. Thanks!
Metadata
Metadata
Assignees
Labels
No labels