Closed baloian closed 3 years ago
Hi,
CCXWS is kraken api compliance so the valid market is XLTCZUSD
. CCXT converts internally to WS api.
You can found it on README.md
CCXWS uses similar market structures to those generated by the CCXT library. This allows interoperability between the RESTful interfaces provided by CCXT and the realtime interfaces provided by CC
So if you use ccxt to fetch kraken_markets
then you should use id
.
const ccxt = require('ccxt');
const ccxws = require('ccxws');
async function main(exchange = new ccxt.kraken()) {
const ws = new ccxws.Kraken();
ws.on('trade', (trade) => processTradeData(trade));
const krakenMarkets = (await exchange.fetchMarkets()).map(x => ({ id: x.id, base: x.base, quote: x.quote}));
for (const subPayload of krakenMarkets) {
ws.subscribeTrades(market)
}
}
main();
Thank you very much @fbadiola. This solved my problem. I am closing the issue.
Updated version :smile:
import ccxt from 'ccxt';
import { KrakenClient } from 'ccxws';
async function processTradeData (trade) {
console.log(trade)
}
async function main (exchange = new ccxt.kraken()) {
const ws = new KrakenClient();
ws.on('trade', (trade) => processTradeData(trade));
const krakenMarkets = (await exchange.fetchMarkets()).map(x => ({ id: x.id, base: x.base, quote: x.quote }));
for (const market of krakenMarkets) {
ws.subscribeTrades(market)
}
}
main();
Hi Everyone,
I am having an issue with Kraken subscription. When I do
LTC
subscription I do not get any trade, but when I create my own websocket I do get it. From the documentation it is not fully clear how is going to be subscription format for every exchange.Here is my example
Does anybody having the same issue? Basically, I get only a few trades even if I subscribe all the available pairs.