tardis-dev 18.10.0 → 18.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/handy.d.ts +2 -3
- package/dist/handy.d.ts.map +1 -1
- package/dist/handy.js +3 -12
- package/dist/handy.js.map +1 -1
- package/dist/mappers/ascendex.js +4 -4
- package/dist/mappers/ascendex.js.map +1 -1
- package/dist/mappers/aster.js +5 -5
- package/dist/mappers/aster.js.map +1 -1
- package/dist/mappers/backpack.d.ts.map +1 -1
- package/dist/mappers/backpack.js +42 -32
- package/dist/mappers/backpack.js.map +1 -1
- package/dist/mappers/binance.js +6 -6
- package/dist/mappers/binance.js.map +1 -1
- package/dist/mappers/binancedex.js +3 -3
- package/dist/mappers/binancedex.js.map +1 -1
- package/dist/mappers/binanceeuropeanoptions.js +11 -33
- package/dist/mappers/binanceeuropeanoptions.js.map +1 -1
- package/dist/mappers/bitfinex.js +5 -9
- package/dist/mappers/bitfinex.js.map +1 -1
- package/dist/mappers/bitflyer.js +3 -3
- package/dist/mappers/bitflyer.js.map +1 -1
- package/dist/mappers/bitget.js +9 -14
- package/dist/mappers/bitget.js.map +1 -1
- package/dist/mappers/bithumb.js +2 -2
- package/dist/mappers/bithumb.js.map +1 -1
- package/dist/mappers/bitmex.js +5 -5
- package/dist/mappers/bitmex.js.map +1 -1
- package/dist/mappers/bitnomial.js +2 -2
- package/dist/mappers/bitnomial.js.map +1 -1
- package/dist/mappers/bitstamp.js +3 -3
- package/dist/mappers/bitstamp.js.map +1 -1
- package/dist/mappers/bitvavo.js +3 -3
- package/dist/mappers/bitvavo.js.map +1 -1
- package/dist/mappers/blockchaincom.js +2 -2
- package/dist/mappers/blockchaincom.js.map +1 -1
- package/dist/mappers/bullish.js +7 -7
- package/dist/mappers/bullish.js.map +1 -1
- package/dist/mappers/bybit.js +11 -11
- package/dist/mappers/bybit.js.map +1 -1
- package/dist/mappers/bybitspot.d.ts +3 -3
- package/dist/mappers/bybitspot.d.ts.map +1 -1
- package/dist/mappers/bybitspot.js +3 -3
- package/dist/mappers/bybitspot.js.map +1 -1
- package/dist/mappers/coinbase.js +3 -3
- package/dist/mappers/coinbase.js.map +1 -1
- package/dist/mappers/coinbasederivatives.js +4 -4
- package/dist/mappers/coinbasederivatives.js.map +1 -1
- package/dist/mappers/coinbaseinternational.js +8 -8
- package/dist/mappers/coinbaseinternational.js.map +1 -1
- package/dist/mappers/coinflex.js +3 -3
- package/dist/mappers/coinflex.js.map +1 -1
- package/dist/mappers/cryptocom.js +5 -8
- package/dist/mappers/cryptocom.js.map +1 -1
- package/dist/mappers/cryptofacilities.js +6 -6
- package/dist/mappers/cryptofacilities.js.map +1 -1
- package/dist/mappers/delta.js +4 -4
- package/dist/mappers/delta.js.map +1 -1
- package/dist/mappers/delta_india.js +8 -14
- package/dist/mappers/delta_india.js.map +1 -1
- package/dist/mappers/deribit.js +17 -20
- package/dist/mappers/deribit.js.map +1 -1
- package/dist/mappers/dydx.js +3 -3
- package/dist/mappers/dydx.js.map +1 -1
- package/dist/mappers/dydxv4.js +4 -4
- package/dist/mappers/dydxv4.js.map +1 -1
- package/dist/mappers/ftx.js +5 -5
- package/dist/mappers/ftx.js.map +1 -1
- package/dist/mappers/gateio.js +6 -6
- package/dist/mappers/gateio.js.map +1 -1
- package/dist/mappers/gateiofutures.js +6 -6
- package/dist/mappers/gateiofutures.js.map +1 -1
- package/dist/mappers/gemini.js +5 -5
- package/dist/mappers/gemini.js.map +1 -1
- package/dist/mappers/hitbtc.js +2 -2
- package/dist/mappers/hitbtc.js.map +1 -1
- package/dist/mappers/huobi.js +20 -27
- package/dist/mappers/huobi.js.map +1 -1
- package/dist/mappers/hyperliquid.js +5 -8
- package/dist/mappers/hyperliquid.js.map +1 -1
- package/dist/mappers/kraken.js +6 -6
- package/dist/mappers/kraken.js.map +1 -1
- package/dist/mappers/kucoin.js +3 -3
- package/dist/mappers/kucoin.js.map +1 -1
- package/dist/mappers/kucoinfutures.js +4 -4
- package/dist/mappers/kucoinfutures.js.map +1 -1
- package/dist/mappers/lighter.js +5 -5
- package/dist/mappers/lighter.js.map +1 -1
- package/dist/mappers/mapper.d.ts +3 -3
- package/dist/mappers/mexc.d.ts +4 -4
- package/dist/mappers/mexc.d.ts.map +1 -1
- package/dist/mappers/mexc.js +3 -3
- package/dist/mappers/mexc.js.map +1 -1
- package/dist/mappers/mexcfutures.d.ts +5 -5
- package/dist/mappers/mexcfutures.d.ts.map +1 -1
- package/dist/mappers/mexcfutures.js +3 -3
- package/dist/mappers/mexcfutures.js.map +1 -1
- package/dist/mappers/okex.js +19 -21
- package/dist/mappers/okex.js.map +1 -1
- package/dist/mappers/okexspreads.d.ts +3 -3
- package/dist/mappers/okexspreads.d.ts.map +1 -1
- package/dist/mappers/okexspreads.js +3 -3
- package/dist/mappers/okexspreads.js.map +1 -1
- package/dist/mappers/phemex.js +18 -12
- package/dist/mappers/phemex.js.map +1 -1
- package/dist/mappers/poloniex.js +4 -4
- package/dist/mappers/poloniex.js.map +1 -1
- package/dist/mappers/polymarket.js +3 -3
- package/dist/mappers/polymarket.js.map +1 -1
- package/dist/mappers/serum.js +3 -3
- package/dist/mappers/serum.js.map +1 -1
- package/dist/mappers/upbit.js +2 -2
- package/dist/mappers/upbit.js.map +1 -1
- package/dist/mappers/whitebit.js +8 -12
- package/dist/mappers/whitebit.js.map +1 -1
- package/dist/mappers/woox.js +10 -12
- package/dist/mappers/woox.js.map +1 -1
- package/dist/realtimefeeds/delta.d.ts.map +1 -1
- package/dist/realtimefeeds/delta.js +3 -0
- package/dist/realtimefeeds/delta.js.map +1 -1
- package/dist/realtimefeeds/ftx.d.ts.map +1 -1
- package/dist/realtimefeeds/ftx.js +5 -4
- package/dist/realtimefeeds/ftx.js.map +1 -1
- package/dist/realtimefeeds/huobi.d.ts +3 -3
- package/dist/realtimefeeds/huobi.d.ts.map +1 -1
- package/dist/realtimefeeds/huobi.js +21 -12
- package/dist/realtimefeeds/huobi.js.map +1 -1
- package/dist/realtimefeeds/phemex.d.ts.map +1 -1
- package/dist/realtimefeeds/phemex.js +1 -0
- package/dist/realtimefeeds/phemex.js.map +1 -1
- package/dist/realtimefeeds/whitebit.d.ts.map +1 -1
- package/dist/realtimefeeds/whitebit.js +9 -4
- package/dist/realtimefeeds/whitebit.js.map +1 -1
- package/package.json +1 -1
- package/src/handy.ts +5 -15
- package/src/mappers/ascendex.ts +4 -4
- package/src/mappers/aster.ts +5 -5
- package/src/mappers/backpack.ts +45 -35
- package/src/mappers/binance.ts +6 -6
- package/src/mappers/binancedex.ts +3 -3
- package/src/mappers/binanceeuropeanoptions.ts +11 -39
- package/src/mappers/bitfinex.ts +5 -9
- package/src/mappers/bitflyer.ts +3 -3
- package/src/mappers/bitget.ts +9 -14
- package/src/mappers/bithumb.ts +2 -2
- package/src/mappers/bitmex.ts +5 -5
- package/src/mappers/bitnomial.ts +2 -2
- package/src/mappers/bitstamp.ts +3 -3
- package/src/mappers/bitvavo.ts +3 -3
- package/src/mappers/blockchaincom.ts +2 -2
- package/src/mappers/bullish.ts +7 -7
- package/src/mappers/bybit.ts +11 -11
- package/src/mappers/bybitspot.ts +3 -3
- package/src/mappers/coinbase.ts +3 -3
- package/src/mappers/coinbasederivatives.ts +4 -4
- package/src/mappers/coinbaseinternational.ts +9 -9
- package/src/mappers/coinflex.ts +3 -3
- package/src/mappers/cryptocom.ts +5 -8
- package/src/mappers/cryptofacilities.ts +6 -6
- package/src/mappers/delta.ts +4 -4
- package/src/mappers/delta_india.ts +8 -14
- package/src/mappers/deribit.ts +17 -21
- package/src/mappers/dydx.ts +3 -3
- package/src/mappers/dydxv4.ts +4 -4
- package/src/mappers/ftx.ts +5 -5
- package/src/mappers/gateio.ts +6 -6
- package/src/mappers/gateiofutures.ts +6 -6
- package/src/mappers/gemini.ts +5 -5
- package/src/mappers/hitbtc.ts +2 -2
- package/src/mappers/huobi.ts +21 -29
- package/src/mappers/hyperliquid.ts +6 -9
- package/src/mappers/kraken.ts +6 -6
- package/src/mappers/kucoin.ts +3 -3
- package/src/mappers/kucoinfutures.ts +4 -4
- package/src/mappers/lighter.ts +5 -5
- package/src/mappers/mapper.ts +3 -3
- package/src/mappers/mexc.ts +3 -3
- package/src/mappers/mexcfutures.ts +3 -3
- package/src/mappers/okex.ts +19 -25
- package/src/mappers/okexspreads.ts +3 -3
- package/src/mappers/phemex.ts +18 -12
- package/src/mappers/poloniex.ts +4 -4
- package/src/mappers/polymarket.ts +3 -3
- package/src/mappers/serum.ts +3 -3
- package/src/mappers/upbit.ts +2 -2
- package/src/mappers/whitebit.ts +8 -14
- package/src/mappers/woox.ts +10 -13
- package/src/realtimefeeds/delta.ts +4 -0
- package/src/realtimefeeds/ftx.ts +6 -4
- package/src/realtimefeeds/huobi.ts +27 -12
- package/src/realtimefeeds/phemex.ts +1 -0
- package/src/realtimefeeds/whitebit.ts +9 -4
package/src/mappers/okex.ts
CHANGED
|
@@ -150,7 +150,7 @@ class OkexV5TradesMapper implements Mapper<OKEX_EXCHANGES, Trade> {
|
|
|
150
150
|
return message.arg.channel === 'trades' || message.arg.channel === 'trades-all'
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
getFilters(symbols
|
|
153
|
+
getFilters(symbols: string[] = []) {
|
|
154
154
|
symbols = upperCaseSymbols(symbols)
|
|
155
155
|
|
|
156
156
|
if (this._useTradesAll) {
|
|
@@ -237,7 +237,7 @@ class OkexV5BookChangeMapper implements Mapper<OKEX_EXCHANGES, BookChange> {
|
|
|
237
237
|
return 'books'
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
getFilters(symbols
|
|
240
|
+
getFilters(symbols: string[] = []) {
|
|
241
241
|
symbols = upperCaseSymbols(symbols)
|
|
242
242
|
|
|
243
243
|
return [
|
|
@@ -296,7 +296,7 @@ class OkexV5BookTickerMapper implements Mapper<OKEX_EXCHANGES, BookTicker> {
|
|
|
296
296
|
return message.arg.channel === 'tickers'
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
getFilters(symbols
|
|
299
|
+
getFilters(symbols: string[] = []) {
|
|
300
300
|
symbols = upperCaseSymbols(symbols)
|
|
301
301
|
|
|
302
302
|
if (this._useTbtTickerChannel) {
|
|
@@ -394,13 +394,13 @@ class OkexV5DerivativeTickerMapper implements Mapper<'okex-futures' | 'okex-swap
|
|
|
394
394
|
return channels.includes(message.arg.channel)
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
-
getFilters(symbols
|
|
397
|
+
getFilters(symbols: string[] = []) {
|
|
398
398
|
symbols = upperCaseSymbols(symbols)
|
|
399
399
|
|
|
400
400
|
const channels = this._exchange === 'okex-futures' ? this._futuresChannels : this._swapChannels
|
|
401
401
|
return channels.map((channel) => {
|
|
402
402
|
if (channel === 'index-tickers') {
|
|
403
|
-
const indexes = symbols
|
|
403
|
+
const indexes = symbols.map((symbol) => this._getIndexSymbol(symbol))
|
|
404
404
|
|
|
405
405
|
return {
|
|
406
406
|
channel,
|
|
@@ -516,7 +516,7 @@ class OkexV5LiquidationsMapper implements Mapper<OKEX_EXCHANGES, Liquidation> {
|
|
|
516
516
|
return message.arg.channel === 'liquidations' || message.arg.channel === 'liquidation-orders'
|
|
517
517
|
}
|
|
518
518
|
|
|
519
|
-
getFilters(symbols
|
|
519
|
+
getFilters(symbols: string[] = []) {
|
|
520
520
|
symbols = upperCaseSymbols(symbols)
|
|
521
521
|
|
|
522
522
|
return [
|
|
@@ -597,13 +597,10 @@ class OkexV5OptionSummaryMapper implements Mapper<'okex-options', OptionSummary>
|
|
|
597
597
|
)
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
-
getFilters(symbols
|
|
600
|
+
getFilters(symbols: string[] = []) {
|
|
601
601
|
symbols = upperCaseSymbols(symbols)
|
|
602
|
-
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
const optionSummaryInstrumentFamilies =
|
|
606
|
-
symbols !== undefined ? [...new Set(symbols.map((s) => getOkexOptionsFamilyOrIndex(s)))] : undefined
|
|
602
|
+
const indexes = [...new Set(symbols.map((s) => getOkexOptionsUnderlyingIndex(s)))]
|
|
603
|
+
const optionSummaryInstrumentFamilies = [...new Set(symbols.map((s) => getOkexOptionsFamilyOrIndex(s)))]
|
|
607
604
|
|
|
608
605
|
return [
|
|
609
606
|
{
|
|
@@ -893,7 +890,7 @@ class OkexTradesMapper implements Mapper<OKEX_EXCHANGES, Trade> {
|
|
|
893
890
|
return message.table === `${this._market}/trade`
|
|
894
891
|
}
|
|
895
892
|
|
|
896
|
-
getFilters(symbols
|
|
893
|
+
getFilters(symbols: string[] = []) {
|
|
897
894
|
symbols = upperCaseSymbols(symbols)
|
|
898
895
|
|
|
899
896
|
return [
|
|
@@ -948,7 +945,7 @@ class OkexBookChangeMapper implements Mapper<OKEX_EXCHANGES, BookChange> {
|
|
|
948
945
|
return message.table === `${this._market}/${channelSuffix}`
|
|
949
946
|
}
|
|
950
947
|
|
|
951
|
-
getFilters(symbols
|
|
948
|
+
getFilters(symbols: string[] = []) {
|
|
952
949
|
symbols = upperCaseSymbols(symbols)
|
|
953
950
|
|
|
954
951
|
if (this._canUseTickByTickChannel) {
|
|
@@ -1014,7 +1011,7 @@ class OkexDerivativeTickerMapper implements Mapper<'okex-futures' | 'okex-swap',
|
|
|
1014
1011
|
return channels.includes(message.table)
|
|
1015
1012
|
}
|
|
1016
1013
|
|
|
1017
|
-
getFilters(symbols
|
|
1014
|
+
getFilters(symbols: string[] = []) {
|
|
1018
1015
|
symbols = upperCaseSymbols(symbols)
|
|
1019
1016
|
|
|
1020
1017
|
const channels = this._exchange === 'okex-futures' ? this._futuresChannels : this._swapChannels
|
|
@@ -1072,16 +1069,13 @@ class OkexOptionSummaryMapper implements Mapper<'okex-options', OptionSummary> {
|
|
|
1072
1069
|
return message.table === 'index/ticker' || message.table === 'option/summary'
|
|
1073
1070
|
}
|
|
1074
1071
|
|
|
1075
|
-
getFilters(symbols
|
|
1072
|
+
getFilters(symbols: string[] = []) {
|
|
1076
1073
|
symbols = upperCaseSymbols(symbols)
|
|
1077
1074
|
|
|
1078
|
-
const indexes =
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
return `${symbolParts[0]}-${symbolParts[1]}`
|
|
1083
|
-
})
|
|
1084
|
-
: undefined
|
|
1075
|
+
const indexes = symbols.map((s) => {
|
|
1076
|
+
const symbolParts = s.split('-')
|
|
1077
|
+
return `${symbolParts[0]}-${symbolParts[1]}`
|
|
1078
|
+
})
|
|
1085
1079
|
|
|
1086
1080
|
return [
|
|
1087
1081
|
{
|
|
@@ -1170,7 +1164,7 @@ class OkexLiquidationsMapper implements Mapper<OKEX_EXCHANGES, Liquidation> {
|
|
|
1170
1164
|
return message.table === `${this._market}/liquidation`
|
|
1171
1165
|
}
|
|
1172
1166
|
|
|
1173
|
-
getFilters(symbols
|
|
1167
|
+
getFilters(symbols: string[] = []) {
|
|
1174
1168
|
symbols = upperCaseSymbols(symbols)
|
|
1175
1169
|
|
|
1176
1170
|
return [
|
|
@@ -1213,7 +1207,7 @@ class OkexBookTickerMapper implements Mapper<OKEX_EXCHANGES, BookTicker> {
|
|
|
1213
1207
|
return message.table === `${this._market}/ticker`
|
|
1214
1208
|
}
|
|
1215
1209
|
|
|
1216
|
-
getFilters(symbols
|
|
1210
|
+
getFilters(symbols: string[] = []) {
|
|
1217
1211
|
symbols = upperCaseSymbols(symbols)
|
|
1218
1212
|
|
|
1219
1213
|
return [
|
|
@@ -10,7 +10,7 @@ export class OkexSpreadsTradesMapper implements Mapper<'okex-spreads', Trade> {
|
|
|
10
10
|
return message.arg.channel === 'sprd-public-trades'
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
getFilters(symbols
|
|
13
|
+
getFilters(symbols: string[] = []) {
|
|
14
14
|
symbols = upperCaseSymbols(symbols)
|
|
15
15
|
|
|
16
16
|
return [
|
|
@@ -54,7 +54,7 @@ export class OkexSpreadsBookChangeMapper implements Mapper<'okex-spreads', BookC
|
|
|
54
54
|
return message.arg.channel === 'sprd-books5'
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
getFilters(symbols
|
|
57
|
+
getFilters(symbols: string[] = []) {
|
|
58
58
|
symbols = upperCaseSymbols(symbols)
|
|
59
59
|
return [
|
|
60
60
|
{
|
|
@@ -95,7 +95,7 @@ export class OkexSpreadsBookTickerMapper implements Mapper<'okex-spreads', BookT
|
|
|
95
95
|
return message.arg.channel === 'sprd-bbo-tbt'
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
getFilters(symbols
|
|
98
|
+
getFilters(symbols: string[] = []) {
|
|
99
99
|
symbols = upperCaseSymbols(symbols)
|
|
100
100
|
|
|
101
101
|
return [
|
package/src/mappers/phemex.ts
CHANGED
|
@@ -269,14 +269,16 @@ const phemexTradesMapper: Mapper<'phemex', Trade> = {
|
|
|
269
269
|
return message.type === 'incremental' && ('trades' in message || 'trades_p' in message)
|
|
270
270
|
},
|
|
271
271
|
|
|
272
|
-
getFilters(symbols
|
|
273
|
-
if (symbols
|
|
272
|
+
getFilters(symbols: string[] = []) {
|
|
273
|
+
if (symbols.length === 0) {
|
|
274
274
|
return [
|
|
275
275
|
{
|
|
276
|
-
channel: 'trades'
|
|
276
|
+
channel: 'trades',
|
|
277
|
+
symbols
|
|
277
278
|
} as const,
|
|
278
279
|
{
|
|
279
|
-
channel: 'trades_p'
|
|
280
|
+
channel: 'trades_p',
|
|
281
|
+
symbols
|
|
280
282
|
} as const
|
|
281
283
|
]
|
|
282
284
|
}
|
|
@@ -360,14 +362,16 @@ const phemexBookChangeMapper: Mapper<'phemex', BookChange> = {
|
|
|
360
362
|
return 'book' in message || 'orderbook_p' in message
|
|
361
363
|
},
|
|
362
364
|
|
|
363
|
-
getFilters(symbols
|
|
364
|
-
if (symbols
|
|
365
|
+
getFilters(symbols: string[] = []) {
|
|
366
|
+
if (symbols.length === 0) {
|
|
365
367
|
return [
|
|
366
368
|
{
|
|
367
|
-
channel: 'book'
|
|
369
|
+
channel: 'book',
|
|
370
|
+
symbols
|
|
368
371
|
} as const,
|
|
369
372
|
{
|
|
370
|
-
channel: 'orderbook_p'
|
|
373
|
+
channel: 'orderbook_p',
|
|
374
|
+
symbols
|
|
371
375
|
} as const
|
|
372
376
|
]
|
|
373
377
|
}
|
|
@@ -432,14 +436,16 @@ class PhemexDerivativeTickerMapper implements Mapper<'phemex', DerivativeTicker>
|
|
|
432
436
|
return 'market24h' in message || message.method === 'perp_market24h_pack_p.update'
|
|
433
437
|
}
|
|
434
438
|
|
|
435
|
-
getFilters(symbols
|
|
436
|
-
if (symbols
|
|
439
|
+
getFilters(symbols: string[] = []) {
|
|
440
|
+
if (symbols.length === 0) {
|
|
437
441
|
return [
|
|
438
442
|
{
|
|
439
|
-
channel: 'market24h'
|
|
443
|
+
channel: 'market24h',
|
|
444
|
+
symbols
|
|
440
445
|
} as const,
|
|
441
446
|
{
|
|
442
|
-
channel: 'perp_market24h_pack_p'
|
|
447
|
+
channel: 'perp_market24h_pack_p',
|
|
448
|
+
symbols
|
|
443
449
|
} as const
|
|
444
450
|
]
|
|
445
451
|
}
|
package/src/mappers/poloniex.ts
CHANGED
|
@@ -23,7 +23,7 @@ class PoloniexV2TradesMapper implements Mapper<'poloniex', Trade> {
|
|
|
23
23
|
return message.channel === 'trades' && message.data !== undefined && message.data.length > 0
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
getFilters(symbols
|
|
26
|
+
getFilters(symbols: string[] = []) {
|
|
27
27
|
symbols = upperCaseSymbols(symbols)
|
|
28
28
|
|
|
29
29
|
return [
|
|
@@ -62,7 +62,7 @@ class PoloniexV2BookChangeMapper implements Mapper<'poloniex', BookChange> {
|
|
|
62
62
|
return message.channel === 'book_lv2' && message.data !== undefined && message.data.length > 0
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
getFilters(symbols
|
|
65
|
+
getFilters(symbols: string[] = []) {
|
|
66
66
|
symbols = upperCaseSymbols(symbols)
|
|
67
67
|
|
|
68
68
|
return [
|
|
@@ -110,7 +110,7 @@ class PoloniexTradesMapper implements Mapper<'poloniex', Trade> {
|
|
|
110
110
|
return message[2].some((m) => m[0] === 't')
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
getFilters(symbols
|
|
113
|
+
getFilters(symbols: string[] = []) {
|
|
114
114
|
symbols = upperCaseSymbols(symbols)
|
|
115
115
|
|
|
116
116
|
return [
|
|
@@ -186,7 +186,7 @@ class PoloniexBookChangeMapper implements Mapper<'poloniex', BookChange> {
|
|
|
186
186
|
return message[2].some((m) => m[0] === 'i' || m[0] === 'o')
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
getFilters(symbols
|
|
189
|
+
getFilters(symbols: string[] = []) {
|
|
190
190
|
symbols = upperCaseSymbols(symbols)
|
|
191
191
|
|
|
192
192
|
return [
|
|
@@ -20,7 +20,7 @@ class PolymarketBookChangeMapper implements Mapper<'polymarket', BookChange> {
|
|
|
20
20
|
return isPolymarketClobPriceChangeMessage(message) || isPolymarketClobBookMessage(message)
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
getFilters(symbols
|
|
23
|
+
getFilters(symbols: string[] = []) {
|
|
24
24
|
return [
|
|
25
25
|
{ channel: 'book' as const, symbols },
|
|
26
26
|
{ channel: 'price_change' as const, symbols }
|
|
@@ -90,7 +90,7 @@ class PolymarketTradesMapper implements Mapper<'polymarket', Trade> {
|
|
|
90
90
|
return message.event_type === 'last_trade_price'
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
getFilters(symbols
|
|
93
|
+
getFilters(symbols: string[] = []) {
|
|
94
94
|
return [{ channel: 'last_trade_price' as const, symbols }]
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -114,7 +114,7 @@ class PolymarketBookTickerMapper implements Mapper<'polymarket', BookTicker> {
|
|
|
114
114
|
return message.event_type === 'best_bid_ask'
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
getFilters(symbols
|
|
117
|
+
getFilters(symbols: string[] = []) {
|
|
118
118
|
return [{ channel: 'best_bid_ask' as const, symbols }]
|
|
119
119
|
}
|
|
120
120
|
|
package/src/mappers/serum.ts
CHANGED
|
@@ -28,7 +28,7 @@ class SerumTradesMapper implements Mapper<'serum' | 'star-atlas', Trade> {
|
|
|
28
28
|
return message.type === 'trade'
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
getFilters(symbols
|
|
31
|
+
getFilters(symbols: string[] = []) {
|
|
32
32
|
if (this._exchange === 'serum') {
|
|
33
33
|
symbols = upperCaseSymbols(symbols)
|
|
34
34
|
}
|
|
@@ -63,7 +63,7 @@ class SerumBookChangeMapper implements Mapper<'serum' | 'star-atlas', BookChange
|
|
|
63
63
|
return message.type === 'l2snapshot' || message.type === 'l2update'
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
getFilters(symbols
|
|
66
|
+
getFilters(symbols: string[] = []) {
|
|
67
67
|
if (this._exchange === 'serum') {
|
|
68
68
|
symbols = upperCaseSymbols(symbols)
|
|
69
69
|
}
|
|
@@ -107,7 +107,7 @@ class SerumBookTickerMapper implements Mapper<'serum' | 'star-atlas', BookTicker
|
|
|
107
107
|
return message.type === 'quote'
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
getFilters(symbols
|
|
110
|
+
getFilters(symbols: string[] = []) {
|
|
111
111
|
if (this._exchange === 'serum') {
|
|
112
112
|
symbols = upperCaseSymbols(symbols)
|
|
113
113
|
}
|
package/src/mappers/upbit.ts
CHANGED
|
@@ -15,7 +15,7 @@ class UpbitTradesMapper implements Mapper<'upbit', Trade> {
|
|
|
15
15
|
return message.type === 'trade'
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
getFilters(symbols
|
|
18
|
+
getFilters(symbols: string[] = []) {
|
|
19
19
|
symbols = upperCaseSymbols(symbols)
|
|
20
20
|
|
|
21
21
|
return [
|
|
@@ -46,7 +46,7 @@ class UpbitBookChangeMapper implements Mapper<'upbit', BookChange> {
|
|
|
46
46
|
return message.type === 'orderbook'
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
getFilters(symbols
|
|
49
|
+
getFilters(symbols: string[] = []) {
|
|
50
50
|
symbols = upperCaseSymbols(symbols)
|
|
51
51
|
|
|
52
52
|
return [
|
package/src/mappers/whitebit.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { asNonZeroNumberOrUndefined, asNumberOrUndefined, fromMicroSecondsToDate,
|
|
1
|
+
import { asNonZeroNumberOrUndefined, asNumberOrUndefined, fromMicroSecondsToDate, upperCaseSymbols } from '../handy.ts'
|
|
2
2
|
import { BookChange, BookTicker, DerivativeTicker, Trade } from '../types.ts'
|
|
3
3
|
import { Mapper, PendingTickerInfoHelper } from './mapper.ts'
|
|
4
4
|
import { exchangeMappers } from './registry.ts'
|
|
@@ -17,7 +17,7 @@ class WhiteBitTradesMapper implements Mapper<'whitebit', Trade> {
|
|
|
17
17
|
return message.method === 'trades_update'
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
getFilters(symbols
|
|
20
|
+
getFilters(symbols: string[] = []) {
|
|
21
21
|
return [{ channel: 'trades_update', symbols: upperCaseSymbols(symbols) } as const]
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -50,7 +50,7 @@ class WhiteBitBookChangeMapper implements Mapper<'whitebit', BookChange> {
|
|
|
50
50
|
return message.method === 'depth_update'
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
getFilters(symbols
|
|
53
|
+
getFilters(symbols: string[] = []) {
|
|
54
54
|
return [{ channel: 'depth_update', symbols: upperCaseSymbols(symbols) } as const]
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -82,7 +82,7 @@ class WhiteBitBookTickerMapper implements Mapper<'whitebit', BookTicker> {
|
|
|
82
82
|
return message.method === 'bookTicker_update'
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
getFilters(symbols
|
|
85
|
+
getFilters(symbols: string[] = []) {
|
|
86
86
|
return [{ channel: 'bookTicker_update', symbols: upperCaseSymbols(symbols) } as const]
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -108,22 +108,16 @@ class WhiteBitDerivativeTickerMapper implements Mapper<'whitebit', DerivativeTic
|
|
|
108
108
|
private readonly _symbolsWithTrades = new Set<string>()
|
|
109
109
|
|
|
110
110
|
canHandle(message: WhiteBitMessage) {
|
|
111
|
-
return
|
|
112
|
-
message.method === 'premiumIndex_update' ||
|
|
113
|
-
message.method === 'futures_update' ||
|
|
114
|
-
(message.method === 'trades_update' && (message as WhiteBitTrades).params[0].endsWith('_PERP'))
|
|
115
|
-
)
|
|
111
|
+
return message.method === 'premiumIndex_update' || message.method === 'futures_update' || message.method === 'trades_update'
|
|
116
112
|
}
|
|
117
113
|
|
|
118
|
-
getFilters(symbols
|
|
114
|
+
getFilters(symbols: string[] = []) {
|
|
119
115
|
symbols = upperCaseSymbols(symbols)
|
|
120
|
-
const perpetuals = symbols?.filter((symbol) => symbol.endsWith('_PERP')) ?? []
|
|
121
116
|
|
|
122
117
|
return [
|
|
123
118
|
{ channel: 'trades_update', symbols } as const,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
: [])
|
|
119
|
+
{ channel: 'premiumIndex_update', symbols } as const,
|
|
120
|
+
{ channel: 'futures_update', symbols } as const
|
|
127
121
|
]
|
|
128
122
|
}
|
|
129
123
|
|
package/src/mappers/woox.ts
CHANGED
|
@@ -30,7 +30,7 @@ const wooxTradesMapper: Mapper<'woo-x', Trade> = {
|
|
|
30
30
|
return message.topic !== undefined && message.topic.endsWith('@trade')
|
|
31
31
|
},
|
|
32
32
|
|
|
33
|
-
getFilters(symbols
|
|
33
|
+
getFilters(symbols: string[] = []) {
|
|
34
34
|
symbols = upperCaseSymbols(symbols)
|
|
35
35
|
|
|
36
36
|
return [
|
|
@@ -67,7 +67,7 @@ const wooxV3TradesMapper: Mapper<'woo-x', Trade> = {
|
|
|
67
67
|
return message.topic !== undefined && message.topic.startsWith('trade@')
|
|
68
68
|
},
|
|
69
69
|
|
|
70
|
-
getFilters(symbols
|
|
70
|
+
getFilters(symbols: string[] = []) {
|
|
71
71
|
symbols = upperCaseSymbols(symbols)
|
|
72
72
|
|
|
73
73
|
return [
|
|
@@ -112,7 +112,7 @@ class WooxBookChangeMapper implements Mapper<'woo-x', BookChange> {
|
|
|
112
112
|
return false
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
getFilters(symbols
|
|
115
|
+
getFilters(symbols: string[] = []) {
|
|
116
116
|
symbols = upperCaseSymbols(symbols)
|
|
117
117
|
|
|
118
118
|
return [
|
|
@@ -222,7 +222,7 @@ class WooxV3BookChangeMapper implements Mapper<'woo-x', BookChange> {
|
|
|
222
222
|
return message.topic.startsWith('orderbookupdate@')
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
getFilters(symbols
|
|
225
|
+
getFilters(symbols: string[] = []) {
|
|
226
226
|
symbols = upperCaseSymbols(symbols)
|
|
227
227
|
|
|
228
228
|
return [
|
|
@@ -350,9 +350,8 @@ class WooxDerivativeTickerMapper implements Mapper<'woo-x', DerivativeTicker> {
|
|
|
350
350
|
)
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
getFilters(symbols
|
|
353
|
+
getFilters(symbols: string[] = []) {
|
|
354
354
|
symbols = upperCaseSymbols(symbols)
|
|
355
|
-
const spotSymbols = symbols !== undefined ? symbols.map((s) => s.replace('PERP_', 'SPOT_')) : []
|
|
356
355
|
return [
|
|
357
356
|
{
|
|
358
357
|
channel: 'trade',
|
|
@@ -372,7 +371,7 @@ class WooxDerivativeTickerMapper implements Mapper<'woo-x', DerivativeTicker> {
|
|
|
372
371
|
},
|
|
373
372
|
{
|
|
374
373
|
channel: 'indexprice',
|
|
375
|
-
symbols:
|
|
374
|
+
symbols: symbols.map((s) => s.replace('PERP_', 'SPOT_'))
|
|
376
375
|
}
|
|
377
376
|
]
|
|
378
377
|
}
|
|
@@ -437,10 +436,8 @@ class WooxV3DerivativeTickerMapper implements Mapper<'woo-x', DerivativeTicker>
|
|
|
437
436
|
)
|
|
438
437
|
}
|
|
439
438
|
|
|
440
|
-
getFilters(symbols
|
|
439
|
+
getFilters(symbols: string[] = []) {
|
|
441
440
|
symbols = upperCaseSymbols(symbols)
|
|
442
|
-
const spotSymbols = symbols !== undefined ? symbols.map((s) => s.replace('PERP_', 'SPOT_')) : []
|
|
443
|
-
|
|
444
441
|
return [
|
|
445
442
|
{
|
|
446
443
|
channel: 'trade',
|
|
@@ -460,7 +457,7 @@ class WooxV3DerivativeTickerMapper implements Mapper<'woo-x', DerivativeTicker>
|
|
|
460
457
|
},
|
|
461
458
|
{
|
|
462
459
|
channel: 'indexprice',
|
|
463
|
-
symbols:
|
|
460
|
+
symbols: symbols.map((s) => s.replace('PERP_', 'SPOT_'))
|
|
464
461
|
}
|
|
465
462
|
]
|
|
466
463
|
}
|
|
@@ -515,7 +512,7 @@ class WooxBookTickerMapper implements Mapper<'woo-x', BookTicker> {
|
|
|
515
512
|
return message.topic !== undefined && message.topic.endsWith('@bbo')
|
|
516
513
|
}
|
|
517
514
|
|
|
518
|
-
getFilters(symbols
|
|
515
|
+
getFilters(symbols: string[] = []) {
|
|
519
516
|
symbols = upperCaseSymbols(symbols)
|
|
520
517
|
|
|
521
518
|
return [
|
|
@@ -551,7 +548,7 @@ class WooxV3BookTickerMapper implements Mapper<'woo-x', BookTicker> {
|
|
|
551
548
|
return message.topic !== undefined && message.topic.startsWith('bbo@')
|
|
552
549
|
}
|
|
553
550
|
|
|
554
|
-
getFilters(symbols
|
|
551
|
+
getFilters(symbols: string[] = []) {
|
|
555
552
|
symbols = upperCaseSymbols(symbols)
|
|
556
553
|
|
|
557
554
|
return [
|
|
@@ -6,6 +6,10 @@ export class DeltaRealTimeFeed extends RealTimeFeedBase {
|
|
|
6
6
|
|
|
7
7
|
protected mapToSubscribeMessages(filters: Filter<string>[]) {
|
|
8
8
|
return filters.map((filter) => {
|
|
9
|
+
if (filter.channel !== 'product_updates' && filter.channel !== 'announcements' && !filter.symbols?.length) {
|
|
10
|
+
throw new Error('DeltaRealTimeFeed requires explicitly specified symbols when subscribing to live feed')
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
return {
|
|
10
14
|
type: 'subscribe',
|
|
11
15
|
payload: {
|
package/src/realtimefeeds/ftx.ts
CHANGED
|
@@ -17,11 +17,9 @@ abstract class FTXRealTimeFeedBase extends MultiConnectionRealTimeFeedBase {
|
|
|
17
17
|
|
|
18
18
|
const instrumentInfoFilters = filters.filter((f) => f.channel === 'instrument')
|
|
19
19
|
if (instrumentInfoFilters.length > 0) {
|
|
20
|
-
const instruments = instrumentInfoFilters.flatMap((s) => s.symbols
|
|
20
|
+
const instruments = instrumentInfoFilters.flatMap((s) => s.symbols ?? [])
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
yield new FTXInstrumentInfoClient(exchange, this.httpURL, instruments, onError)
|
|
24
|
-
}
|
|
22
|
+
yield new FTXInstrumentInfoClient(exchange, this.httpURL, instruments, onError)
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
}
|
|
@@ -84,6 +82,10 @@ class FTXInstrumentInfoClient extends PoolingClientBase {
|
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
protected async poolDataToStream(outputStream: Writable) {
|
|
85
|
+
if (this._instruments.length === 0) {
|
|
86
|
+
throw new Error('FTXRealTimeFeed requires explicitly specified symbols when subscribing to live feed')
|
|
87
|
+
}
|
|
88
|
+
|
|
87
89
|
for (const instruments of batch(this._instruments, 10)) {
|
|
88
90
|
await Promise.allSettled(
|
|
89
91
|
instruments.map(async (instrument) => {
|
|
@@ -49,24 +49,24 @@ abstract class HuobiRealTimeFeedBase extends MultiConnectionRealTimeFeedBase {
|
|
|
49
49
|
const openInterestFilters = filters.filter((f) => f.channel === 'open_interest')
|
|
50
50
|
|
|
51
51
|
if (openInterestFilters.length > 0) {
|
|
52
|
-
const instruments = openInterestFilters.flatMap((s) => s.symbols
|
|
52
|
+
const instruments = openInterestFilters.flatMap((s) => s.symbols ?? [])
|
|
53
53
|
|
|
54
|
-
yield new HuobiOpenInterestClient(exchange, this.httpURL, instruments, this.getOpenInterestURLPath.bind(this))
|
|
54
|
+
yield new HuobiOpenInterestClient(exchange, this.httpURL, instruments, this.getOpenInterestURLPath.bind(this), onError)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
const optionMarketIndexFilters = filters.filter((f) => f.channel === 'option_market_index')
|
|
58
58
|
if (optionMarketIndexFilters.length > 0) {
|
|
59
|
-
const instruments = optionMarketIndexFilters.flatMap((s) => s.symbols
|
|
59
|
+
const instruments = optionMarketIndexFilters.flatMap((s) => s.symbols ?? [])
|
|
60
60
|
|
|
61
|
-
yield new HuobiOptionsMarketIndexClient(exchange, this.httpURL, instruments)
|
|
61
|
+
yield new HuobiOptionsMarketIndexClient(exchange, this.httpURL, instruments, onError)
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
const optionIndexFilters = filters.filter((f) => f.channel === 'option_index')
|
|
65
65
|
|
|
66
66
|
if (optionIndexFilters.length > 0) {
|
|
67
|
-
const instruments = optionIndexFilters.flatMap((s) => s.symbols
|
|
67
|
+
const instruments = optionIndexFilters.flatMap((s) => s.symbols ?? [])
|
|
68
68
|
|
|
69
|
-
yield new HuobiOptionsIndexClient(exchange, this.httpURL, instruments)
|
|
69
|
+
yield new HuobiOptionsIndexClient(exchange, this.httpURL, instruments, onError)
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -239,12 +239,17 @@ class HuobiOpenInterestClient extends PoolingClientBase {
|
|
|
239
239
|
exchange: string,
|
|
240
240
|
private readonly _httpURL: string,
|
|
241
241
|
private readonly _instruments: string[],
|
|
242
|
-
private readonly _getURLPath: (symbol: string) => string
|
|
242
|
+
private readonly _getURLPath: (symbol: string) => string,
|
|
243
|
+
onError?: (error: Error) => void
|
|
243
244
|
) {
|
|
244
|
-
super(exchange, 4)
|
|
245
|
+
super(exchange, 4, onError)
|
|
245
246
|
}
|
|
246
247
|
|
|
247
248
|
protected async poolDataToStream(outputStream: Writable) {
|
|
249
|
+
if (this._instruments.length === 0) {
|
|
250
|
+
throw new Error('HuobiRealTimeFeed requires explicitly specified symbols when subscribing to live feed')
|
|
251
|
+
}
|
|
252
|
+
|
|
248
253
|
for (const instruments of batch(this._instruments, 10)) {
|
|
249
254
|
await Promise.allSettled(
|
|
250
255
|
instruments.map(async (instrument) => {
|
|
@@ -278,12 +283,17 @@ class HuobiOptionsMarketIndexClient extends PoolingClientBase {
|
|
|
278
283
|
constructor(
|
|
279
284
|
exchange: string,
|
|
280
285
|
private readonly _httpURL: string,
|
|
281
|
-
private readonly _instruments: string[]
|
|
286
|
+
private readonly _instruments: string[],
|
|
287
|
+
onError?: (error: Error) => void
|
|
282
288
|
) {
|
|
283
|
-
super(exchange, 4)
|
|
289
|
+
super(exchange, 4, onError)
|
|
284
290
|
}
|
|
285
291
|
|
|
286
292
|
protected async poolDataToStream(outputStream: Writable) {
|
|
293
|
+
if (this._instruments.length === 0) {
|
|
294
|
+
throw new Error('HuobiRealTimeFeed requires explicitly specified symbols when subscribing to live feed')
|
|
295
|
+
}
|
|
296
|
+
|
|
287
297
|
for (const instruments of batch(this._instruments, 10)) {
|
|
288
298
|
await Promise.all(
|
|
289
299
|
instruments.map(async (instrument) => {
|
|
@@ -317,12 +327,17 @@ class HuobiOptionsIndexClient extends PoolingClientBase {
|
|
|
317
327
|
constructor(
|
|
318
328
|
exchange: string,
|
|
319
329
|
private readonly _httpURL: string,
|
|
320
|
-
private readonly _instruments: string[]
|
|
330
|
+
private readonly _instruments: string[],
|
|
331
|
+
onError?: (error: Error) => void
|
|
321
332
|
) {
|
|
322
|
-
super(exchange, 4)
|
|
333
|
+
super(exchange, 4, onError)
|
|
323
334
|
}
|
|
324
335
|
|
|
325
336
|
protected async poolDataToStream(outputStream: Writable) {
|
|
337
|
+
if (this._instruments.length === 0) {
|
|
338
|
+
throw new Error('HuobiRealTimeFeed requires explicitly specified symbols when subscribing to live feed')
|
|
339
|
+
}
|
|
340
|
+
|
|
326
341
|
for (const instruments of batch(this._instruments, 10)) {
|
|
327
342
|
await Promise.allSettled(
|
|
328
343
|
instruments.map(async (instrument) => {
|
|
@@ -22,6 +22,7 @@ export class PhemexRealTimeFeed extends RealTimeFeedBase {
|
|
|
22
22
|
.map((filter) => {
|
|
23
23
|
if (
|
|
24
24
|
filter.symbols !== undefined &&
|
|
25
|
+
filter.symbols.length > 0 &&
|
|
25
26
|
filter.channel !== 'market24h' &&
|
|
26
27
|
filter.channel !== 'spot_market24h' &&
|
|
27
28
|
filter.channel !== 'perp_market24h_pack_p'
|
|
@@ -8,10 +8,15 @@ export class WhiteBitRealTimeFeed extends MultiConnectionRealTimeFeedBase {
|
|
|
8
8
|
protected readonly httpURL: string = 'https://whitebit.com/api/v4/public'
|
|
9
9
|
|
|
10
10
|
protected *_getRealTimeFeeds(exchange: string, filters: Filter<string>[], timeoutIntervalMS?: number, onError?: (error: Error) => void) {
|
|
11
|
-
filters = filters.
|
|
12
|
-
|
|
13
|
-
symbols
|
|
14
|
-
|
|
11
|
+
filters = filters.flatMap((filter) => {
|
|
12
|
+
const symbols = filter.symbols?.map((symbol) => symbol.toUpperCase())
|
|
13
|
+
if (symbols?.length && (filter.channel === 'premiumIndex_update' || filter.channel === 'futures_update')) {
|
|
14
|
+
// Perpetual-only channels: WhiteBIT rejects a premiumIndex subscription that lists any spot market.
|
|
15
|
+
const perpetuals = symbols.filter((symbol) => symbol.endsWith('_PERP'))
|
|
16
|
+
return perpetuals.length > 0 ? [{ ...filter, symbols: perpetuals }] : []
|
|
17
|
+
}
|
|
18
|
+
return [{ ...filter, symbols }]
|
|
19
|
+
})
|
|
15
20
|
const webSocketFilters = filters.filter((filter) => filter.channel !== 'futures_update')
|
|
16
21
|
for (const filter of webSocketFilters) {
|
|
17
22
|
if (filter.symbols === undefined || filter.symbols.length === 0) {
|