tardis-dev 13.0.0 → 13.1.3
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/consts.d.ts +4 -4
- package/dist/consts.d.ts.map +1 -1
- package/dist/consts.js +58 -4
- package/dist/consts.js.map +1 -1
- package/dist/handy.d.ts +2 -0
- package/dist/handy.d.ts.map +1 -1
- package/dist/handy.js +15 -1
- package/dist/handy.js.map +1 -1
- package/dist/mappers/ascendex.d.ts +1 -1
- package/dist/mappers/ascendex.d.ts.map +1 -1
- package/dist/mappers/ascendex.js +5 -0
- package/dist/mappers/ascendex.js.map +1 -1
- package/dist/mappers/binance.d.ts +1 -1
- package/dist/mappers/binance.d.ts.map +1 -1
- package/dist/mappers/binance.js +5 -11
- package/dist/mappers/binance.js.map +1 -1
- package/dist/mappers/binancedex.d.ts +1 -1
- package/dist/mappers/binancedex.d.ts.map +1 -1
- package/dist/mappers/binancedex.js +4 -0
- package/dist/mappers/binancedex.js.map +1 -1
- package/dist/mappers/binanceoptions.d.ts.map +1 -1
- package/dist/mappers/binanceoptions.js +3 -0
- package/dist/mappers/binanceoptions.js.map +1 -1
- package/dist/mappers/bitfinex.d.ts +1 -1
- package/dist/mappers/bitfinex.d.ts.map +1 -1
- package/dist/mappers/bitfinex.js +5 -0
- package/dist/mappers/bitfinex.js.map +1 -1
- package/dist/mappers/bitflyer.d.ts +1 -1
- package/dist/mappers/bitflyer.d.ts.map +1 -1
- package/dist/mappers/bitflyer.js +3 -0
- package/dist/mappers/bitflyer.js.map +1 -1
- package/dist/mappers/bitmex.d.ts +1 -1
- package/dist/mappers/bitmex.d.ts.map +1 -1
- package/dist/mappers/bitmex.js +5 -0
- package/dist/mappers/bitmex.js.map +1 -1
- package/dist/mappers/bitstamp.d.ts.map +1 -1
- package/dist/mappers/bitstamp.js +3 -8
- package/dist/mappers/bitstamp.js.map +1 -1
- package/dist/mappers/bybit.d.ts.map +1 -1
- package/dist/mappers/bybit.js +5 -0
- package/dist/mappers/bybit.js.map +1 -1
- package/dist/mappers/coinbase.d.ts.map +1 -1
- package/dist/mappers/coinbase.js +3 -0
- package/dist/mappers/coinbase.js.map +1 -1
- package/dist/mappers/coinflex.d.ts +1 -1
- package/dist/mappers/coinflex.d.ts.map +1 -1
- package/dist/mappers/coinflex.js +4 -0
- package/dist/mappers/coinflex.js.map +1 -1
- package/dist/mappers/cryptofacilities.d.ts +1 -1
- package/dist/mappers/cryptofacilities.d.ts.map +1 -1
- package/dist/mappers/cryptofacilities.js +6 -0
- package/dist/mappers/cryptofacilities.js.map +1 -1
- package/dist/mappers/delta.d.ts +1 -1
- package/dist/mappers/delta.d.ts.map +1 -1
- package/dist/mappers/delta.js +4 -0
- package/dist/mappers/delta.js.map +1 -1
- package/dist/mappers/deribit.d.ts +1 -1
- package/dist/mappers/deribit.d.ts.map +1 -1
- package/dist/mappers/deribit.js +6 -0
- package/dist/mappers/deribit.js.map +1 -1
- package/dist/mappers/dydx.d.ts +1 -1
- package/dist/mappers/dydx.d.ts.map +1 -1
- package/dist/mappers/dydx.js +4 -0
- package/dist/mappers/dydx.js.map +1 -1
- package/dist/mappers/ftx.d.ts +1 -1
- package/dist/mappers/ftx.d.ts.map +1 -1
- package/dist/mappers/ftx.js +5 -0
- package/dist/mappers/ftx.js.map +1 -1
- package/dist/mappers/gateio.d.ts.map +1 -1
- package/dist/mappers/gateio.js +3 -0
- package/dist/mappers/gateio.js.map +1 -1
- package/dist/mappers/gateiofutures.d.ts +1 -1
- package/dist/mappers/gateiofutures.d.ts.map +1 -1
- package/dist/mappers/gateiofutures.js +4 -0
- package/dist/mappers/gateiofutures.js.map +1 -1
- package/dist/mappers/gemini.d.ts.map +1 -1
- package/dist/mappers/gemini.js +3 -0
- package/dist/mappers/gemini.js.map +1 -1
- package/dist/mappers/hitbtc.d.ts.map +1 -1
- package/dist/mappers/hitbtc.js +3 -0
- package/dist/mappers/hitbtc.js.map +1 -1
- package/dist/mappers/huobi.d.ts +2 -2
- package/dist/mappers/huobi.d.ts.map +1 -1
- package/dist/mappers/huobi.js +3 -1
- package/dist/mappers/huobi.js.map +1 -1
- package/dist/mappers/index.d.ts +3 -3
- package/dist/mappers/index.d.ts.map +1 -1
- package/dist/mappers/index.js +43 -23
- package/dist/mappers/index.js.map +1 -1
- package/dist/mappers/kraken.d.ts.map +1 -1
- package/dist/mappers/kraken.js +3 -0
- package/dist/mappers/kraken.js.map +1 -1
- package/dist/mappers/okex.d.ts +247 -1
- package/dist/mappers/okex.d.ts.map +1 -1
- package/dist/mappers/okex.js +399 -1
- package/dist/mappers/okex.js.map +1 -1
- package/dist/mappers/poloniex.d.ts.map +1 -1
- package/dist/mappers/poloniex.js +3 -0
- package/dist/mappers/poloniex.js.map +1 -1
- package/dist/mappers/serum.d.ts +1 -1
- package/dist/mappers/serum.d.ts.map +1 -1
- package/dist/mappers/serum.js +9 -0
- package/dist/mappers/serum.js.map +1 -1
- package/dist/mappers/upbit.d.ts +1 -1
- package/dist/mappers/upbit.d.ts.map +1 -1
- package/dist/mappers/upbit.js +3 -0
- package/dist/mappers/upbit.js.map +1 -1
- package/dist/realtimefeeds/okex.d.ts +4 -2
- package/dist/realtimefeeds/okex.d.ts.map +1 -1
- package/dist/realtimefeeds/okex.js +38 -10
- package/dist/realtimefeeds/okex.js.map +1 -1
- package/package.json +1 -1
- package/src/consts.ts +62 -4
- package/src/handy.ts +14 -0
- package/src/mappers/ascendex.ts +6 -1
- package/src/mappers/binance.ts +2 -9
- package/src/mappers/binancedex.ts +6 -1
- package/src/mappers/binanceoptions.ts +7 -1
- package/src/mappers/bitfinex.ts +10 -1
- package/src/mappers/bitflyer.ts +8 -2
- package/src/mappers/bitmex.ts +12 -2
- package/src/mappers/bitstamp.ts +1 -7
- package/src/mappers/bybit.ts +9 -0
- package/src/mappers/coinbase.ts +7 -1
- package/src/mappers/coinflex.ts +8 -1
- package/src/mappers/cryptofacilities.ts +12 -1
- package/src/mappers/delta.ts +8 -1
- package/src/mappers/deribit.ts +14 -2
- package/src/mappers/dydx.ts +8 -1
- package/src/mappers/ftx.ts +12 -2
- package/src/mappers/gateio.ts +5 -0
- package/src/mappers/gateiofutures.ts +8 -1
- package/src/mappers/gemini.ts +5 -0
- package/src/mappers/hitbtc.ts +5 -0
- package/src/mappers/huobi.ts +6 -2
- package/src/mappers/index.ts +77 -24
- package/src/mappers/kraken.ts +7 -1
- package/src/mappers/okex.ts +596 -2
- package/src/mappers/poloniex.ts +5 -0
- package/src/mappers/serum.ts +14 -2
- package/src/mappers/upbit.ts +6 -1
- package/src/realtimefeeds/okex.ts +42 -10
package/src/mappers/coinflex.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { upperCaseSymbols } from '../handy'
|
|
2
|
+
import { BookChange, DerivativeTicker, Trade } from '../types'
|
|
2
3
|
import { Mapper, PendingTickerInfoHelper } from './mapper'
|
|
3
4
|
|
|
4
5
|
// https://docs.coinflex.com/v2/#websocket-api-subscriptions-public
|
|
@@ -9,6 +10,8 @@ export const coinflexTradesMapper: Mapper<'coinflex', Trade> = {
|
|
|
9
10
|
},
|
|
10
11
|
|
|
11
12
|
getFilters(symbols?: string[]) {
|
|
13
|
+
symbols = upperCaseSymbols(symbols)
|
|
14
|
+
|
|
12
15
|
return [
|
|
13
16
|
{
|
|
14
17
|
channel: 'trade',
|
|
@@ -47,6 +50,8 @@ export const coinflexBookChangeMapper: Mapper<'coinflex', BookChange> = {
|
|
|
47
50
|
},
|
|
48
51
|
|
|
49
52
|
getFilters(symbols?: string[]) {
|
|
53
|
+
symbols = upperCaseSymbols(symbols)
|
|
54
|
+
|
|
50
55
|
return [
|
|
51
56
|
{
|
|
52
57
|
channel: 'futures/depth',
|
|
@@ -79,6 +84,8 @@ export class CoinflexDerivativeTickerMapper implements Mapper<'coinflex', Deriva
|
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
getFilters(symbols?: string[]) {
|
|
87
|
+
symbols = upperCaseSymbols(symbols)
|
|
88
|
+
|
|
82
89
|
return [
|
|
83
90
|
{
|
|
84
91
|
channel: 'ticker',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { upperCaseSymbols } from '../handy'
|
|
2
|
+
import { BookChange, BookTicker, DerivativeTicker, Liquidation, Trade } from '../types'
|
|
2
3
|
import { Mapper, PendingTickerInfoHelper } from './mapper'
|
|
3
4
|
|
|
4
5
|
// https://www.cryptofacilities.com/resources/hc/en-us/categories/115000132213-API
|
|
@@ -9,6 +10,8 @@ export const cryptofacilitiesTradesMapper: Mapper<'cryptofacilities', Trade> = {
|
|
|
9
10
|
},
|
|
10
11
|
|
|
11
12
|
getFilters(symbols?: string[]) {
|
|
13
|
+
symbols = upperCaseSymbols(symbols)
|
|
14
|
+
|
|
12
15
|
return [
|
|
13
16
|
{
|
|
14
17
|
channel: 'trade',
|
|
@@ -42,6 +45,8 @@ export const cryptofacilitiesBookChangeMapper: Mapper<'cryptofacilities', BookCh
|
|
|
42
45
|
},
|
|
43
46
|
|
|
44
47
|
getFilters(symbols?: string[]) {
|
|
48
|
+
symbols = upperCaseSymbols(symbols)
|
|
49
|
+
|
|
45
50
|
return [
|
|
46
51
|
{
|
|
47
52
|
channel: 'book',
|
|
@@ -96,6 +101,8 @@ export class CryptofacilitiesDerivativeTickerMapper implements Mapper<'cryptofac
|
|
|
96
101
|
}
|
|
97
102
|
|
|
98
103
|
getFilters(symbols?: string[]) {
|
|
104
|
+
symbols = upperCaseSymbols(symbols)
|
|
105
|
+
|
|
99
106
|
return [
|
|
100
107
|
{
|
|
101
108
|
channel: 'ticker',
|
|
@@ -130,6 +137,8 @@ export const cryptofacilitiesLiquidationsMapper: Mapper<'cryptofacilities', Liqu
|
|
|
130
137
|
},
|
|
131
138
|
|
|
132
139
|
getFilters(symbols?: string[]) {
|
|
140
|
+
symbols = upperCaseSymbols(symbols)
|
|
141
|
+
|
|
133
142
|
return [
|
|
134
143
|
{
|
|
135
144
|
channel: 'trade',
|
|
@@ -159,6 +168,8 @@ export const cryptofacilitiesBookTickerMapper: Mapper<'cryptofacilities', BookTi
|
|
|
159
168
|
},
|
|
160
169
|
|
|
161
170
|
getFilters(symbols?: string[]) {
|
|
171
|
+
symbols = upperCaseSymbols(symbols)
|
|
172
|
+
|
|
162
173
|
return [
|
|
163
174
|
{
|
|
164
175
|
channel: 'ticker',
|
package/src/mappers/delta.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { upperCaseSymbols } from '../handy'
|
|
2
|
+
import { BookChange, DerivativeTicker, Trade } from '../types'
|
|
1
3
|
import { Mapper, PendingTickerInfoHelper } from './mapper'
|
|
2
|
-
import { Trade, BookChange, DerivativeTicker } from '../types'
|
|
3
4
|
|
|
4
5
|
const fromMicroSecondsToDate = (micros: number) => {
|
|
5
6
|
const timestamp = new Date(micros / 1000)
|
|
@@ -16,6 +17,8 @@ export class DeltaTradesMapper implements Mapper<'delta', Trade> {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
getFilters(symbols?: string[]) {
|
|
20
|
+
symbols = upperCaseSymbols(symbols)
|
|
21
|
+
|
|
19
22
|
return [
|
|
20
23
|
{
|
|
21
24
|
channel: this._useV2Channels ? 'all_trades' : 'recent_trade',
|
|
@@ -52,6 +55,8 @@ export const deltaBookChangeMapper: Mapper<'delta', BookChange> = {
|
|
|
52
55
|
},
|
|
53
56
|
|
|
54
57
|
getFilters(symbols?: string[]) {
|
|
58
|
+
symbols = upperCaseSymbols(symbols)
|
|
59
|
+
|
|
55
60
|
return [
|
|
56
61
|
{
|
|
57
62
|
channel: 'l2_orderbook',
|
|
@@ -88,6 +93,8 @@ export class DeltaDerivativeTickerMapper implements Mapper<'delta', DerivativeTi
|
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
getFilters(symbols?: string[]) {
|
|
96
|
+
symbols = upperCaseSymbols(symbols)
|
|
97
|
+
|
|
91
98
|
return [
|
|
92
99
|
{
|
|
93
100
|
channel: this._useV2Channels ? 'all_trades' : 'recent_trade',
|
package/src/mappers/deribit.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { asNumberIfValid } from '../handy'
|
|
2
|
-
import { BookChange, DerivativeTicker,
|
|
1
|
+
import { asNumberIfValid, upperCaseSymbols } from '../handy'
|
|
2
|
+
import { BookChange, BookTicker, DerivativeTicker, Liquidation, OptionSummary, Trade } from '../types'
|
|
3
3
|
import { Mapper, PendingTickerInfoHelper } from './mapper'
|
|
4
4
|
|
|
5
5
|
// https://docs.deribit.com/v2/#subscriptions
|
|
@@ -15,6 +15,8 @@ export const deribitTradesMapper: Mapper<'deribit', Trade> = {
|
|
|
15
15
|
},
|
|
16
16
|
|
|
17
17
|
getFilters(symbols?: string[]) {
|
|
18
|
+
symbols = upperCaseSymbols(symbols)
|
|
19
|
+
|
|
18
20
|
return [
|
|
19
21
|
{
|
|
20
22
|
channel: 'trades',
|
|
@@ -58,6 +60,8 @@ export const deribitBookChangeMapper: Mapper<'deribit', BookChange> = {
|
|
|
58
60
|
},
|
|
59
61
|
|
|
60
62
|
getFilters(symbols?: string[]) {
|
|
63
|
+
symbols = upperCaseSymbols(symbols)
|
|
64
|
+
|
|
61
65
|
return [
|
|
62
66
|
{
|
|
63
67
|
channel: 'book',
|
|
@@ -98,6 +102,8 @@ export class DeribitDerivativeTickerMapper implements Mapper<'deribit', Derivati
|
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
getFilters(symbols?: string[]) {
|
|
105
|
+
symbols = upperCaseSymbols(symbols)
|
|
106
|
+
|
|
101
107
|
return [
|
|
102
108
|
{
|
|
103
109
|
channel: 'ticker',
|
|
@@ -125,6 +131,8 @@ export class DeribitDerivativeTickerMapper implements Mapper<'deribit', Derivati
|
|
|
125
131
|
|
|
126
132
|
export class DeribitOptionSummaryMapper implements Mapper<'deribit', OptionSummary> {
|
|
127
133
|
getFilters(symbols?: string[]) {
|
|
134
|
+
symbols = upperCaseSymbols(symbols)
|
|
135
|
+
|
|
128
136
|
return [
|
|
129
137
|
{
|
|
130
138
|
channel: 'ticker',
|
|
@@ -205,6 +213,8 @@ export const deribitLiquidationsMapper: Mapper<'deribit', Liquidation> = {
|
|
|
205
213
|
},
|
|
206
214
|
|
|
207
215
|
getFilters(symbols?: string[]) {
|
|
216
|
+
symbols = upperCaseSymbols(symbols)
|
|
217
|
+
|
|
208
218
|
return [
|
|
209
219
|
{
|
|
210
220
|
channel: 'trades',
|
|
@@ -251,6 +261,8 @@ export const deribitBookTickerMapper: Mapper<'deribit', BookTicker> = {
|
|
|
251
261
|
},
|
|
252
262
|
|
|
253
263
|
getFilters(symbols?: string[]) {
|
|
264
|
+
symbols = upperCaseSymbols(symbols)
|
|
265
|
+
|
|
254
266
|
return [
|
|
255
267
|
{
|
|
256
268
|
channel: 'ticker',
|
package/src/mappers/dydx.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { upperCaseSymbols } from '../handy'
|
|
2
|
+
import { BookChange, BookPriceLevel, DerivativeTicker, Trade } from '../types'
|
|
1
3
|
import { Mapper, PendingTickerInfoHelper } from './mapper'
|
|
2
|
-
import { Trade, BookChange, DerivativeTicker, BookPriceLevel } from '../types'
|
|
3
4
|
|
|
4
5
|
export class DydxTradesMapper implements Mapper<'dydx', Trade> {
|
|
5
6
|
canHandle(message: DyDxTrade) {
|
|
@@ -7,6 +8,8 @@ export class DydxTradesMapper implements Mapper<'dydx', Trade> {
|
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
getFilters(symbols?: string[]) {
|
|
11
|
+
symbols = upperCaseSymbols(symbols)
|
|
12
|
+
|
|
10
13
|
return [
|
|
11
14
|
{
|
|
12
15
|
channel: 'v3_trades',
|
|
@@ -40,6 +43,8 @@ export class DydxBookChangeMapper implements Mapper<'dydx', BookChange> {
|
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
getFilters(symbols?: string[]) {
|
|
46
|
+
symbols = upperCaseSymbols(symbols)
|
|
47
|
+
|
|
43
48
|
return [
|
|
44
49
|
{
|
|
45
50
|
channel: 'v3_orderbook',
|
|
@@ -140,6 +145,8 @@ export class DydxDerivativeTickerMapper implements Mapper<'dydx', DerivativeTick
|
|
|
140
145
|
}
|
|
141
146
|
|
|
142
147
|
getFilters(symbols?: string[]) {
|
|
148
|
+
symbols = upperCaseSymbols(symbols)
|
|
149
|
+
|
|
143
150
|
return [
|
|
144
151
|
{
|
|
145
152
|
channel: 'v3_markets',
|
package/src/mappers/ftx.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { asNumberIfValid, parseμs } from '../handy'
|
|
2
|
-
import { BookChange,
|
|
1
|
+
import { asNumberIfValid, parseμs, upperCaseSymbols } from '../handy'
|
|
2
|
+
import { BookChange, BookTicker, DerivativeTicker, Exchange, Liquidation, Trade } from '../types'
|
|
3
3
|
import { Mapper, PendingTickerInfoHelper } from './mapper'
|
|
4
4
|
|
|
5
5
|
// https://docs.ftx.com/#websocket-api
|
|
@@ -16,6 +16,8 @@ export class FTXTradesMapper implements Mapper<'ftx' | 'ftx-us', Trade> {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
getFilters(symbols?: string[]) {
|
|
19
|
+
symbols = upperCaseSymbols(symbols)
|
|
20
|
+
|
|
19
21
|
return [
|
|
20
22
|
{
|
|
21
23
|
channel: 'trades',
|
|
@@ -63,6 +65,8 @@ export class FTXBookChangeMapper implements Mapper<'ftx' | 'ftx-us', BookChange>
|
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
getFilters(symbols?: string[]) {
|
|
68
|
+
symbols = upperCaseSymbols(symbols)
|
|
69
|
+
|
|
66
70
|
return [
|
|
67
71
|
{
|
|
68
72
|
channel: 'orderbook',
|
|
@@ -107,6 +111,8 @@ export class FTXDerivativeTickerMapper implements Mapper<'ftx', DerivativeTicker
|
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
getFilters(symbols?: string[]) {
|
|
114
|
+
symbols = upperCaseSymbols(symbols)
|
|
115
|
+
|
|
110
116
|
return [
|
|
111
117
|
{
|
|
112
118
|
channel: 'instrument',
|
|
@@ -146,6 +152,8 @@ export class FTXLiquidationsMapper implements Mapper<'ftx', Liquidation> {
|
|
|
146
152
|
}
|
|
147
153
|
|
|
148
154
|
getFilters(symbols?: string[]) {
|
|
155
|
+
symbols = upperCaseSymbols(symbols)
|
|
156
|
+
|
|
149
157
|
return [
|
|
150
158
|
{
|
|
151
159
|
channel: 'trades',
|
|
@@ -188,6 +196,8 @@ export class FTXBookTickerMapper implements Mapper<'ftx' | 'ftx-us', BookTicker>
|
|
|
188
196
|
}
|
|
189
197
|
|
|
190
198
|
getFilters(symbols?: string[]) {
|
|
199
|
+
symbols = upperCaseSymbols(symbols)
|
|
200
|
+
|
|
191
201
|
return [
|
|
192
202
|
{
|
|
193
203
|
channel: 'ticker',
|
package/src/mappers/gateio.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { upperCaseSymbols } from '../handy'
|
|
1
2
|
import { BookChange, Exchange, Trade } from '../types'
|
|
2
3
|
import { Mapper } from './mapper'
|
|
3
4
|
|
|
@@ -13,6 +14,8 @@ export class GateIOTradesMapper implements Mapper<'gate-io', Trade> {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
getFilters(symbols?: string[]) {
|
|
17
|
+
symbols = upperCaseSymbols(symbols)
|
|
18
|
+
|
|
16
19
|
return [
|
|
17
20
|
{
|
|
18
21
|
channel: 'trades',
|
|
@@ -64,6 +67,8 @@ export class GateIOBookChangeMapper implements Mapper<'gate-io', BookChange> {
|
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
getFilters(symbols?: string[]) {
|
|
70
|
+
symbols = upperCaseSymbols(symbols)
|
|
71
|
+
|
|
67
72
|
return [
|
|
68
73
|
{
|
|
69
74
|
channel: 'depth',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { upperCaseSymbols } from '../handy'
|
|
2
|
+
import { BookChange, DerivativeTicker, Exchange, Trade } from '../types'
|
|
2
3
|
import { Mapper, PendingTickerInfoHelper } from './mapper'
|
|
3
4
|
|
|
4
5
|
// https://www.gate.io/docs/futures/ws/index.html
|
|
@@ -11,6 +12,8 @@ export class GateIOFuturesTradesMapper implements Mapper<'gate-io-futures', Trad
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
getFilters(symbols?: string[]) {
|
|
15
|
+
symbols = upperCaseSymbols(symbols)
|
|
16
|
+
|
|
14
17
|
return [
|
|
15
18
|
{
|
|
16
19
|
channel: 'trades',
|
|
@@ -52,6 +55,8 @@ export class GateIOFuturesBookChangeMapper implements Mapper<'gate-io-futures',
|
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
getFilters(symbols?: string[]) {
|
|
58
|
+
symbols = upperCaseSymbols(symbols)
|
|
59
|
+
|
|
55
60
|
return [
|
|
56
61
|
{
|
|
57
62
|
channel: 'order_book',
|
|
@@ -97,6 +102,8 @@ export class GateIOFuturesDerivativeTickerMapper implements Mapper<'gate-io-futu
|
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
getFilters(symbols?: string[]) {
|
|
105
|
+
symbols = upperCaseSymbols(symbols)
|
|
106
|
+
|
|
100
107
|
return [
|
|
101
108
|
{
|
|
102
109
|
channel: 'tickers',
|
package/src/mappers/gemini.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { upperCaseSymbols } from '../handy'
|
|
1
2
|
import { BookChange, Trade } from '../types'
|
|
2
3
|
import { Mapper } from './mapper'
|
|
3
4
|
|
|
@@ -9,6 +10,8 @@ export const geminiTradesMapper: Mapper<'gemini', Trade> = {
|
|
|
9
10
|
},
|
|
10
11
|
|
|
11
12
|
getFilters(symbols?: string[]) {
|
|
13
|
+
symbols = upperCaseSymbols(symbols)
|
|
14
|
+
|
|
12
15
|
return [
|
|
13
16
|
{
|
|
14
17
|
channel: 'trade',
|
|
@@ -45,6 +48,8 @@ export const geminiBookChangeMapper: Mapper<'gemini', BookChange> = {
|
|
|
45
48
|
},
|
|
46
49
|
|
|
47
50
|
getFilters(symbols?: string[]) {
|
|
51
|
+
symbols = upperCaseSymbols(symbols)
|
|
52
|
+
|
|
48
53
|
return [
|
|
49
54
|
{
|
|
50
55
|
channel: 'l2_updates',
|
package/src/mappers/hitbtc.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { upperCaseSymbols } from '../handy'
|
|
1
2
|
import { BookChange, Trade } from '../types'
|
|
2
3
|
import { Mapper } from './mapper'
|
|
3
4
|
|
|
@@ -9,6 +10,8 @@ export const hitBtcTradesMapper: Mapper<'hitbtc', Trade> = {
|
|
|
9
10
|
},
|
|
10
11
|
|
|
11
12
|
getFilters(symbols?: string[]) {
|
|
13
|
+
symbols = upperCaseSymbols(symbols)
|
|
14
|
+
|
|
12
15
|
return [
|
|
13
16
|
{
|
|
14
17
|
channel: 'updateTrades',
|
|
@@ -50,6 +53,8 @@ export const hitBtcBookChangeMapper: Mapper<'hitbtc', BookChange> = {
|
|
|
50
53
|
},
|
|
51
54
|
|
|
52
55
|
getFilters(symbols?: string[]) {
|
|
56
|
+
symbols = upperCaseSymbols(symbols)
|
|
57
|
+
|
|
53
58
|
return [
|
|
54
59
|
{
|
|
55
60
|
channel: 'snapshotOrderbook',
|
package/src/mappers/huobi.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { asNumberIfValid, CircularBuffer, upperCaseSymbols } from '../handy'
|
|
2
|
+
import { BookChange, BookTicker, DerivativeTicker, Exchange, FilterForExchange, Liquidation, OptionSummary, Trade } from '../types'
|
|
2
3
|
import { Mapper, PendingTickerInfoHelper } from './mapper'
|
|
3
|
-
import { asNumberIfValid, CircularBuffer } from '../handy'
|
|
4
4
|
|
|
5
5
|
// https://huobiapi.github.io/docs/spot/v1/en/#websocket-market-data
|
|
6
6
|
// https://github.com/huobiapi/API_Docs_en/wiki/WS_api_reference_en
|
|
@@ -255,6 +255,8 @@ export class HuobiDerivativeTickerMapper implements Mapper<'huobi-dm' | 'huobi-d
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
getFilters(symbols?: string[]) {
|
|
258
|
+
symbols = upperCaseSymbols(symbols)
|
|
259
|
+
|
|
258
260
|
const filters: FilterForExchange['huobi-dm-swap'][] = [
|
|
259
261
|
{
|
|
260
262
|
channel: 'basis',
|
|
@@ -335,6 +337,8 @@ export class HuobiLiquidationsMapper implements Mapper<'huobi-dm' | 'huobi-dm-sw
|
|
|
335
337
|
}
|
|
336
338
|
|
|
337
339
|
getFilters(symbols?: string[]) {
|
|
340
|
+
symbols = upperCaseSymbols(symbols)
|
|
341
|
+
|
|
338
342
|
if (this._exchange === 'huobi-dm') {
|
|
339
343
|
// huobi-dm for liquidations requires prividing different symbols which are indexes names for example 'BTC' or 'ETH'
|
|
340
344
|
// not futures names like 'BTC_NW'
|
package/src/mappers/index.ts
CHANGED
|
@@ -69,7 +69,13 @@ import {
|
|
|
69
69
|
OkexDerivativeTickerMapper,
|
|
70
70
|
OkexLiquidationsMapper,
|
|
71
71
|
OkexOptionSummaryMapper,
|
|
72
|
-
OkexTradesMapper
|
|
72
|
+
OkexTradesMapper,
|
|
73
|
+
OkexV5BookChangeMapper,
|
|
74
|
+
OkexV5BookTickerMapper,
|
|
75
|
+
OkexV5DerivativeTickerMapper,
|
|
76
|
+
OkexV5LiquidationsMapper,
|
|
77
|
+
OkexV5OptionSummaryMapper,
|
|
78
|
+
OkexV5TradesMapper
|
|
73
79
|
} from './okex'
|
|
74
80
|
import { phemexBookChangeMapper, PhemexDerivativeTickerMapper, phemexTradesMapper } from './phemex'
|
|
75
81
|
import { PoloniexBookChangeMapper, PoloniexTradesMapper } from './poloniex'
|
|
@@ -87,6 +93,12 @@ const isRealTime = (date: Date) => {
|
|
|
87
93
|
return date.valueOf() + THREE_MINUTES_IN_MS > new Date().valueOf()
|
|
88
94
|
}
|
|
89
95
|
|
|
96
|
+
const OKEX_V5_API_SWITCH_DATE = new Date('2021-12-23T00:00:00.000Z')
|
|
97
|
+
|
|
98
|
+
const shouldUseOkexV5Mappers = (localTimestamp: Date) => {
|
|
99
|
+
return isRealTime(localTimestamp) || localTimestamp.valueOf() >= OKEX_V5_API_SWITCH_DATE.valueOf()
|
|
100
|
+
}
|
|
101
|
+
|
|
90
102
|
const tradesMappers = {
|
|
91
103
|
bitmex: () => bitmexTradesMapper,
|
|
92
104
|
binance: () => new BinanceTradesMapper('binance'),
|
|
@@ -106,10 +118,18 @@ const tradesMappers = {
|
|
|
106
118
|
'ftx-us': () => new FTXTradesMapper('ftx-us'),
|
|
107
119
|
gemini: () => geminiTradesMapper,
|
|
108
120
|
kraken: () => krakenTradesMapper,
|
|
109
|
-
okex: () =>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
'okex-
|
|
121
|
+
okex: (localTimestamp: Date) =>
|
|
122
|
+
shouldUseOkexV5Mappers(localTimestamp) ? new OkexV5TradesMapper('okex') : new OkexTradesMapper('okex', 'spot'),
|
|
123
|
+
|
|
124
|
+
'okex-futures': (localTimestamp: Date) =>
|
|
125
|
+
shouldUseOkexV5Mappers(localTimestamp) ? new OkexV5TradesMapper('okex-futures') : new OkexTradesMapper('okex-futures', 'futures'),
|
|
126
|
+
|
|
127
|
+
'okex-swap': (localTimestamp: Date) =>
|
|
128
|
+
shouldUseOkexV5Mappers(localTimestamp) ? new OkexV5TradesMapper('okex-swap') : new OkexTradesMapper('okex-swap', 'swap'),
|
|
129
|
+
|
|
130
|
+
'okex-options': (localTimestamp: Date) =>
|
|
131
|
+
shouldUseOkexV5Mappers(localTimestamp) ? new OkexV5TradesMapper('okex-options') : new OkexTradesMapper('okex-options', 'option'),
|
|
132
|
+
|
|
113
133
|
huobi: () => new HuobiTradesMapper('huobi'),
|
|
114
134
|
'huobi-dm': () => new HuobiTradesMapper('huobi-dm'),
|
|
115
135
|
'huobi-dm-swap': () => new HuobiTradesMapper('huobi-dm-swap'),
|
|
@@ -152,14 +172,24 @@ const bookChangeMappers = {
|
|
|
152
172
|
'ftx-us': () => new FTXBookChangeMapper('ftx-us'),
|
|
153
173
|
gemini: () => geminiBookChangeMapper,
|
|
154
174
|
kraken: () => krakenBookChangeMapper,
|
|
155
|
-
okex: (localTimestamp: Date) =>
|
|
175
|
+
okex: (localTimestamp: Date) =>
|
|
176
|
+
shouldUseOkexV5Mappers(localTimestamp)
|
|
177
|
+
? new OkexV5BookChangeMapper('okex')
|
|
178
|
+
: new OkexBookChangeMapper('okex', 'spot', localTimestamp.valueOf() >= new Date('2020-04-10').valueOf()),
|
|
156
179
|
'okex-futures': (localTimestamp: Date) =>
|
|
157
|
-
|
|
180
|
+
shouldUseOkexV5Mappers(localTimestamp)
|
|
181
|
+
? new OkexV5BookChangeMapper('okex-futures')
|
|
182
|
+
: new OkexBookChangeMapper('okex-futures', 'futures', localTimestamp.valueOf() >= new Date('2019-12-05').valueOf()),
|
|
158
183
|
|
|
159
184
|
'okex-swap': (localTimestamp: Date) =>
|
|
160
|
-
|
|
185
|
+
shouldUseOkexV5Mappers(localTimestamp)
|
|
186
|
+
? new OkexV5BookChangeMapper('okex-swap')
|
|
187
|
+
: new OkexBookChangeMapper('okex-swap', 'swap', localTimestamp.valueOf() >= new Date('2020-02-08').valueOf()),
|
|
161
188
|
'okex-options': (localTimestamp: Date) =>
|
|
162
|
-
|
|
189
|
+
shouldUseOkexV5Mappers(localTimestamp)
|
|
190
|
+
? new OkexV5BookChangeMapper('okex-options')
|
|
191
|
+
: new OkexBookChangeMapper('okex-options', 'option', localTimestamp.valueOf() >= new Date('2020-02-08').valueOf()),
|
|
192
|
+
|
|
163
193
|
huobi: (localTimestamp: Date) =>
|
|
164
194
|
localTimestamp.valueOf() >= new Date('2020-07-03').valueOf()
|
|
165
195
|
? new HuobiMBPBookChangeMapper('huobi')
|
|
@@ -195,8 +225,14 @@ const derivativeTickersMappers = {
|
|
|
195
225
|
'bitfinex-derivatives': () => new BitfinexDerivativeTickerMapper(),
|
|
196
226
|
cryptofacilities: () => new CryptofacilitiesDerivativeTickerMapper(),
|
|
197
227
|
deribit: () => new DeribitDerivativeTickerMapper(),
|
|
198
|
-
'okex-futures': () =>
|
|
199
|
-
|
|
228
|
+
'okex-futures': (localTimestamp: Date) =>
|
|
229
|
+
shouldUseOkexV5Mappers(localTimestamp)
|
|
230
|
+
? new OkexV5DerivativeTickerMapper('okex-futures')
|
|
231
|
+
: new OkexDerivativeTickerMapper('okex-futures'),
|
|
232
|
+
|
|
233
|
+
'okex-swap': (localTimestamp: Date) =>
|
|
234
|
+
shouldUseOkexV5Mappers(localTimestamp) ? new OkexV5DerivativeTickerMapper('okex-swap') : new OkexDerivativeTickerMapper('okex-swap'),
|
|
235
|
+
|
|
200
236
|
bybit: () => new BybitDerivativeTickerMapper(),
|
|
201
237
|
phemex: () => new PhemexDerivativeTickerMapper(),
|
|
202
238
|
ftx: () => new FTXDerivativeTickerMapper('ftx'),
|
|
@@ -212,7 +248,8 @@ const derivativeTickersMappers = {
|
|
|
212
248
|
|
|
213
249
|
const optionsSummaryMappers = {
|
|
214
250
|
deribit: () => new DeribitOptionSummaryMapper(),
|
|
215
|
-
'okex-options': () =>
|
|
251
|
+
'okex-options': (localTimestamp: Date) =>
|
|
252
|
+
shouldUseOkexV5Mappers(localTimestamp) ? new OkexV5OptionSummaryMapper() : new OkexOptionSummaryMapper(),
|
|
216
253
|
'binance-options': () => new BinanceOptionSummaryMapper(),
|
|
217
254
|
'huobi-dm-options': () => new HuobiOptionsSummaryMapper()
|
|
218
255
|
}
|
|
@@ -229,8 +266,12 @@ const liquidationsMappers = {
|
|
|
229
266
|
'huobi-dm-swap': () => new HuobiLiquidationsMapper('huobi-dm-swap'),
|
|
230
267
|
'huobi-dm-linear-swap': () => new HuobiLiquidationsMapper('huobi-dm-linear-swap'),
|
|
231
268
|
bybit: () => new BybitLiquidationsMapper('bybit'),
|
|
232
|
-
'okex-futures': () =>
|
|
233
|
-
|
|
269
|
+
'okex-futures': (localTimestamp: Date) =>
|
|
270
|
+
shouldUseOkexV5Mappers(localTimestamp)
|
|
271
|
+
? new OkexV5LiquidationsMapper('okex-futures')
|
|
272
|
+
: new OkexLiquidationsMapper('okex-futures', 'futures'),
|
|
273
|
+
'okex-swap': (localTimestamp: Date) =>
|
|
274
|
+
shouldUseOkexV5Mappers(localTimestamp) ? new OkexV5LiquidationsMapper('okex-swap') : new OkexLiquidationsMapper('okex-swap', 'swap')
|
|
234
275
|
}
|
|
235
276
|
|
|
236
277
|
const bookTickersMappers = {
|
|
@@ -254,10 +295,22 @@ const bookTickersMappers = {
|
|
|
254
295
|
'huobi-dm-swap': () => new HuobiBookTickerMapper('huobi-dm-swap'),
|
|
255
296
|
'huobi-dm-linear-swap': () => new HuobiBookTickerMapper('huobi-dm-linear-swap'),
|
|
256
297
|
kraken: () => krakenBookTickerMapper,
|
|
257
|
-
okex: () =>
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
'okex-
|
|
298
|
+
okex: (localTimestamp: Date) =>
|
|
299
|
+
shouldUseOkexV5Mappers(localTimestamp) ? new OkexV5BookTickerMapper('okex') : new OkexBookTickerMapper('okex', 'spot'),
|
|
300
|
+
|
|
301
|
+
'okex-futures': (localTimestamp: Date) =>
|
|
302
|
+
shouldUseOkexV5Mappers(localTimestamp)
|
|
303
|
+
? new OkexV5BookTickerMapper('okex-futures')
|
|
304
|
+
: new OkexBookTickerMapper('okex-futures', 'futures'),
|
|
305
|
+
|
|
306
|
+
'okex-swap': (localTimestamp: Date) =>
|
|
307
|
+
shouldUseOkexV5Mappers(localTimestamp) ? new OkexV5BookTickerMapper('okex-swap') : new OkexBookTickerMapper('okex-swap', 'swap'),
|
|
308
|
+
|
|
309
|
+
'okex-options': (localTimestamp: Date) =>
|
|
310
|
+
shouldUseOkexV5Mappers(localTimestamp)
|
|
311
|
+
? new OkexV5BookTickerMapper('okex-options')
|
|
312
|
+
: new OkexBookTickerMapper('okex-options', 'option'),
|
|
313
|
+
|
|
261
314
|
okcoin: () => new OkexBookTickerMapper('okcoin', 'spot'),
|
|
262
315
|
serum: () => new SerumBookTickerMapper('serum'),
|
|
263
316
|
'star-atlas': () => new SerumBookTickerMapper('star-atlas')
|
|
@@ -301,7 +354,7 @@ export const normalizeDerivativeTickers = <T extends keyof typeof derivativeTick
|
|
|
301
354
|
|
|
302
355
|
export const normalizeOptionsSummary = <T extends keyof typeof optionsSummaryMappers>(
|
|
303
356
|
exchange: T,
|
|
304
|
-
|
|
357
|
+
localTimestamp: Date
|
|
305
358
|
): Mapper<T, OptionSummary> => {
|
|
306
359
|
const createOptionSummaryMapper = optionsSummaryMappers[exchange]
|
|
307
360
|
|
|
@@ -309,12 +362,12 @@ export const normalizeOptionsSummary = <T extends keyof typeof optionsSummaryMap
|
|
|
309
362
|
throw new Error(`normalizeOptionsSummary: ${exchange} not supported`)
|
|
310
363
|
}
|
|
311
364
|
|
|
312
|
-
return createOptionSummaryMapper() as any
|
|
365
|
+
return createOptionSummaryMapper(localTimestamp) as any
|
|
313
366
|
}
|
|
314
367
|
|
|
315
368
|
export const normalizeLiquidations = <T extends keyof typeof liquidationsMappers>(
|
|
316
369
|
exchange: T,
|
|
317
|
-
|
|
370
|
+
localTimestamp: Date
|
|
318
371
|
): Mapper<T, Liquidation> => {
|
|
319
372
|
const createLiquidationsMapper = liquidationsMappers[exchange]
|
|
320
373
|
|
|
@@ -322,12 +375,12 @@ export const normalizeLiquidations = <T extends keyof typeof liquidationsMappers
|
|
|
322
375
|
throw new Error(`normalizeLiquidations: ${exchange} not supported`)
|
|
323
376
|
}
|
|
324
377
|
|
|
325
|
-
return createLiquidationsMapper() as any
|
|
378
|
+
return createLiquidationsMapper(localTimestamp) as any
|
|
326
379
|
}
|
|
327
380
|
|
|
328
381
|
export const normalizeBookTickers = <T extends keyof typeof bookTickersMappers>(
|
|
329
382
|
exchange: T,
|
|
330
|
-
|
|
383
|
+
localTimestamp: Date
|
|
331
384
|
): Mapper<T, BookTicker> => {
|
|
332
385
|
const createTickerMapper = bookTickersMappers[exchange]
|
|
333
386
|
|
|
@@ -335,5 +388,5 @@ export const normalizeBookTickers = <T extends keyof typeof bookTickersMappers>(
|
|
|
335
388
|
throw new Error(`normalizeBookTickers: ${exchange} not supported`)
|
|
336
389
|
}
|
|
337
390
|
|
|
338
|
-
return createTickerMapper() as any
|
|
391
|
+
return createTickerMapper(localTimestamp) as any
|
|
339
392
|
}
|
package/src/mappers/kraken.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { asNumberIfValid } from '../handy'
|
|
1
|
+
import { asNumberIfValid, upperCaseSymbols } from '../handy'
|
|
2
2
|
import { BookChange, BookTicker, Trade } from '../types'
|
|
3
3
|
import { Mapper } from './mapper'
|
|
4
4
|
|
|
@@ -15,6 +15,8 @@ export const krakenTradesMapper: Mapper<'kraken', Trade> = {
|
|
|
15
15
|
},
|
|
16
16
|
|
|
17
17
|
getFilters(symbols?: string[]) {
|
|
18
|
+
symbols = upperCaseSymbols(symbols)
|
|
19
|
+
|
|
18
20
|
return [
|
|
19
21
|
{
|
|
20
22
|
channel: 'trade',
|
|
@@ -73,6 +75,8 @@ export const krakenBookChangeMapper: Mapper<'kraken', BookChange> = {
|
|
|
73
75
|
},
|
|
74
76
|
|
|
75
77
|
getFilters(symbols?: string[]) {
|
|
78
|
+
symbols = upperCaseSymbols(symbols)
|
|
79
|
+
|
|
76
80
|
return [
|
|
77
81
|
{
|
|
78
82
|
channel: 'book',
|
|
@@ -129,6 +133,8 @@ export const krakenBookTickerMapper: Mapper<'kraken', BookTicker> = {
|
|
|
129
133
|
},
|
|
130
134
|
|
|
131
135
|
getFilters(symbols?: string[]) {
|
|
136
|
+
symbols = upperCaseSymbols(symbols)
|
|
137
|
+
|
|
132
138
|
return [
|
|
133
139
|
{
|
|
134
140
|
channel: 'spread',
|