MCPcopy Create free account
hub / github.com/ccxt/node-binance-api / klineHandler

Function klineHandler

deprecated/node-binance-api.js:2442–2460  ·  view source on GitHub ↗
(symbol, kline, firstTime = 0)

Source from the content-addressed store, hash-verified

2440 * @return {undefined}
2441 */
2442 const klineHandler = (symbol, kline, firstTime = 0) => {
2443 // TODO: add Taker buy base asset volume
2444 // eslint-disable-next-line no-unused-vars
2445 let { e: eventType, E: eventTime, k: ticks } = kline;
2446 // eslint-disable-next-line no-unused-vars
2447 let { o: open, h: high, l: low, c: close, v: volume, i: interval, x: isFinal, q: quoteVolume, t: time } = ticks; //n:trades, V:buyVolume, Q:quoteBuyVolume
2448 if (time <= firstTime) return;
2449 if (!isFinal) {
2450 if (typeof Binance.ohlcLatest[symbol][interval].time !== 'undefined') {
2451 if (Binance.ohlcLatest[symbol][interval].time > time) return;
2452 }
2453 Binance.ohlcLatest[symbol][interval] = { open: open, high: high, low: low, close: close, volume: volume, time: time };
2454 return;
2455 }
2456 // Delete an element from the beginning so we don't run out of memory
2457 const first_updated = Object.keys(Binance.ohlc[symbol][interval]).shift();
2458 if (first_updated) delete Binance.ohlc[symbol][interval][first_updated];
2459 Binance.ohlc[symbol][interval][time] = { open: open, high: high, low: low, close: close, volume: volume };
2460 };
2461
2462
2463 /**

Callers 2

handleKlineStreamDataFunction · 0.85
getSymbolKlineSnapshotFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected