1.1.1 • Published 1 year ago

@kandlfeed/js-client v1.1.1

Weekly downloads
-
License
KANDLFEED-CP1
Repository
-
Last release
1 year ago

js-client

Client for Kandlfeed

https://www.kandlfeed.io

Usage

const client = new Client({ apiKey: 'A01-230308' });

Socket

Candlestick subscriptions

// Subscribe to specific exchange/symbol/interval
const socket = await client.socket.subscribeCandles({ exchange: 'BINANCE', symbol: 'BTCUSD', interval: '1d' });

// n.b : there is only one socket open, therefore if there is multiple subscriptions,
// they will all be emitted in the first socket
await client.socket.subscribeCandles({ exchange: 'BINANCE', symbol: 'ETHBTC' });
// Once can subscribe to all exchange
await client.socket.subscribeCandles({ exchange: 'BYBIT' });
// Or to all candles (not recommended as it can be verbose)
await client.socket.subscribeCandles();

socket.on('candle', (candle) => {
  console.log({candle});
});

Tickers subscriptions

// Subscribe to specific exchange/symbol
const socket = await client.socket.subscribeTickers({ exchange: 'BINANCE', symbol: 'BTCUSD' });
// Once can subscribe to all exchange
await client.socket.subscribeTickers({ exchange: 'BYBIT' });
// Or to all tickers
await client.socket.subscribeTickers();

socket.on('ticker', (candle) => {
  console.log({candle});
});

Trade subscriptions

// Subscribe to specific exchange/symbol
const socket = await client.socket.subscribeTrades({ exchange: 'BINANCE', symbol: 'BTCUSD' });

socket.on('trade', (candle) => {
  console.log({candle});
});

REST

Fetch All Exchanges

await client.api.exchanges.fetchAll();

Fetch Specific Exchange information

await client.api.exchanges.fetchOne('Binance');

Fetch All Instruments of an exchanges

await client.api.exchanges.instruments.fetchAll('Binance');

Fetch Specific Instrument information

await client.api.exchanges.instruments.fetchOne('Binance', 'DASHBTC');

Fetch Instrument candlesticks

await client.api.exchanges.instruments.fetchCandles('Binance', 'DASHBTC', { interval: '1d'});

Params : interval, limit, to, since

Fetch All Assets of an Exchange

await client.api.exchanges.assets.fetchAll('Binance');

Fetch asset information of an Exchange

await client.api.exchanges.assets.fetchOne('Binance', "USD");
1.1.1

1 year ago

1.1.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago