tardis-dev 13.1.0 → 13.1.4
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/combine.js +34 -26
- package/dist/combine.js.map +1 -1
- package/dist/computable/computable.d.ts.map +1 -1
- package/dist/computable/computable.js +23 -18
- package/dist/computable/computable.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 +4 -2
- package/dist/mappers/huobi.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 +10 -8
- package/dist/mappers/okex.d.ts.map +1 -1
- package/dist/mappers/okex.js +24 -9
- 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/package.json +1 -1
- package/src/combine.ts +33 -27
- package/src/computable/computable.ts +21 -17
- 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 +7 -3
- package/src/mappers/kraken.ts +7 -1
- package/src/mappers/okex.ts +41 -12
- package/src/mappers/poloniex.ts +5 -0
- package/src/mappers/serum.ts +14 -2
- package/src/mappers/upbit.ts +6 -1
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
|
|
@@ -228,7 +228,7 @@ function normalizeSymbols(symbols?: string[]) {
|
|
|
228
228
|
return symbols.map((s) => {
|
|
229
229
|
// huobi-dm and huobi-dm-swap expect symbols to be upper cased
|
|
230
230
|
if (s.includes('_') || s.includes('-')) {
|
|
231
|
-
return s
|
|
231
|
+
return s.toUpperCase()
|
|
232
232
|
}
|
|
233
233
|
// huobi global expects lower cased symbols
|
|
234
234
|
return s.toLowerCase()
|
|
@@ -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/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',
|
package/src/mappers/okex.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { asNumberIfValid } from '../handy'
|
|
2
|
-
import { BookChange, DerivativeTicker, Exchange,
|
|
1
|
+
import { asNumberIfValid, upperCaseSymbols } from '../handy'
|
|
2
|
+
import { BookChange, BookTicker, DerivativeTicker, Exchange, Liquidation, OptionSummary, Trade } from '../types'
|
|
3
3
|
import { Mapper, PendingTickerInfoHelper } from './mapper'
|
|
4
4
|
|
|
5
5
|
// V5 Okex API mappers
|
|
@@ -16,6 +16,8 @@ export class OkexV5TradesMapper implements Mapper<OKEX_EXCHANGES, Trade> {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
getFilters(symbols?: string[]) {
|
|
19
|
+
symbols = upperCaseSymbols(symbols)
|
|
20
|
+
|
|
19
21
|
return [
|
|
20
22
|
{
|
|
21
23
|
channel: `trades` as const,
|
|
@@ -59,6 +61,8 @@ export class OkexV5BookChangeMapper implements Mapper<OKEX_EXCHANGES, BookChange
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
getFilters(symbols?: string[]) {
|
|
64
|
+
symbols = upperCaseSymbols(symbols)
|
|
65
|
+
|
|
62
66
|
return [
|
|
63
67
|
{
|
|
64
68
|
channel: `books-l2-tbt` as const,
|
|
@@ -104,6 +108,8 @@ export class OkexV5BookTickerMapper implements Mapper<OKEX_EXCHANGES, BookTicker
|
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
getFilters(symbols?: string[]) {
|
|
111
|
+
symbols = upperCaseSymbols(symbols)
|
|
112
|
+
|
|
107
113
|
return [
|
|
108
114
|
{
|
|
109
115
|
channel: `tickers` as const,
|
|
@@ -154,6 +160,8 @@ export class OkexV5DerivativeTickerMapper implements Mapper<'okex-futures' | 'ok
|
|
|
154
160
|
}
|
|
155
161
|
|
|
156
162
|
getFilters(symbols?: string[]) {
|
|
163
|
+
symbols = upperCaseSymbols(symbols)
|
|
164
|
+
|
|
157
165
|
const channels = this._exchange === 'okex-futures' ? this._futuresChannels : this._swapChannels
|
|
158
166
|
return channels.map((channel) => {
|
|
159
167
|
if (channel === 'index-tickers') {
|
|
@@ -228,9 +236,12 @@ export class OkexV5DerivativeTickerMapper implements Mapper<'okex-futures' | 'ok
|
|
|
228
236
|
if (message.arg.channel === 'funding-rate') {
|
|
229
237
|
const fundingRateMessage = dataMessage as OkexV5FundingRateMessage['data'][0]
|
|
230
238
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
239
|
+
if (fundingRateMessage.fundingRate !== undefined) {
|
|
240
|
+
pendingTickerInfo.updateFundingRate(Number(fundingRateMessage.fundingRate))
|
|
241
|
+
}
|
|
242
|
+
if (fundingRateMessage.fundingTime !== undefined) {
|
|
243
|
+
pendingTickerInfo.updateFundingTimestamp(new Date(Number(fundingRateMessage.fundingTime)))
|
|
244
|
+
}
|
|
234
245
|
|
|
235
246
|
if (fundingRateMessage.nextFundingRate !== undefined) {
|
|
236
247
|
pendingTickerInfo.updatePredictedFundingRate(Number(fundingRateMessage.nextFundingRate))
|
|
@@ -266,6 +277,8 @@ export class OkexV5LiquidationsMapper implements Mapper<OKEX_EXCHANGES, Liquidat
|
|
|
266
277
|
}
|
|
267
278
|
|
|
268
279
|
getFilters(symbols?: string[]) {
|
|
280
|
+
symbols = upperCaseSymbols(symbols)
|
|
281
|
+
|
|
269
282
|
return [
|
|
270
283
|
{
|
|
271
284
|
channel: 'liquidations',
|
|
@@ -314,6 +327,8 @@ export class OkexV5OptionSummaryMapper implements Mapper<'okex-options', OptionS
|
|
|
314
327
|
}
|
|
315
328
|
|
|
316
329
|
getFilters(symbols?: string[]) {
|
|
330
|
+
symbols = upperCaseSymbols(symbols)
|
|
331
|
+
|
|
317
332
|
const indexes =
|
|
318
333
|
symbols !== undefined
|
|
319
334
|
? symbols.map((s) => {
|
|
@@ -354,8 +369,8 @@ export class OkexV5OptionSummaryMapper implements Mapper<'okex-options', OptionS
|
|
|
354
369
|
for (const dataMessage of message.data) {
|
|
355
370
|
const indexTickerMessage = dataMessage as OkexV5IndexTickerMessage['data'][0]
|
|
356
371
|
|
|
357
|
-
const lastIndexPrice =
|
|
358
|
-
if (lastIndexPrice
|
|
372
|
+
const lastIndexPrice = asNumberIfValid(indexTickerMessage.idxPx)
|
|
373
|
+
if (lastIndexPrice !== undefined) {
|
|
359
374
|
this._indexPrices.set(indexTickerMessage.instId, lastIndexPrice)
|
|
360
375
|
}
|
|
361
376
|
}
|
|
@@ -366,8 +381,8 @@ export class OkexV5OptionSummaryMapper implements Mapper<'okex-options', OptionS
|
|
|
366
381
|
for (const dataMessage of message.data) {
|
|
367
382
|
const openInterestMessage = dataMessage as OkexV5OpenInterestMessage['data'][0]
|
|
368
383
|
|
|
369
|
-
const openInterestValue =
|
|
370
|
-
if (openInterestValue
|
|
384
|
+
const openInterestValue = asNumberIfValid(openInterestMessage.oi)
|
|
385
|
+
if (openInterestValue !== undefined) {
|
|
371
386
|
this._openInterests.set(openInterestMessage.instId, openInterestValue)
|
|
372
387
|
}
|
|
373
388
|
}
|
|
@@ -378,8 +393,8 @@ export class OkexV5OptionSummaryMapper implements Mapper<'okex-options', OptionS
|
|
|
378
393
|
for (const dataMessage of message.data) {
|
|
379
394
|
const markPriceMessage = dataMessage as OkexV5MarkPriceMessage['data'][0]
|
|
380
395
|
|
|
381
|
-
const markPrice =
|
|
382
|
-
if (markPrice
|
|
396
|
+
const markPrice = asNumberIfValid(markPriceMessage.markPx)
|
|
397
|
+
if (markPrice !== undefined) {
|
|
383
398
|
this._markPrices.set(markPriceMessage.instId, markPrice)
|
|
384
399
|
}
|
|
385
400
|
}
|
|
@@ -532,7 +547,9 @@ type OkexV5IndexTickerMessage = {
|
|
|
532
547
|
|
|
533
548
|
type OkexV5FundingRateMessage = {
|
|
534
549
|
arg: { channel: 'funding-rate'; instId: string }
|
|
535
|
-
data: [
|
|
550
|
+
data: [
|
|
551
|
+
{ fundingRate: '0.00048105' | undefined; fundingTime: '1640131200000'; instId: string; instType: 'SWAP'; nextFundingRate: '0.00114' }
|
|
552
|
+
]
|
|
536
553
|
}
|
|
537
554
|
|
|
538
555
|
type OkexV5LiquidationMessage = {
|
|
@@ -577,6 +594,8 @@ export class OkexTradesMapper implements Mapper<OKEX_EXCHANGES, Trade> {
|
|
|
577
594
|
}
|
|
578
595
|
|
|
579
596
|
getFilters(symbols?: string[]) {
|
|
597
|
+
symbols = upperCaseSymbols(symbols)
|
|
598
|
+
|
|
580
599
|
return [
|
|
581
600
|
{
|
|
582
601
|
channel: `${this._market}/trade` as const,
|
|
@@ -625,6 +644,8 @@ export class OkexBookChangeMapper implements Mapper<OKEX_EXCHANGES, BookChange>
|
|
|
625
644
|
}
|
|
626
645
|
|
|
627
646
|
getFilters(symbols?: string[]) {
|
|
647
|
+
symbols = upperCaseSymbols(symbols)
|
|
648
|
+
|
|
628
649
|
if (this._canUseTickByTickChannel) {
|
|
629
650
|
return [
|
|
630
651
|
{
|
|
@@ -689,6 +710,8 @@ export class OkexDerivativeTickerMapper implements Mapper<'okex-futures' | 'okex
|
|
|
689
710
|
}
|
|
690
711
|
|
|
691
712
|
getFilters(symbols?: string[]) {
|
|
713
|
+
symbols = upperCaseSymbols(symbols)
|
|
714
|
+
|
|
692
715
|
const channels = this._exchange === 'okex-futures' ? this._futuresChannels : this._swapChannels
|
|
693
716
|
return channels.map((channel) => {
|
|
694
717
|
return {
|
|
@@ -745,6 +768,8 @@ export class OkexOptionSummaryMapper implements Mapper<'okex-options', OptionSum
|
|
|
745
768
|
}
|
|
746
769
|
|
|
747
770
|
getFilters(symbols?: string[]) {
|
|
771
|
+
symbols = upperCaseSymbols(symbols)
|
|
772
|
+
|
|
748
773
|
const indexes =
|
|
749
774
|
symbols !== undefined
|
|
750
775
|
? symbols.map((s) => {
|
|
@@ -834,6 +859,8 @@ export class OkexLiquidationsMapper implements Mapper<OKEX_EXCHANGES, Liquidatio
|
|
|
834
859
|
}
|
|
835
860
|
|
|
836
861
|
getFilters(symbols?: string[]) {
|
|
862
|
+
symbols = upperCaseSymbols(symbols)
|
|
863
|
+
|
|
837
864
|
return [
|
|
838
865
|
{
|
|
839
866
|
channel: `${this._market}/liquidation`,
|
|
@@ -868,6 +895,8 @@ export class OkexBookTickerMapper implements Mapper<OKEX_EXCHANGES, BookTicker>
|
|
|
868
895
|
}
|
|
869
896
|
|
|
870
897
|
getFilters(symbols?: string[]) {
|
|
898
|
+
symbols = upperCaseSymbols(symbols)
|
|
899
|
+
|
|
871
900
|
return [
|
|
872
901
|
{
|
|
873
902
|
channel: `${this._market}/ticker`,
|
package/src/mappers/poloniex.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
|
|
|
@@ -19,6 +20,8 @@ export class PoloniexTradesMapper implements Mapper<'poloniex', Trade> {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
getFilters(symbols?: string[]) {
|
|
23
|
+
symbols = upperCaseSymbols(symbols)
|
|
24
|
+
|
|
22
25
|
return [
|
|
23
26
|
{
|
|
24
27
|
channel: 'price_aggregated_book',
|
|
@@ -89,6 +92,8 @@ export class PoloniexBookChangeMapper implements Mapper<'poloniex', BookChange>
|
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
getFilters(symbols?: string[]) {
|
|
95
|
+
symbols = upperCaseSymbols(symbols)
|
|
96
|
+
|
|
92
97
|
return [
|
|
93
98
|
{
|
|
94
99
|
channel: 'price_aggregated_book',
|
package/src/mappers/serum.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { asNumberIfValid, upperCaseSymbols } from '../handy'
|
|
2
|
+
import { BookChange, BookTicker, Exchange, Trade } from '../types'
|
|
1
3
|
import { Mapper } from './mapper'
|
|
2
|
-
import { Trade, BookChange, BookTicker, Exchange } from '../types'
|
|
3
|
-
import { asNumberIfValid } from '../handy'
|
|
4
4
|
|
|
5
5
|
export class SerumTradesMapper implements Mapper<'serum' | 'star-atlas', Trade> {
|
|
6
6
|
constructor(private readonly _exchange: Exchange) {}
|
|
@@ -10,6 +10,10 @@ export class SerumTradesMapper implements Mapper<'serum' | 'star-atlas', Trade>
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
getFilters(symbols?: string[]) {
|
|
13
|
+
if (this._exchange === 'serum') {
|
|
14
|
+
symbols = upperCaseSymbols(symbols)
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
return [
|
|
14
18
|
{
|
|
15
19
|
channel: 'trade',
|
|
@@ -41,6 +45,10 @@ export class SerumBookChangeMapper implements Mapper<'serum' | 'star-atlas', Boo
|
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
getFilters(symbols?: string[]) {
|
|
48
|
+
if (this._exchange === 'serum') {
|
|
49
|
+
symbols = upperCaseSymbols(symbols)
|
|
50
|
+
}
|
|
51
|
+
|
|
44
52
|
return [
|
|
45
53
|
{
|
|
46
54
|
channel: 'l2snapshot',
|
|
@@ -81,6 +89,10 @@ export class SerumBookTickerMapper implements Mapper<'serum' | 'star-atlas', Boo
|
|
|
81
89
|
}
|
|
82
90
|
|
|
83
91
|
getFilters(symbols?: string[]) {
|
|
92
|
+
if (this._exchange === 'serum') {
|
|
93
|
+
symbols = upperCaseSymbols(symbols)
|
|
94
|
+
}
|
|
95
|
+
|
|
84
96
|
return [
|
|
85
97
|
{
|
|
86
98
|
channel: 'quote',
|