tardis-dev 16.6.0 → 16.6.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.
Files changed (53) hide show
  1. package/README.md +4 -4
  2. package/dist/consts.d.ts +1 -1
  3. package/dist/consts.js +1 -1
  4. package/dist/consts.js.map +1 -1
  5. package/dist/handy.d.ts +1 -0
  6. package/dist/handy.d.ts.map +1 -1
  7. package/dist/handy.js +18 -0
  8. package/dist/handy.js.map +1 -1
  9. package/dist/instrumentinfo.d.ts +1 -1
  10. package/dist/instrumentinfo.d.ts.map +1 -1
  11. package/dist/instrumentinfo.js +3 -1
  12. package/dist/instrumentinfo.js.map +1 -1
  13. package/dist/mappers/index.d.ts +3 -3
  14. package/dist/mappers/kraken.d.ts.map +1 -1
  15. package/dist/mappers/kraken.js +95 -8
  16. package/dist/mappers/kraken.js.map +1 -1
  17. package/dist/mappers/woox.d.ts +3 -3
  18. package/dist/mappers/woox.d.ts.map +1 -1
  19. package/dist/mappers/woox.js +255 -6
  20. package/dist/mappers/woox.js.map +1 -1
  21. package/dist/realtimefeeds/index.d.ts.map +1 -1
  22. package/dist/realtimefeeds/index.js +0 -2
  23. package/dist/realtimefeeds/index.js.map +1 -1
  24. package/dist/realtimefeeds/kraken.d.ts +1 -0
  25. package/dist/realtimefeeds/kraken.d.ts.map +1 -1
  26. package/dist/realtimefeeds/kraken.js +26 -15
  27. package/dist/realtimefeeds/kraken.js.map +1 -1
  28. package/dist/realtimefeeds/woox.d.ts +1 -0
  29. package/dist/realtimefeeds/woox.d.ts.map +1 -1
  30. package/dist/realtimefeeds/woox.js +41 -25
  31. package/dist/realtimefeeds/woox.js.map +1 -1
  32. package/dist/replay.d.ts.map +1 -1
  33. package/dist/replay.js +4 -6
  34. package/dist/replay.js.map +1 -1
  35. package/dist/stream.d.ts.map +1 -1
  36. package/dist/stream.js +2 -5
  37. package/dist/stream.js.map +1 -1
  38. package/package.json +1 -1
  39. package/src/consts.ts +1 -1
  40. package/src/handy.ts +22 -0
  41. package/src/instrumentinfo.ts +5 -2
  42. package/src/mappers/kraken.ts +162 -11
  43. package/src/mappers/woox.ts +371 -7
  44. package/src/realtimefeeds/index.ts +0 -2
  45. package/src/realtimefeeds/kraken.ts +26 -15
  46. package/src/realtimefeeds/woox.ts +63 -26
  47. package/src/replay.ts +4 -7
  48. package/src/stream.ts +2 -5
  49. package/dist/realtimefeeds/ascendex.d.ts +0 -11
  50. package/dist/realtimefeeds/ascendex.d.ts.map +0 -1
  51. package/dist/realtimefeeds/ascendex.js +0 -59
  52. package/dist/realtimefeeds/ascendex.js.map +0 -1
  53. package/src/realtimefeeds/ascendex.ts +0 -73
package/src/stream.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { debug } from './debug.ts'
2
- import { getFilters, normalizeMessages } from './handy.ts'
2
+ import { createNormalizedSymbolFilter, getFilters, normalizeMessages } from './handy.ts'
3
3
  import { MapperFactory } from './mappers/index.ts'
4
4
  import { createRealTimeFeed } from './realtimefeeds/index.ts'
5
5
  import { Disconnect, Exchange, Filter, FilterForExchange } from './types.ts'
@@ -75,10 +75,7 @@ async function* _streamNormalized<T extends Exchange, U extends MapperFactory<T,
75
75
  // filter normalized messages by symbol as some exchanges do not offer subscribing to specific symbols for some of the channels
76
76
  // for example Phemex market24h channel
77
77
 
78
- const upperCaseSymbols = symbols !== undefined ? symbols.map((s) => s.toUpperCase()) : undefined
79
- const filter = (symbol: string) => {
80
- return upperCaseSymbols === undefined || upperCaseSymbols.length === 0 || upperCaseSymbols.includes(symbol)
81
- }
78
+ const filter = createNormalizedSymbolFilter(symbols, filters)
82
79
 
83
80
  const normalizedMessages = normalizeMessages(
84
81
  exchange,
@@ -1,11 +0,0 @@
1
- import { Filter } from '../types.ts';
2
- import { RealTimeFeedBase } from './realtimefeed.ts';
3
- export declare class AscendexRealTimeFeed extends RealTimeFeedBase {
4
- protected readonly wssURL = "wss://ascendex.com/api/pro/v2/stream";
5
- protected mapToSubscribeMessages(filters: Filter<string>[]): any[];
6
- protected messageIsError(message: any): boolean;
7
- protected sendCustomPing: () => void;
8
- protected messageIsHeartbeat(msg: any): boolean;
9
- protected provideManualSnapshots(filters: Filter<string>[], shouldCancel: () => boolean): Promise<void>;
10
- }
11
- //# sourceMappingURL=ascendex.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ascendex.d.ts","sourceRoot":"","sources":["../../src/realtimefeeds/ascendex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEpD,qBAAa,oBAAqB,SAAQ,gBAAgB;IACxD,SAAS,CAAC,QAAQ,CAAC,MAAM,0CAAyC;IAElE,SAAS,CAAC,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,EAAE;IA6BlE,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO;IAI/C,SAAS,CAAC,cAAc,aAEvB;IAED,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG;cAIrB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,OAAO;CAwB9F"}
@@ -1,59 +0,0 @@
1
- import { wait } from "../handy.js";
2
- import { RealTimeFeedBase } from "./realtimefeed.js";
3
- export class AscendexRealTimeFeed extends RealTimeFeedBase {
4
- wssURL = 'wss://ascendex.com/api/pro/v2/stream';
5
- mapToSubscribeMessages(filters) {
6
- const subs = filters
7
- .filter((f) => f.channel !== 'depth-snapshot-realtime')
8
- .map((filter) => {
9
- if (filter.channel === 'futures-pricing-data') {
10
- return [
11
- {
12
- op: 'sub',
13
- ch: 'futures-pricing-data'
14
- }
15
- ];
16
- }
17
- if (!filter.symbols || filter.symbols.length === 0) {
18
- throw new Error('AscendexRealTimeFeed requires explicitly specified symbols when subscribing to live feed');
19
- }
20
- return filter.symbols.map((symbol) => {
21
- return {
22
- op: 'sub',
23
- ch: `${filter.channel}:${symbol}`
24
- };
25
- });
26
- })
27
- .flatMap((f) => f);
28
- return subs;
29
- }
30
- messageIsError(message) {
31
- return message.m === 'error';
32
- }
33
- sendCustomPing = () => {
34
- this.send({ op: 'ping' });
35
- };
36
- messageIsHeartbeat(msg) {
37
- return msg.m === 'pong';
38
- }
39
- async provideManualSnapshots(filters, shouldCancel) {
40
- const depthSnapshotChannel = filters.find((f) => f.channel === 'depth-snapshot-realtime');
41
- if (!depthSnapshotChannel) {
42
- return;
43
- }
44
- await wait(100);
45
- for (let symbol of depthSnapshotChannel.symbols) {
46
- if (shouldCancel()) {
47
- return;
48
- }
49
- this.send({
50
- op: 'req',
51
- action: 'depth-snapshot-realtime',
52
- args: { symbol }
53
- });
54
- await wait(10);
55
- }
56
- this.debug('sent depth-snapshot-realtime "req" for: %s', depthSnapshotChannel.symbols);
57
- }
58
- }
59
- //# sourceMappingURL=ascendex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ascendex.js","sourceRoot":"","sources":["../../src/realtimefeeds/ascendex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEpD,MAAM,OAAO,oBAAqB,SAAQ,gBAAgB;IACrC,MAAM,GAAG,sCAAsC,CAAA;IAExD,sBAAsB,CAAC,OAAyB;QACxD,MAAM,IAAI,GAAG,OAAO;aACjB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,yBAAyB,CAAC;aACtD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACd,IAAI,MAAM,CAAC,OAAO,KAAK,sBAAsB,EAAE,CAAC;gBAC9C,OAAO;oBACL;wBACE,EAAE,EAAE,KAAK;wBACT,EAAE,EAAE,sBAAsB;qBAC3B;iBACF,CAAA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E,EAAE,KAAK;gBACT,MAAM,EAAE,yBAAyB;gBACjC,IAAI,EAAE,EAAE,MAAM,EAAE;aACjB,CAAC,CAAA;YAEF,MAAM,IAAI,CAAC,EAAE,CAAC,CAAA;QAChB,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,4CAA4C,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAA;IACxF,CAAC;CACF"}
@@ -1,73 +0,0 @@
1
- import { wait } from '../handy.ts'
2
- import { Filter } from '../types.ts'
3
- import { RealTimeFeedBase } from './realtimefeed.ts'
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 sendCustomPing = () => {
42
- this.send({ op: 'ping' })
43
- }
44
-
45
- protected messageIsHeartbeat(msg: any) {
46
- return msg.m === 'pong'
47
- }
48
-
49
- protected async provideManualSnapshots(filters: Filter<string>[], shouldCancel: () => boolean) {
50
- const depthSnapshotChannel = filters.find((f) => f.channel === 'depth-snapshot-realtime')
51
- if (!depthSnapshotChannel) {
52
- return
53
- }
54
-
55
- await wait(100)
56
-
57
- for (let symbol of depthSnapshotChannel.symbols!) {
58
- if (shouldCancel()) {
59
- return
60
- }
61
-
62
- this.send({
63
- op: 'req',
64
- action: 'depth-snapshot-realtime',
65
- args: { symbol }
66
- })
67
-
68
- await wait(10)
69
- }
70
-
71
- this.debug('sent depth-snapshot-realtime "req" for: %s', depthSnapshotChannel.symbols)
72
- }
73
- }