Open jhonyjss opened 5 months ago
Same here, just tried to use it, but the callback is streaming back the symbol string, not the data.
@jhonyjss Were you able to get to the bottom of it or find an alternative?
Hi @vitaly-t , I didn't find any alternative yet. let's watch together.
@jhonyjss Thank you for coming back to me on this!
After poking around with the API, I found that futuresCandlesticks
works and gives me exactly what I wanted - socket subscription for candle updates, which is essentially the same stuff you would expect for the charting data.
['1m', '3m', '5m'].forEach(i => {
const endpoint = binance.futuresCandlesticks('BTCUSDT', i, c => {
if (c.k.x) {
// candle has been closed, time to update:
this.updateCandles(i, {
open: c.k.o,
close: c.k.c,
high: c.k.h,
low: c.k.l,
openTime: c.k.t,
closeTime: c.k.T,
volume: c.k.v,
tradesCount: c.k.n
});
}
});
this.socketEndpoints.push(endpoint); // save the endpoint, to close later
});
P.S. I work with Binance Futures only, I'm not interested in Spot stuff 😸
` const binance = new Binance().options({ APIKEY: apiKey, APISECRET: apiSecret, useServerTime: true });
binance.websockets.chart( "BTCUSDT", "1m", (symbol, interval, chart) => { console.info(chart); } );`
result: {}
Can you please check what's wrong ?