tardis-dev 12.5.22 → 12.6.7
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/apikeyaccessinfo.js +1 -1
- package/dist/apikeyaccessinfo.js.map +1 -1
- package/dist/clearcache.js +12 -12
- package/dist/clearcache.js.map +1 -1
- package/dist/combine.js +1 -1
- package/dist/combine.js.map +1 -1
- package/dist/computable/booksnapshot.d.ts.map +1 -1
- package/dist/computable/booksnapshot.js +1 -1
- package/dist/computable/booksnapshot.js.map +1 -1
- package/dist/computable/tradebar.d.ts.map +1 -1
- package/dist/computable/tradebar.js.map +1 -1
- package/dist/debug.js +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/downloaddatasets.js +13 -13
- package/dist/downloaddatasets.js.map +1 -1
- package/dist/exchangedetails.js +1 -1
- package/dist/exchangedetails.js.map +1 -1
- package/dist/filter.js.map +1 -1
- package/dist/handy.js +10 -10
- package/dist/handy.js.map +1 -1
- package/dist/instrumentinfo.js +1 -1
- package/dist/instrumentinfo.js.map +1 -1
- package/dist/mappers/binance.d.ts.map +1 -1
- package/dist/mappers/binance.js +2 -2
- package/dist/mappers/binance.js.map +1 -1
- package/dist/mappers/binanceoptions.js +10 -10
- package/dist/mappers/binanceoptions.js.map +1 -1
- package/dist/mappers/bitflyer.js +1 -1
- package/dist/mappers/bitflyer.js.map +1 -1
- package/dist/mappers/bybit.d.ts +12 -1
- package/dist/mappers/bybit.d.ts.map +1 -1
- package/dist/mappers/bybit.js +21 -3
- package/dist/mappers/bybit.js.map +1 -1
- package/dist/mappers/coinbase.js +2 -2
- package/dist/mappers/coinbase.js.map +1 -1
- package/dist/mappers/dydx.d.ts +6 -14
- package/dist/mappers/dydx.d.ts.map +1 -1
- package/dist/mappers/dydx.js +1 -1
- package/dist/mappers/dydx.js.map +1 -1
- package/dist/mappers/ftx.js +2 -2
- package/dist/mappers/ftx.js.map +1 -1
- package/dist/mappers/huobi.d.ts.map +1 -1
- package/dist/mappers/huobi.js +11 -11
- package/dist/mappers/huobi.js.map +1 -1
- package/dist/mappers/okex.js +14 -14
- package/dist/mappers/okex.js.map +1 -1
- package/dist/mappers/phemex.d.ts.map +1 -1
- package/dist/mappers/phemex.js.map +1 -1
- package/dist/realtimefeeds/ascendex.js +2 -2
- package/dist/realtimefeeds/ascendex.js.map +1 -1
- package/dist/realtimefeeds/binance.js +1 -1
- package/dist/realtimefeeds/binance.js.map +1 -1
- package/dist/realtimefeeds/bitmex.js +1 -1
- package/dist/realtimefeeds/bitmex.js.map +1 -1
- package/dist/realtimefeeds/ftx.js +1 -1
- package/dist/realtimefeeds/ftx.js.map +1 -1
- package/dist/realtimefeeds/huobi.js +7 -7
- package/dist/realtimefeeds/huobi.js.map +1 -1
- package/dist/realtimefeeds/okex.js +1 -1
- package/dist/realtimefeeds/okex.js.map +1 -1
- package/dist/realtimefeeds/realtimefeed.js +9 -9
- package/dist/realtimefeeds/realtimefeed.js.map +1 -1
- package/dist/replay.d.ts.map +1 -1
- package/dist/replay.js +75 -40
- package/dist/replay.js.map +1 -1
- package/dist/stream.js +4 -4
- package/dist/stream.js.map +1 -1
- package/dist/worker.js +12 -12
- package/dist/worker.js.map +1 -1
- package/package.json +19 -18
- package/src/computable/booksnapshot.ts +4 -2
- package/src/computable/tradebar.ts +4 -1
- package/src/downloaddatasets.ts +188 -188
- package/src/filter.ts +69 -69
- package/src/handy.ts +2 -2
- package/src/instrumentinfo.ts +1 -1
- package/src/mappers/ascendex.ts +156 -156
- package/src/mappers/binance.ts +6 -3
- package/src/mappers/bybit.ts +28 -4
- package/src/mappers/coinflex.ts +159 -159
- package/src/mappers/delta.ts +175 -175
- package/src/mappers/dydx.ts +303 -306
- package/src/mappers/gateio.ts +117 -117
- package/src/mappers/gateiofutures.ts +185 -185
- package/src/mappers/huobi.ts +4 -2
- package/src/mappers/phemex.ts +179 -177
- package/src/mappers/poloniex.ts +150 -150
- package/src/mappers/serum.ts +103 -103
- package/src/mappers/upbit.ts +104 -104
- package/src/realtimefeeds/ascendex.ts +65 -65
- package/src/realtimefeeds/coinflex.ts +29 -29
- package/src/realtimefeeds/delta.ts +27 -27
- package/src/realtimefeeds/dydx.ts +40 -40
- package/src/realtimefeeds/gateio.ts +41 -41
- package/src/realtimefeeds/gateiofutures.ts +90 -90
- package/src/realtimefeeds/poloniex.ts +28 -28
- package/src/realtimefeeds/realtimefeed.ts +2 -2
- package/src/realtimefeeds/upbit.ts +35 -35
- package/src/replay.ts +61 -18
- package/src/stream.ts +1 -1
package/src/mappers/serum.ts
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
import { Mapper } from './mapper'
|
|
2
|
-
import { Trade, BookChange } from '../types'
|
|
3
|
-
|
|
4
|
-
export class SerumTradesMapper implements Mapper<'serum', Trade> {
|
|
5
|
-
canHandle(message: SerumVialTrade) {
|
|
6
|
-
return message.type === 'trade'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
getFilters(symbols?: string[]) {
|
|
10
|
-
return [
|
|
11
|
-
{
|
|
12
|
-
channel: 'trade',
|
|
13
|
-
symbols
|
|
14
|
-
} as const
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
*map(message: SerumVialTrade, localTimestamp: Date): IterableIterator<Trade> {
|
|
19
|
-
yield {
|
|
20
|
-
type: 'trade',
|
|
21
|
-
symbol: message.market,
|
|
22
|
-
exchange: 'serum',
|
|
23
|
-
id: message.id,
|
|
24
|
-
price: Number(message.price),
|
|
25
|
-
amount: Number(message.size),
|
|
26
|
-
side: message.side,
|
|
27
|
-
timestamp: new Date(message.timestamp),
|
|
28
|
-
localTimestamp: localTimestamp
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export class SerumBookChangeMapper implements Mapper<'serum', BookChange> {
|
|
34
|
-
canHandle(message: SerumVialL2Snapshot | SerumVialL2Update) {
|
|
35
|
-
return message.type === 'l2snapshot' || message.type === 'l2update'
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
getFilters(symbols?: string[]) {
|
|
39
|
-
return [
|
|
40
|
-
{
|
|
41
|
-
channel: 'l2snapshot',
|
|
42
|
-
symbols
|
|
43
|
-
} as const,
|
|
44
|
-
{
|
|
45
|
-
channel: 'l2update',
|
|
46
|
-
symbols
|
|
47
|
-
} as const
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
*map(message: SerumVialL2Snapshot | SerumVialL2Update, localTimestamp: Date): IterableIterator<BookChange> {
|
|
52
|
-
yield {
|
|
53
|
-
type: 'book_change',
|
|
54
|
-
symbol: message.market,
|
|
55
|
-
exchange: 'serum',
|
|
56
|
-
isSnapshot: message.type === 'l2snapshot',
|
|
57
|
-
bids: message.bids.map(this.mapBookLevel),
|
|
58
|
-
asks: message.asks.map(this.mapBookLevel),
|
|
59
|
-
timestamp: new Date(message.timestamp),
|
|
60
|
-
localTimestamp
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
protected mapBookLevel(level: SerumVialPriceLevel) {
|
|
65
|
-
const price = Number(level[0])
|
|
66
|
-
const amount = Number(level[1])
|
|
67
|
-
return { price, amount }
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
type SerumVialTrade = {
|
|
72
|
-
type: 'trade'
|
|
73
|
-
market: 'RAY/USDT'
|
|
74
|
-
timestamp: '2021-05-22T00:00:59.448Z'
|
|
75
|
-
slot: 79469377
|
|
76
|
-
version: 3
|
|
77
|
-
id: '96845406386975144808722|185.8|1621641659448'
|
|
78
|
-
side: 'buy'
|
|
79
|
-
price: '5.235'
|
|
80
|
-
size: '185.8'
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
type SerumVialPriceLevel = [string, string]
|
|
84
|
-
|
|
85
|
-
type SerumVialL2Snapshot = {
|
|
86
|
-
type: 'l2snapshot'
|
|
87
|
-
market: 'RAY/USDT'
|
|
88
|
-
timestamp: '2021-05-21T23:58:56.899Z'
|
|
89
|
-
slot: 79469186
|
|
90
|
-
version: 3
|
|
91
|
-
asks: SerumVialPriceLevel[]
|
|
92
|
-
bids: SerumVialPriceLevel[]
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
type SerumVialL2Update = {
|
|
96
|
-
type: 'l2update'
|
|
97
|
-
market: 'RAY/USDT'
|
|
98
|
-
timestamp: '2021-05-22T00:00:20.959Z'
|
|
99
|
-
slot: 79469318
|
|
100
|
-
version: 3
|
|
101
|
-
asks: SerumVialPriceLevel[]
|
|
102
|
-
bids: SerumVialPriceLevel[]
|
|
103
|
-
}
|
|
1
|
+
import { Mapper } from './mapper'
|
|
2
|
+
import { Trade, BookChange } from '../types'
|
|
3
|
+
|
|
4
|
+
export class SerumTradesMapper implements Mapper<'serum', Trade> {
|
|
5
|
+
canHandle(message: SerumVialTrade) {
|
|
6
|
+
return message.type === 'trade'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getFilters(symbols?: string[]) {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
channel: 'trade',
|
|
13
|
+
symbols
|
|
14
|
+
} as const
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
*map(message: SerumVialTrade, localTimestamp: Date): IterableIterator<Trade> {
|
|
19
|
+
yield {
|
|
20
|
+
type: 'trade',
|
|
21
|
+
symbol: message.market,
|
|
22
|
+
exchange: 'serum',
|
|
23
|
+
id: message.id,
|
|
24
|
+
price: Number(message.price),
|
|
25
|
+
amount: Number(message.size),
|
|
26
|
+
side: message.side,
|
|
27
|
+
timestamp: new Date(message.timestamp),
|
|
28
|
+
localTimestamp: localTimestamp
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class SerumBookChangeMapper implements Mapper<'serum', BookChange> {
|
|
34
|
+
canHandle(message: SerumVialL2Snapshot | SerumVialL2Update) {
|
|
35
|
+
return message.type === 'l2snapshot' || message.type === 'l2update'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getFilters(symbols?: string[]) {
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
channel: 'l2snapshot',
|
|
42
|
+
symbols
|
|
43
|
+
} as const,
|
|
44
|
+
{
|
|
45
|
+
channel: 'l2update',
|
|
46
|
+
symbols
|
|
47
|
+
} as const
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
*map(message: SerumVialL2Snapshot | SerumVialL2Update, localTimestamp: Date): IterableIterator<BookChange> {
|
|
52
|
+
yield {
|
|
53
|
+
type: 'book_change',
|
|
54
|
+
symbol: message.market,
|
|
55
|
+
exchange: 'serum',
|
|
56
|
+
isSnapshot: message.type === 'l2snapshot',
|
|
57
|
+
bids: message.bids.map(this.mapBookLevel),
|
|
58
|
+
asks: message.asks.map(this.mapBookLevel),
|
|
59
|
+
timestamp: new Date(message.timestamp),
|
|
60
|
+
localTimestamp
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
protected mapBookLevel(level: SerumVialPriceLevel) {
|
|
65
|
+
const price = Number(level[0])
|
|
66
|
+
const amount = Number(level[1])
|
|
67
|
+
return { price, amount }
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type SerumVialTrade = {
|
|
72
|
+
type: 'trade'
|
|
73
|
+
market: 'RAY/USDT'
|
|
74
|
+
timestamp: '2021-05-22T00:00:59.448Z'
|
|
75
|
+
slot: 79469377
|
|
76
|
+
version: 3
|
|
77
|
+
id: '96845406386975144808722|185.8|1621641659448'
|
|
78
|
+
side: 'buy'
|
|
79
|
+
price: '5.235'
|
|
80
|
+
size: '185.8'
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type SerumVialPriceLevel = [string, string]
|
|
84
|
+
|
|
85
|
+
type SerumVialL2Snapshot = {
|
|
86
|
+
type: 'l2snapshot'
|
|
87
|
+
market: 'RAY/USDT'
|
|
88
|
+
timestamp: '2021-05-21T23:58:56.899Z'
|
|
89
|
+
slot: 79469186
|
|
90
|
+
version: 3
|
|
91
|
+
asks: SerumVialPriceLevel[]
|
|
92
|
+
bids: SerumVialPriceLevel[]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
type SerumVialL2Update = {
|
|
96
|
+
type: 'l2update'
|
|
97
|
+
market: 'RAY/USDT'
|
|
98
|
+
timestamp: '2021-05-22T00:00:20.959Z'
|
|
99
|
+
slot: 79469318
|
|
100
|
+
version: 3
|
|
101
|
+
asks: SerumVialPriceLevel[]
|
|
102
|
+
bids: SerumVialPriceLevel[]
|
|
103
|
+
}
|
package/src/mappers/upbit.ts
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import { Mapper } from './mapper'
|
|
2
|
-
import { Trade, BookChange, BookPriceLevel } from '../types'
|
|
3
|
-
|
|
4
|
-
export class UpbitTradesMapper implements Mapper<'upbit', Trade> {
|
|
5
|
-
canHandle(message: UpbitTrade) {
|
|
6
|
-
return message.type === 'trade'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
getFilters(symbols?: string[]) {
|
|
10
|
-
return [
|
|
11
|
-
{
|
|
12
|
-
channel: 'trade',
|
|
13
|
-
symbols
|
|
14
|
-
} as const
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
*map(message: UpbitTrade, localTimestamp: Date): IterableIterator<Trade> {
|
|
19
|
-
yield {
|
|
20
|
-
type: 'trade',
|
|
21
|
-
symbol: message.code,
|
|
22
|
-
exchange: 'upbit',
|
|
23
|
-
id: String(message.sequential_id),
|
|
24
|
-
price: message.trade_price,
|
|
25
|
-
amount: message.trade_volume,
|
|
26
|
-
side: message.ask_bid === 'ASK' ? 'sell' : 'buy',
|
|
27
|
-
timestamp: new Date(message.trade_timestamp),
|
|
28
|
-
localTimestamp: localTimestamp
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export class UpbitBookChangeMapper implements Mapper<'upbit', BookChange> {
|
|
34
|
-
canHandle(message: UpbitOrderBook) {
|
|
35
|
-
return message.type === 'orderbook'
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
getFilters(symbols?: string[]) {
|
|
39
|
-
return [
|
|
40
|
-
{
|
|
41
|
-
channel: 'orderbook',
|
|
42
|
-
symbols
|
|
43
|
-
} as const
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
*map(message: UpbitOrderBook, localTimestamp: Date): IterableIterator<BookChange> {
|
|
48
|
-
let asks: BookPriceLevel[] = []
|
|
49
|
-
let bids: BookPriceLevel[] = []
|
|
50
|
-
|
|
51
|
-
for (const level of message.orderbook_units) {
|
|
52
|
-
if (level.ask_price > 0) {
|
|
53
|
-
asks.push({
|
|
54
|
-
price: level.ask_price,
|
|
55
|
-
amount: level.ask_size
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (level.bid_price > 0) {
|
|
60
|
-
bids.push({
|
|
61
|
-
price: level.bid_price,
|
|
62
|
-
amount: level.bid_size
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
yield {
|
|
67
|
-
type: 'book_change',
|
|
68
|
-
symbol: message.code,
|
|
69
|
-
exchange: 'upbit',
|
|
70
|
-
isSnapshot: true,
|
|
71
|
-
bids,
|
|
72
|
-
asks,
|
|
73
|
-
timestamp: new Date(message.timestamp),
|
|
74
|
-
localTimestamp
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
type UpbitTrade = {
|
|
80
|
-
type: 'trade'
|
|
81
|
-
code: 'KRW-DOGE'
|
|
82
|
-
timestamp: 1614729599905
|
|
83
|
-
trade_date: '2021-03-02'
|
|
84
|
-
trade_time: '23:59:59'
|
|
85
|
-
trade_timestamp: 1614729599000
|
|
86
|
-
trade_price: 58.4
|
|
87
|
-
trade_volume: 836.12040133
|
|
88
|
-
ask_bid: 'ASK'
|
|
89
|
-
prev_closing_price: 57.5
|
|
90
|
-
change: 'RISE'
|
|
91
|
-
change_price: 0.9
|
|
92
|
-
sequential_id: 1614729599000000
|
|
93
|
-
stream_type: 'REALTIME'
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
type UpbitOrderBook = {
|
|
97
|
-
type: 'orderbook'
|
|
98
|
-
code: 'KRW-DOT'
|
|
99
|
-
timestamp: 1614729599677
|
|
100
|
-
total_ask_size: 1415.12521016
|
|
101
|
-
total_bid_size: 8058.44442437
|
|
102
|
-
orderbook_units: { ask_price: number; bid_price: number; ask_size: number; bid_size: number }[]
|
|
103
|
-
stream_type: 'REALTIME'
|
|
104
|
-
}
|
|
1
|
+
import { Mapper } from './mapper'
|
|
2
|
+
import { Trade, BookChange, BookPriceLevel } from '../types'
|
|
3
|
+
|
|
4
|
+
export class UpbitTradesMapper implements Mapper<'upbit', Trade> {
|
|
5
|
+
canHandle(message: UpbitTrade) {
|
|
6
|
+
return message.type === 'trade'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getFilters(symbols?: string[]) {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
channel: 'trade',
|
|
13
|
+
symbols
|
|
14
|
+
} as const
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
*map(message: UpbitTrade, localTimestamp: Date): IterableIterator<Trade> {
|
|
19
|
+
yield {
|
|
20
|
+
type: 'trade',
|
|
21
|
+
symbol: message.code,
|
|
22
|
+
exchange: 'upbit',
|
|
23
|
+
id: String(message.sequential_id),
|
|
24
|
+
price: message.trade_price,
|
|
25
|
+
amount: message.trade_volume,
|
|
26
|
+
side: message.ask_bid === 'ASK' ? 'sell' : 'buy',
|
|
27
|
+
timestamp: new Date(message.trade_timestamp),
|
|
28
|
+
localTimestamp: localTimestamp
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class UpbitBookChangeMapper implements Mapper<'upbit', BookChange> {
|
|
34
|
+
canHandle(message: UpbitOrderBook) {
|
|
35
|
+
return message.type === 'orderbook'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getFilters(symbols?: string[]) {
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
channel: 'orderbook',
|
|
42
|
+
symbols
|
|
43
|
+
} as const
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
*map(message: UpbitOrderBook, localTimestamp: Date): IterableIterator<BookChange> {
|
|
48
|
+
let asks: BookPriceLevel[] = []
|
|
49
|
+
let bids: BookPriceLevel[] = []
|
|
50
|
+
|
|
51
|
+
for (const level of message.orderbook_units) {
|
|
52
|
+
if (level.ask_price > 0) {
|
|
53
|
+
asks.push({
|
|
54
|
+
price: level.ask_price,
|
|
55
|
+
amount: level.ask_size
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (level.bid_price > 0) {
|
|
60
|
+
bids.push({
|
|
61
|
+
price: level.bid_price,
|
|
62
|
+
amount: level.bid_size
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
yield {
|
|
67
|
+
type: 'book_change',
|
|
68
|
+
symbol: message.code,
|
|
69
|
+
exchange: 'upbit',
|
|
70
|
+
isSnapshot: true,
|
|
71
|
+
bids,
|
|
72
|
+
asks,
|
|
73
|
+
timestamp: new Date(message.timestamp),
|
|
74
|
+
localTimestamp
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type UpbitTrade = {
|
|
80
|
+
type: 'trade'
|
|
81
|
+
code: 'KRW-DOGE'
|
|
82
|
+
timestamp: 1614729599905
|
|
83
|
+
trade_date: '2021-03-02'
|
|
84
|
+
trade_time: '23:59:59'
|
|
85
|
+
trade_timestamp: 1614729599000
|
|
86
|
+
trade_price: 58.4
|
|
87
|
+
trade_volume: 836.12040133
|
|
88
|
+
ask_bid: 'ASK'
|
|
89
|
+
prev_closing_price: 57.5
|
|
90
|
+
change: 'RISE'
|
|
91
|
+
change_price: 0.9
|
|
92
|
+
sequential_id: 1614729599000000
|
|
93
|
+
stream_type: 'REALTIME'
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
type UpbitOrderBook = {
|
|
97
|
+
type: 'orderbook'
|
|
98
|
+
code: 'KRW-DOT'
|
|
99
|
+
timestamp: 1614729599677
|
|
100
|
+
total_ask_size: 1415.12521016
|
|
101
|
+
total_bid_size: 8058.44442437
|
|
102
|
+
orderbook_units: { ask_price: number; bid_price: number; ask_size: number; bid_size: number }[]
|
|
103
|
+
stream_type: 'REALTIME'
|
|
104
|
+
}
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { wait } from '../handy'
|
|
2
|
-
import { Filter } from '../types'
|
|
3
|
-
import { RealTimeFeedBase } from './realtimefeed'
|
|
4
|
-
|
|
5
|
-
export class AscendexRealTimeFeed extends RealTimeFeedBase {
|
|
6
|
-
protected readonly wssURL = 'wss://ascendex.com/api/pro/v2/stream'
|
|
7
|
-
|
|
8
|
-
protected mapToSubscribeMessages(filters: Filter<string>[]): any[] {
|
|
9
|
-
const subs = filters
|
|
10
|
-
.filter((f) => f.channel !== 'depth-snapshot-realtime')
|
|
11
|
-
.map((filter) => {
|
|
12
|
-
if (filter.channel === 'futures-pricing-data') {
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
op: 'sub',
|
|
16
|
-
ch: 'futures-pricing-data'
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (!filter.symbols || filter.symbols.length === 0) {
|
|
22
|
-
throw new Error('AscendexRealTimeFeed requires explicitly specified symbols when subscribing to live feed')
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return filter.symbols.map((symbol) => {
|
|
26
|
-
return {
|
|
27
|
-
op: 'sub',
|
|
28
|
-
ch: `${filter.channel}:${symbol}`
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
.flatMap((f) => f)
|
|
33
|
-
|
|
34
|
-
return subs
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
protected messageIsError(message: any): boolean {
|
|
38
|
-
return message.m === 'error'
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
protected async provideManualSnapshots(filters: Filter<string>[], shouldCancel: () => boolean) {
|
|
42
|
-
const depthSnapshotChannel = filters.find((f) => f.channel === 'depth-snapshot-realtime')
|
|
43
|
-
if (!depthSnapshotChannel) {
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
await wait(100)
|
|
48
|
-
|
|
49
|
-
for (let symbol of depthSnapshotChannel.symbols!) {
|
|
50
|
-
if (shouldCancel()) {
|
|
51
|
-
return
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
this.send({
|
|
55
|
-
op: 'req',
|
|
56
|
-
action: 'depth-snapshot-realtime',
|
|
57
|
-
args: { symbol }
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
await wait(10)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
this.debug('sent depth-snapshot-realtime "req" for: %s', depthSnapshotChannel.symbols)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
import { wait } from '../handy'
|
|
2
|
+
import { Filter } from '../types'
|
|
3
|
+
import { RealTimeFeedBase } from './realtimefeed'
|
|
4
|
+
|
|
5
|
+
export class AscendexRealTimeFeed extends RealTimeFeedBase {
|
|
6
|
+
protected readonly wssURL = 'wss://ascendex.com/api/pro/v2/stream'
|
|
7
|
+
|
|
8
|
+
protected mapToSubscribeMessages(filters: Filter<string>[]): any[] {
|
|
9
|
+
const subs = filters
|
|
10
|
+
.filter((f) => f.channel !== 'depth-snapshot-realtime')
|
|
11
|
+
.map((filter) => {
|
|
12
|
+
if (filter.channel === 'futures-pricing-data') {
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
op: 'sub',
|
|
16
|
+
ch: 'futures-pricing-data'
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!filter.symbols || filter.symbols.length === 0) {
|
|
22
|
+
throw new Error('AscendexRealTimeFeed requires explicitly specified symbols when subscribing to live feed')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return filter.symbols.map((symbol) => {
|
|
26
|
+
return {
|
|
27
|
+
op: 'sub',
|
|
28
|
+
ch: `${filter.channel}:${symbol}`
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
.flatMap((f) => f)
|
|
33
|
+
|
|
34
|
+
return subs
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
protected messageIsError(message: any): boolean {
|
|
38
|
+
return message.m === 'error'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
protected async provideManualSnapshots(filters: Filter<string>[], shouldCancel: () => boolean) {
|
|
42
|
+
const depthSnapshotChannel = filters.find((f) => f.channel === 'depth-snapshot-realtime')
|
|
43
|
+
if (!depthSnapshotChannel) {
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
await wait(100)
|
|
48
|
+
|
|
49
|
+
for (let symbol of depthSnapshotChannel.symbols!) {
|
|
50
|
+
if (shouldCancel()) {
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this.send({
|
|
55
|
+
op: 'req',
|
|
56
|
+
action: 'depth-snapshot-realtime',
|
|
57
|
+
args: { symbol }
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
await wait(10)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this.debug('sent depth-snapshot-realtime "req" for: %s', depthSnapshotChannel.symbols)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { Filter } from '../types'
|
|
2
|
-
import { RealTimeFeedBase } from './realtimefeed'
|
|
3
|
-
|
|
4
|
-
export class CoinflexRealTimeFeed extends RealTimeFeedBase {
|
|
5
|
-
protected readonly wssURL = 'wss://v2api.coinflex.com/v2/websocket'
|
|
6
|
-
|
|
7
|
-
protected mapToSubscribeMessages(filters: Filter<string>[]): any[] {
|
|
8
|
-
const args = filters
|
|
9
|
-
.map((filter) => {
|
|
10
|
-
if (!filter.symbols || filter.symbols.length === 0) {
|
|
11
|
-
throw new Error('CoinflexRealTimeFeed requires explicitly specified symbols when subscribing to live feed')
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return filter.symbols.map((s) => `${filter.channel}:${s}`)
|
|
15
|
-
})
|
|
16
|
-
.flatMap((s) => s)
|
|
17
|
-
|
|
18
|
-
const payload = {
|
|
19
|
-
op: 'subscribe',
|
|
20
|
-
args
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return [payload]
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
protected messageIsError(message: any): boolean {
|
|
27
|
-
return message.success === false
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
import { Filter } from '../types'
|
|
2
|
+
import { RealTimeFeedBase } from './realtimefeed'
|
|
3
|
+
|
|
4
|
+
export class CoinflexRealTimeFeed extends RealTimeFeedBase {
|
|
5
|
+
protected readonly wssURL = 'wss://v2api.coinflex.com/v2/websocket'
|
|
6
|
+
|
|
7
|
+
protected mapToSubscribeMessages(filters: Filter<string>[]): any[] {
|
|
8
|
+
const args = filters
|
|
9
|
+
.map((filter) => {
|
|
10
|
+
if (!filter.symbols || filter.symbols.length === 0) {
|
|
11
|
+
throw new Error('CoinflexRealTimeFeed requires explicitly specified symbols when subscribing to live feed')
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return filter.symbols.map((s) => `${filter.channel}:${s}`)
|
|
15
|
+
})
|
|
16
|
+
.flatMap((s) => s)
|
|
17
|
+
|
|
18
|
+
const payload = {
|
|
19
|
+
op: 'subscribe',
|
|
20
|
+
args
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return [payload]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
protected messageIsError(message: any): boolean {
|
|
27
|
+
return message.success === false
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { Filter } from '../types'
|
|
2
|
-
import { RealTimeFeedBase } from './realtimefeed'
|
|
3
|
-
|
|
4
|
-
export class DeltaRealTimeFeed extends RealTimeFeedBase {
|
|
5
|
-
protected readonly wssURL = 'wss://api.delta.exchange:2096'
|
|
6
|
-
|
|
7
|
-
protected mapToSubscribeMessages(filters: Filter<string>[]) {
|
|
8
|
-
return filters.map((filter) => {
|
|
9
|
-
return {
|
|
10
|
-
type: 'subscribe',
|
|
11
|
-
payload: {
|
|
12
|
-
channels: [
|
|
13
|
-
{
|
|
14
|
-
name: filter.channel,
|
|
15
|
-
symbols:
|
|
16
|
-
filter.symbols !== undefined && filter.channel === 'mark_price' ? filter.symbols.map((s) => `MARK:${s}`) : filter.symbols
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
protected messageIsError(message: any): boolean {
|
|
25
|
-
return message.error !== undefined && message.error !== null
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
import { Filter } from '../types'
|
|
2
|
+
import { RealTimeFeedBase } from './realtimefeed'
|
|
3
|
+
|
|
4
|
+
export class DeltaRealTimeFeed extends RealTimeFeedBase {
|
|
5
|
+
protected readonly wssURL = 'wss://api.delta.exchange:2096'
|
|
6
|
+
|
|
7
|
+
protected mapToSubscribeMessages(filters: Filter<string>[]) {
|
|
8
|
+
return filters.map((filter) => {
|
|
9
|
+
return {
|
|
10
|
+
type: 'subscribe',
|
|
11
|
+
payload: {
|
|
12
|
+
channels: [
|
|
13
|
+
{
|
|
14
|
+
name: filter.channel,
|
|
15
|
+
symbols:
|
|
16
|
+
filter.symbols !== undefined && filter.channel === 'mark_price' ? filter.symbols.map((s) => `MARK:${s}`) : filter.symbols
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
protected messageIsError(message: any): boolean {
|
|
25
|
+
return message.error !== undefined && message.error !== null
|
|
26
|
+
}
|
|
27
|
+
}
|