UNPKG

tardis-dev

Version:

Convenient access to tick-level historical and real-time cryptocurrency market data via Node.js

438 lines 29.8 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.normalizeBookTickers = exports.normalizeLiquidations = exports.normalizeOptionsSummary = exports.normalizeDerivativeTickers = exports.normalizeBookChanges = exports.normalizeTrades = void 0; const handy_1 = require("../handy"); const ascendex_1 = require("./ascendex"); const binance_1 = require("./binance"); const binancedex_1 = require("./binancedex"); const binanceeuropeanoptions_1 = require("./binanceeuropeanoptions"); const binanceoptions_1 = require("./binanceoptions"); const bitfinex_1 = require("./bitfinex"); const bitflyer_1 = require("./bitflyer"); const bitget_1 = require("./bitget"); const bitmex_1 = require("./bitmex"); const bitnomial_1 = require("./bitnomial"); const bitstamp_1 = require("./bitstamp"); const blockchaincom_1 = require("./blockchaincom"); const bybit_1 = require("./bybit"); const bybitspot_1 = require("./bybitspot"); const coinbase_1 = require("./coinbase"); const coinbaseinternational_1 = require("./coinbaseinternational"); const coinflex_1 = require("./coinflex"); const cryptocom_1 = require("./cryptocom"); const cryptofacilities_1 = require("./cryptofacilities"); const delta_1 = require("./delta"); const deribit_1 = require("./deribit"); const dydx_1 = require("./dydx"); const dydxv4_1 = require("./dydxv4"); const ftx_1 = require("./ftx"); const gateio_1 = require("./gateio"); const gateiofutures_1 = require("./gateiofutures"); const gemini_1 = require("./gemini"); const hitbtc_1 = require("./hitbtc"); const huobi_1 = require("./huobi"); const hyperliquid_1 = require("./hyperliquid"); const kraken_1 = require("./kraken"); const kucoin_1 = require("./kucoin"); const kucoinfutures_1 = require("./kucoinfutures"); const okex_1 = require("./okex"); const okexspreads_1 = require("./okexspreads"); const phemex_1 = require("./phemex"); const poloniex_1 = require("./poloniex"); const serum_1 = require("./serum"); const upbit_1 = require("./upbit"); const woox_1 = require("./woox"); __exportStar(require("./mapper"), exports); const THREE_MINUTES_IN_MS = 3 * 60 * handy_1.ONE_SEC_IN_MS; const isRealTime = (date) => { if (process.env.__NO_REAL_TIME__) { return false; } return date.valueOf() + THREE_MINUTES_IN_MS > new Date().valueOf(); }; const OKEX_V5_API_SWITCH_DATE = new Date('2021-12-23T00:00:00.000Z'); const OKEX_V5_TBT_BOOK_TICKER_RELEASE_DATE = new Date('2022-05-06T00:00:00.000Z'); const shouldUseOkexV5Mappers = (localTimestamp) => { return isRealTime(localTimestamp) || localTimestamp.valueOf() >= OKEX_V5_API_SWITCH_DATE.valueOf(); }; const canUseOkexTbtBookTicker = (localTimestamp) => { return isRealTime(localTimestamp) || localTimestamp.valueOf() >= OKEX_V5_TBT_BOOK_TICKER_RELEASE_DATE.valueOf(); }; const POLONIEX_V2_API_SWITCH_DATE = new Date('2022-08-02T00:00:00.000Z'); const shouldUsePoloniexV2Mappers = (localTimestamp) => { return isRealTime(localTimestamp) || localTimestamp.valueOf() >= POLONIEX_V2_API_SWITCH_DATE.valueOf(); }; // see https://status.tardis.dev/incidents/ryjyv8tgdgkj const shouldUseOKXPublicBooksChannel = (localTimestamp) => { return (localTimestamp.valueOf() >= new Date('2023-02-25T00:00:00.000Z').valueOf() && localTimestamp.valueOf() < new Date('2023-03-09T00:00:00.000Z').valueOf()); }; const shouldIgnoreBookSnapshotOverlap = (date) => { if (process.env.IGNORE_BOOK_SNAPSHOT_OVERLAP_ERROR) { return true; } return isRealTime(date) === false; }; const BYBIT_V5_API_SWITCH_DATE = new Date('2023-04-05T00:00:00.000Z'); const BYBIT_V5_API_ALL_LIQUIDATION_SUPPORT_DATE = new Date('2025-02-26T00:00:00.000Z'); const shouldUseBybitV5Mappers = (localTimestamp) => { return isRealTime(localTimestamp) || localTimestamp.valueOf() >= BYBIT_V5_API_SWITCH_DATE.valueOf(); }; const shouldUseBybitAllLiquidationFeed = (localTimestamp) => { return isRealTime(localTimestamp) || localTimestamp.valueOf() >= BYBIT_V5_API_ALL_LIQUIDATION_SUPPORT_DATE.valueOf(); }; const OKCOIN_V5_API_SWITCH_DATE = new Date('2023-04-27T00:00:00.000Z'); const shouldUseOkcoinV5Mappers = (localTimestamp) => { return isRealTime(localTimestamp) || localTimestamp.valueOf() >= OKCOIN_V5_API_SWITCH_DATE.valueOf(); }; const GATE_IO_V4_API_SWITCH_DATE = new Date('2023-04-29T00:00:00.000Z'); const GATE_IO_V4_ORDER_BOOK_V2_SWITCH_DATE = new Date('2025-08-01T00:00:00.000Z'); const shouldUseGateIOV4Mappers = (localTimestamp) => { return isRealTime(localTimestamp) || localTimestamp.valueOf() >= GATE_IO_V4_API_SWITCH_DATE.valueOf(); }; const shouldUseGateIOV4OrderBookV2Mappers = (localTimestamp) => { return isRealTime(localTimestamp) || localTimestamp.valueOf() >= GATE_IO_V4_ORDER_BOOK_V2_SWITCH_DATE.valueOf(); }; const shouldUseCFRelativeFunding = (localTimestamp) => { return isRealTime(localTimestamp) || localTimestamp.valueOf() >= new Date('2022-09-29T00:00:00.000Z').valueOf(); }; const shouldUseOKXTradesAllChannel = (localTimestamp) => { if (process.env.OKX_USE_TRADES_CHANNEL) { return false; } return isRealTime(localTimestamp) || localTimestamp.valueOf() >= new Date('2023-10-19T00:00:00.000Z').valueOf(); }; const BINANCE_EUROPEAN_OPTIONS_V2_API_SWITCH_DATE = new Date('2025-12-17T00:00:00.000Z'); const shouldUseBinanceEuropeanOptionsV2Mappers = (localTimestamp) => { return isRealTime(localTimestamp) || localTimestamp.valueOf() >= BINANCE_EUROPEAN_OPTIONS_V2_API_SWITCH_DATE.valueOf(); }; const tradesMappers = { bitmex: () => bitmex_1.bitmexTradesMapper, binance: () => new binance_1.BinanceTradesMapper('binance'), 'binance-us': () => new binance_1.BinanceTradesMapper('binance-us'), 'binance-jersey': () => new binance_1.BinanceTradesMapper('binance-jersey'), 'binance-futures': () => new binance_1.BinanceTradesMapper('binance-futures'), 'binance-delivery': () => new binance_1.BinanceTradesMapper('binance-delivery'), 'binance-dex': () => binancedex_1.binanceDexTradesMapper, bitfinex: () => new bitfinex_1.BitfinexTradesMapper('bitfinex'), 'bitfinex-derivatives': () => new bitfinex_1.BitfinexTradesMapper('bitfinex-derivatives'), bitflyer: () => bitflyer_1.bitflyerTradesMapper, bitstamp: () => bitstamp_1.bitstampTradesMapper, coinbase: () => coinbase_1.coinbaseTradesMapper, cryptofacilities: () => cryptofacilities_1.cryptofacilitiesTradesMapper, deribit: () => deribit_1.deribitTradesMapper, ftx: () => new ftx_1.FTXTradesMapper('ftx'), 'ftx-us': () => new ftx_1.FTXTradesMapper('ftx-us'), gemini: () => gemini_1.geminiTradesMapper, kraken: () => kraken_1.krakenTradesMapper, okex: (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5TradesMapper('okex', shouldUseOKXTradesAllChannel(localTimestamp)) : new okex_1.OkexTradesMapper('okex', 'spot'), 'okex-futures': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5TradesMapper('okex-futures', shouldUseOKXTradesAllChannel(localTimestamp)) : new okex_1.OkexTradesMapper('okex-futures', 'futures'), 'okex-swap': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5TradesMapper('okex-swap', shouldUseOKXTradesAllChannel(localTimestamp)) : new okex_1.OkexTradesMapper('okex-swap', 'swap'), 'okex-options': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5TradesMapper('okex-options', shouldUseOKXTradesAllChannel(localTimestamp)) : new okex_1.OkexTradesMapper('okex-options', 'option'), huobi: () => new huobi_1.HuobiTradesMapper('huobi'), 'huobi-dm': () => new huobi_1.HuobiTradesMapper('huobi-dm'), 'huobi-dm-swap': () => new huobi_1.HuobiTradesMapper('huobi-dm-swap'), 'huobi-dm-linear-swap': () => new huobi_1.HuobiTradesMapper('huobi-dm-linear-swap'), 'huobi-dm-options': () => new huobi_1.HuobiTradesMapper('huobi-dm-options'), bybit: (localTimestamp) => shouldUseBybitV5Mappers(localTimestamp) ? new bybit_1.BybitV5TradesMapper('bybit') : new bybit_1.BybitTradesMapper('bybit'), okcoin: (localTimestamp) => shouldUseOkcoinV5Mappers(localTimestamp) ? new okex_1.OkexV5TradesMapper('okcoin', false) : new okex_1.OkexTradesMapper('okcoin', 'spot'), hitbtc: () => hitbtc_1.hitBtcTradesMapper, phemex: () => phemex_1.phemexTradesMapper, delta: (localTimestamp) => new delta_1.DeltaTradesMapper(localTimestamp.valueOf() >= new Date('2020-10-14').valueOf()), 'gate-io': (localTimestamp) => shouldUseGateIOV4Mappers(localTimestamp) ? new gateio_1.GateIOV4TradesMapper('gate-io') : new gateio_1.GateIOTradesMapper('gate-io'), 'gate-io-futures': () => new gateiofutures_1.GateIOFuturesTradesMapper('gate-io-futures'), poloniex: (localTimestamp) => shouldUsePoloniexV2Mappers(localTimestamp) ? new poloniex_1.PoloniexV2TradesMapper() : new poloniex_1.PoloniexTradesMapper(), coinflex: () => coinflex_1.coinflexTradesMapper, 'binance-options': () => new binanceoptions_1.BinanceOptionsTradesMapper(), upbit: () => new upbit_1.UpbitTradesMapper(), ascendex: () => new ascendex_1.AscendexTradesMapper(), dydx: () => new dydx_1.DydxTradesMapper(), 'dydx-v4': () => new dydxv4_1.DydxV4TradesMapper(), serum: () => new serum_1.SerumTradesMapper('serum'), 'star-atlas': () => new serum_1.SerumTradesMapper('star-atlas'), mango: () => new serum_1.SerumTradesMapper('mango'), 'bybit-spot': (localTimestamp) => shouldUseBybitV5Mappers(localTimestamp) ? new bybit_1.BybitV5TradesMapper('bybit-spot') : new bybitspot_1.BybitSpotTradesMapper('bybit-spot'), 'crypto-com': () => new cryptocom_1.CryptoComTradesMapper('crypto-com'), 'crypto-com-derivatives': () => new cryptocom_1.CryptoComTradesMapper('crypto-com-derivatives'), kucoin: () => new kucoin_1.KucoinTradesMapper('kucoin'), 'kucoin-futures': () => new kucoinfutures_1.KucoinFuturesTradesMapper(), bitnomial: () => bitnomial_1.bitnomialTradesMapper, 'woo-x': () => woox_1.wooxTradesMapper, 'blockchain-com': () => new blockchaincom_1.BlockchainComTradesMapper(), 'bybit-options': () => new bybit_1.BybitV5TradesMapper('bybit-options'), 'binance-european-options': (localTimestamp) => shouldUseBinanceEuropeanOptionsV2Mappers(localTimestamp) ? new binanceeuropeanoptions_1.BinanceEuropeanOptionsTradesMapperV2() : new binanceeuropeanoptions_1.BinanceEuropeanOptionsTradesMapper(), 'okex-spreads': () => new okexspreads_1.OkexSpreadsTradesMapper(), bitget: () => new bitget_1.BitgetTradesMapper('bitget'), 'bitget-futures': () => new bitget_1.BitgetTradesMapper('bitget-futures'), 'coinbase-international': () => coinbaseinternational_1.coinbaseInternationalTradesMapper, hyperliquid: () => new hyperliquid_1.HyperliquidTradesMapper() }; const bookChangeMappers = { bitmex: () => new bitmex_1.BitmexBookChangeMapper(), binance: (localTimestamp) => new binance_1.BinanceBookChangeMapper('binance', shouldIgnoreBookSnapshotOverlap(localTimestamp)), 'binance-us': (localTimestamp) => new binance_1.BinanceBookChangeMapper('binance-us', shouldIgnoreBookSnapshotOverlap(localTimestamp)), 'binance-jersey': (localTimestamp) => new binance_1.BinanceBookChangeMapper('binance-jersey', shouldIgnoreBookSnapshotOverlap(localTimestamp)), 'binance-futures': (localTimestamp) => new binance_1.BinanceFuturesBookChangeMapper('binance-futures', shouldIgnoreBookSnapshotOverlap(localTimestamp)), 'binance-delivery': (localTimestamp) => new binance_1.BinanceFuturesBookChangeMapper('binance-delivery', shouldIgnoreBookSnapshotOverlap(localTimestamp)), 'binance-dex': () => binancedex_1.binanceDexBookChangeMapper, bitfinex: () => new bitfinex_1.BitfinexBookChangeMapper('bitfinex'), 'bitfinex-derivatives': () => new bitfinex_1.BitfinexBookChangeMapper('bitfinex-derivatives'), bitflyer: () => new bitflyer_1.BitflyerBookChangeMapper(), bitstamp: () => new bitstamp_1.BitstampBookChangeMapper(), coinbase: () => new coinbase_1.CoinbaseBookChangMapper(), cryptofacilities: () => cryptofacilities_1.cryptofacilitiesBookChangeMapper, deribit: () => deribit_1.deribitBookChangeMapper, ftx: () => new ftx_1.FTXBookChangeMapper('ftx'), 'ftx-us': () => new ftx_1.FTXBookChangeMapper('ftx-us'), gemini: () => gemini_1.geminiBookChangeMapper, kraken: () => kraken_1.krakenBookChangeMapper, okex: (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5BookChangeMapper('okex', isRealTime(localTimestamp) || shouldUseOKXPublicBooksChannel(localTimestamp)) : new okex_1.OkexBookChangeMapper('okex', 'spot', localTimestamp.valueOf() >= new Date('2020-04-10').valueOf()), 'okex-futures': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5BookChangeMapper('okex-futures', isRealTime(localTimestamp) || shouldUseOKXPublicBooksChannel(localTimestamp)) : new okex_1.OkexBookChangeMapper('okex-futures', 'futures', localTimestamp.valueOf() >= new Date('2019-12-05').valueOf()), 'okex-swap': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5BookChangeMapper('okex-swap', isRealTime(localTimestamp) || shouldUseOKXPublicBooksChannel(localTimestamp)) : new okex_1.OkexBookChangeMapper('okex-swap', 'swap', localTimestamp.valueOf() >= new Date('2020-02-08').valueOf()), 'okex-options': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5BookChangeMapper('okex-options', isRealTime(localTimestamp) || shouldUseOKXPublicBooksChannel(localTimestamp)) : new okex_1.OkexBookChangeMapper('okex-options', 'option', localTimestamp.valueOf() >= new Date('2020-02-08').valueOf()), huobi: (localTimestamp) => localTimestamp.valueOf() >= new Date('2020-07-03').valueOf() ? new huobi_1.HuobiMBPBookChangeMapper('huobi') : new huobi_1.HuobiBookChangeMapper('huobi'), 'huobi-dm': () => new huobi_1.HuobiBookChangeMapper('huobi-dm'), 'huobi-dm-swap': () => new huobi_1.HuobiBookChangeMapper('huobi-dm-swap'), 'huobi-dm-linear-swap': () => new huobi_1.HuobiBookChangeMapper('huobi-dm-linear-swap'), 'huobi-dm-options': () => new huobi_1.HuobiBookChangeMapper('huobi-dm-options'), 'bybit-spot': (localTimestamp) => shouldUseBybitV5Mappers(localTimestamp) ? new bybit_1.BybitV5BookChangeMapper('bybit-spot', 50) : new bybitspot_1.BybitSpotBookChangeMapper('bybit-spot'), bybit: (localTimestamp) => shouldUseBybitV5Mappers(localTimestamp) ? new bybit_1.BybitV5BookChangeMapper('bybit', 50) : new bybit_1.BybitBookChangeMapper('bybit', false), okcoin: (localTimestamp) => shouldUseOkcoinV5Mappers(localTimestamp) ? new okex_1.OkexV5BookChangeMapper('okcoin', true) : new okex_1.OkexBookChangeMapper('okcoin', 'spot', localTimestamp.valueOf() >= new Date('2020-02-13').valueOf()), hitbtc: () => hitbtc_1.hitBtcBookChangeMapper, phemex: () => phemex_1.phemexBookChangeMapper, delta: (localTimestamp) => new delta_1.DeltaBookChangeMapper(localTimestamp.valueOf() >= new Date('2023-04-01').valueOf()), 'gate-io': (localTimestamp) => shouldUseGateIOV4OrderBookV2Mappers(localTimestamp) ? new gateio_1.GateIOV4OrderBookV2ChangeMapper('gate-io') : shouldUseGateIOV4Mappers(localTimestamp) ? new gateio_1.GateIOV4BookChangeMapper('gate-io', isRealTime(localTimestamp) == false) : new gateio_1.GateIOBookChangeMapper('gate-io'), 'gate-io-futures': () => new gateiofutures_1.GateIOFuturesBookChangeMapper('gate-io-futures'), poloniex: (localTimestamp) => shouldUsePoloniexV2Mappers(localTimestamp) ? new poloniex_1.PoloniexV2BookChangeMapper() : new poloniex_1.PoloniexBookChangeMapper(), coinflex: () => coinflex_1.coinflexBookChangeMapper, 'binance-options': () => new binanceoptions_1.BinanceOptionsBookChangeMapper(), upbit: () => new upbit_1.UpbitBookChangeMapper(), ascendex: () => new ascendex_1.AscendexBookChangeMapper(), dydx: () => new dydx_1.DydxBookChangeMapper(), 'dydx-v4': () => new dydxv4_1.DydxV4BookChangeMapper(), serum: () => new serum_1.SerumBookChangeMapper('serum'), 'star-atlas': () => new serum_1.SerumBookChangeMapper('star-atlas'), mango: () => new serum_1.SerumBookChangeMapper('mango'), 'crypto-com': () => new cryptocom_1.CryptoComBookChangeMapper('crypto-com'), 'crypto-com-derivatives': () => new cryptocom_1.CryptoComBookChangeMapper('crypto-com-derivatives'), kucoin: (localTimestamp) => new kucoin_1.KucoinBookChangeMapper('kucoin', isRealTime(localTimestamp) === false), 'kucoin-futures': (localTimestamp) => new kucoinfutures_1.KucoinFuturesBookChangeMapper(isRealTime(localTimestamp) === false), bitnomial: () => new bitnomial_1.BitnomialBookChangMapper(), 'woo-x': () => new woox_1.WooxBookChangeMapper(), 'blockchain-com': () => new blockchaincom_1.BlockchainComBookChangeMapper(), 'bybit-options': () => new bybit_1.BybitV5BookChangeMapper('bybit-options', 25), 'binance-european-options': (localTimestamp) => shouldUseBinanceEuropeanOptionsV2Mappers(localTimestamp) ? new binanceeuropeanoptions_1.BinanceEuropeanOptionsBookChangeMapperV2() : new binanceeuropeanoptions_1.BinanceEuropeanOptionsBookChangeMapper(), 'okex-spreads': () => new okexspreads_1.OkexSpreadsBookChangeMapper(), bitget: () => new bitget_1.BitgetBookChangeMapper('bitget'), 'bitget-futures': () => new bitget_1.BitgetBookChangeMapper('bitget-futures'), 'coinbase-international': () => new coinbaseinternational_1.CoinbaseInternationalBookChangMapper(), hyperliquid: () => new hyperliquid_1.HyperliquidBookChangeMapper() }; const derivativeTickersMappers = { bitmex: () => new bitmex_1.BitmexDerivativeTickerMapper(), 'binance-futures': () => new binance_1.BinanceFuturesDerivativeTickerMapper('binance-futures'), 'binance-delivery': () => new binance_1.BinanceFuturesDerivativeTickerMapper('binance-delivery'), 'bitfinex-derivatives': () => new bitfinex_1.BitfinexDerivativeTickerMapper(), cryptofacilities: (localTimestamp) => new cryptofacilities_1.CryptofacilitiesDerivativeTickerMapper(shouldUseCFRelativeFunding(localTimestamp)), deribit: () => new deribit_1.DeribitDerivativeTickerMapper(), 'okex-futures': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5DerivativeTickerMapper('okex-futures') : new okex_1.OkexDerivativeTickerMapper('okex-futures'), 'okex-swap': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5DerivativeTickerMapper('okex-swap') : new okex_1.OkexDerivativeTickerMapper('okex-swap'), bybit: (localTimestamp) => shouldUseBybitV5Mappers(localTimestamp) ? new bybit_1.BybitV5DerivativeTickerMapper() : new bybit_1.BybitDerivativeTickerMapper(), phemex: () => new phemex_1.PhemexDerivativeTickerMapper(), ftx: () => new ftx_1.FTXDerivativeTickerMapper('ftx'), delta: (localTimestamp) => new delta_1.DeltaDerivativeTickerMapper(localTimestamp.valueOf() >= new Date('2020-10-14').valueOf()), 'huobi-dm': () => new huobi_1.HuobiDerivativeTickerMapper('huobi-dm'), 'huobi-dm-swap': () => new huobi_1.HuobiDerivativeTickerMapper('huobi-dm-swap'), 'huobi-dm-linear-swap': () => new huobi_1.HuobiDerivativeTickerMapper('huobi-dm-linear-swap'), 'gate-io-futures': () => new gateiofutures_1.GateIOFuturesDerivativeTickerMapper(), coinflex: () => new coinflex_1.CoinflexDerivativeTickerMapper(), ascendex: () => new ascendex_1.AscendexDerivativeTickerMapper(), dydx: () => new dydx_1.DydxDerivativeTickerMapper(), 'dydx-v4': () => new dydxv4_1.DydxV4DerivativeTickerMapper(), 'crypto-com-derivatives': () => new cryptocom_1.CryptoComDerivativeTickerMapper('crypto-com-derivatives'), 'crypto-com': () => new cryptocom_1.CryptoComDerivativeTickerMapper('crypto-com'), 'woo-x': () => new woox_1.WooxDerivativeTickerMapper(), 'kucoin-futures': () => new kucoinfutures_1.KucoinFuturesDerivativeTickerMapper(), 'bitget-futures': () => new bitget_1.BitgetDerivativeTickerMapper(), 'coinbase-international': () => new coinbaseinternational_1.CoinbaseInternationalDerivativeTickerMapper(), hyperliquid: () => new hyperliquid_1.HyperliquidDerivativeTickerMapper() }; const optionsSummaryMappers = { deribit: () => new deribit_1.DeribitOptionSummaryMapper(), 'okex-options': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5OptionSummaryMapper() : new okex_1.OkexOptionSummaryMapper(), 'binance-options': () => new binanceoptions_1.BinanceOptionSummaryMapper(), 'huobi-dm-options': () => new huobi_1.HuobiOptionsSummaryMapper(), 'bybit-options': () => new bybit_1.BybitV5OptionSummaryMapper(), 'binance-european-options': (localTimestamp) => shouldUseBinanceEuropeanOptionsV2Mappers(localTimestamp) ? new binanceeuropeanoptions_1.BinanceEuropeanOptionSummaryMapperV2() : new binanceeuropeanoptions_1.BinanceEuropeanOptionSummaryMapper() }; const liquidationsMappers = { ftx: () => new ftx_1.FTXLiquidationsMapper(), bitmex: () => bitmex_1.bitmexLiquidationsMapper, deribit: () => deribit_1.deribitLiquidationsMapper, 'binance-futures': () => new binance_1.BinanceLiquidationsMapper('binance-futures'), 'binance-delivery': () => new binance_1.BinanceLiquidationsMapper('binance-delivery'), 'bitfinex-derivatives': () => new bitfinex_1.BitfinexLiquidationsMapper('bitfinex-derivatives'), cryptofacilities: () => cryptofacilities_1.cryptofacilitiesLiquidationsMapper, 'huobi-dm': () => new huobi_1.HuobiLiquidationsMapper('huobi-dm'), 'dydx-v4': () => new dydxv4_1.DydxV4LiquidationsMapper(), 'huobi-dm-swap': () => new huobi_1.HuobiLiquidationsMapper('huobi-dm-swap'), 'huobi-dm-linear-swap': () => new huobi_1.HuobiLiquidationsMapper('huobi-dm-linear-swap'), bybit: (localTimestamp) => shouldUseBybitV5Mappers(localTimestamp) ? shouldUseBybitAllLiquidationFeed(localTimestamp) ? new bybit_1.BybitV5AllLiquidationsMapper('bybit') : new bybit_1.BybitV5LiquidationsMapper('bybit') : new bybit_1.BybitLiquidationsMapper('bybit'), 'okex-futures': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5LiquidationsMapper('okex-futures') : new okex_1.OkexLiquidationsMapper('okex-futures', 'futures'), 'okex-swap': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5LiquidationsMapper('okex-swap') : new okex_1.OkexLiquidationsMapper('okex-swap', 'swap') }; const bookTickersMappers = { binance: () => new binance_1.BinanceBookTickerMapper('binance'), 'binance-futures': () => new binance_1.BinanceBookTickerMapper('binance-futures'), 'binance-delivery': () => new binance_1.BinanceBookTickerMapper('binance-delivery'), 'binance-us': () => new binance_1.BinanceBookTickerMapper('binance-us'), ascendex: () => new ascendex_1.AscendexBookTickerMapper(), 'binance-dex': () => binancedex_1.binanceDexBookTickerMapper, bitfinex: () => new bitfinex_1.BitfinexBookTickerMapper('bitfinex'), 'bitfinex-derivatives': () => new bitfinex_1.BitfinexBookTickerMapper('bitfinex-derivatives'), bitflyer: () => bitflyer_1.bitflyerBookTickerMapper, bitmex: () => bitmex_1.bitmexBookTickerMapper, coinbase: () => coinbase_1.coinbaseBookTickerMapper, cryptofacilities: () => cryptofacilities_1.cryptofacilitiesBookTickerMapper, deribit: () => deribit_1.deribitBookTickerMapper, ftx: () => new ftx_1.FTXBookTickerMapper('ftx'), 'ftx-us': () => new ftx_1.FTXBookTickerMapper('ftx-us'), huobi: () => new huobi_1.HuobiBookTickerMapper('huobi'), 'huobi-dm': () => new huobi_1.HuobiBookTickerMapper('huobi-dm'), 'huobi-dm-swap': () => new huobi_1.HuobiBookTickerMapper('huobi-dm-swap'), 'huobi-dm-linear-swap': () => new huobi_1.HuobiBookTickerMapper('huobi-dm-linear-swap'), kraken: () => kraken_1.krakenBookTickerMapper, okex: (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5BookTickerMapper('okex', canUseOkexTbtBookTicker(localTimestamp)) : new okex_1.OkexBookTickerMapper('okex', 'spot'), 'okex-futures': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5BookTickerMapper('okex-futures', canUseOkexTbtBookTicker(localTimestamp)) : new okex_1.OkexBookTickerMapper('okex-futures', 'futures'), 'okex-swap': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5BookTickerMapper('okex-swap', canUseOkexTbtBookTicker(localTimestamp)) : new okex_1.OkexBookTickerMapper('okex-swap', 'swap'), 'okex-options': (localTimestamp) => shouldUseOkexV5Mappers(localTimestamp) ? new okex_1.OkexV5BookTickerMapper('okex-options', canUseOkexTbtBookTicker(localTimestamp)) : new okex_1.OkexBookTickerMapper('okex-options', 'option'), okcoin: (localTimestamp) => shouldUseOkcoinV5Mappers(localTimestamp) ? new okex_1.OkexV5BookTickerMapper('okcoin', true) : new okex_1.OkexBookTickerMapper('okcoin', 'spot'), serum: () => new serum_1.SerumBookTickerMapper('serum'), 'star-atlas': () => new serum_1.SerumBookTickerMapper('star-atlas'), mango: () => new serum_1.SerumBookTickerMapper('mango'), 'gate-io-futures': () => new gateiofutures_1.GateIOFuturesBookTickerMapper('gate-io-futures'), 'bybit-spot': (localTimestamp) => shouldUseBybitV5Mappers(localTimestamp) ? new bybit_1.BybitV5BookTickerMapper('bybit-spot') : new bybitspot_1.BybitSpotBookTickerMapper('bybit-spot'), 'crypto-com': () => new cryptocom_1.CryptoComBookTickerMapper('crypto-com'), 'crypto-com-derivatives': () => new cryptocom_1.CryptoComBookTickerMapper('crypto-com-derivatives'), kucoin: () => new kucoin_1.KucoinBookTickerMapper('kucoin'), 'woo-x': () => new woox_1.WooxBookTickerMapper(), delta: () => new delta_1.DeltaBookTickerMapper(), bybit: () => new bybit_1.BybitV5BookTickerMapper('bybit'), 'gate-io': () => new gateio_1.GateIOV4BookTickerMapper('gate-io'), 'okex-spreads': () => new okexspreads_1.OkexSpreadsBookTickerMapper(), 'kucoin-futures': () => new kucoinfutures_1.KucoinFuturesBookTickerMapper(), bitget: () => new bitget_1.BitgetBookTickerMapper('bitget'), 'bitget-futures': () => new bitget_1.BitgetBookTickerMapper('bitget-futures'), 'coinbase-international': () => coinbaseinternational_1.coinbaseInternationalBookTickerMapper, hyperliquid: () => new hyperliquid_1.HyperliquidBookTickerMapper(), 'binance-european-options': () => new binanceeuropeanoptions_1.BinanceEuropeanOptionsBookTickerMapper() }; const normalizeTrades = (exchange, localTimestamp) => { const createTradesMapper = tradesMappers[exchange]; if (createTradesMapper === undefined) { throw new Error(`normalizeTrades: ${exchange} not supported`); } return createTradesMapper(localTimestamp); }; exports.normalizeTrades = normalizeTrades; const normalizeBookChanges = (exchange, localTimestamp) => { const createBookChangesMapper = bookChangeMappers[exchange]; if (createBookChangesMapper === undefined) { throw new Error(`normalizeBookChanges: ${exchange} not supported`); } return createBookChangesMapper(localTimestamp); }; exports.normalizeBookChanges = normalizeBookChanges; const normalizeDerivativeTickers = (exchange, localTimestamp) => { const createDerivativeTickerMapper = derivativeTickersMappers[exchange]; if (createDerivativeTickerMapper === undefined) { throw new Error(`normalizeDerivativeTickers: ${exchange} not supported`); } return createDerivativeTickerMapper(localTimestamp); }; exports.normalizeDerivativeTickers = normalizeDerivativeTickers; const normalizeOptionsSummary = (exchange, localTimestamp) => { const createOptionSummaryMapper = optionsSummaryMappers[exchange]; if (createOptionSummaryMapper === undefined) { throw new Error(`normalizeOptionsSummary: ${exchange} not supported`); } return createOptionSummaryMapper(localTimestamp); }; exports.normalizeOptionsSummary = normalizeOptionsSummary; const normalizeLiquidations = (exchange, localTimestamp) => { const createLiquidationsMapper = liquidationsMappers[exchange]; if (createLiquidationsMapper === undefined) { throw new Error(`normalizeLiquidations: ${exchange} not supported`); } return createLiquidationsMapper(localTimestamp); }; exports.normalizeLiquidations = normalizeLiquidations; const normalizeBookTickers = (exchange, localTimestamp) => { const createTickerMapper = bookTickersMappers[exchange]; if (createTickerMapper === undefined) { throw new Error(`normalizeBookTickers: ${exchange} not supported`); } return createTickerMapper(localTimestamp); }; exports.normalizeBookTickers = normalizeBookTickers; //# sourceMappingURL=index.js.map