@sebspark/tradeinsight 1.0.2 → 2.0.0
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/index.d.mts +19 -8
- package/dist/index.d.ts +19 -8
- package/dist/index.js +15 -3
- package/dist/index.mjs +14 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -40,19 +40,30 @@ declare const createForexId: ({ quoteCurrency, baseCurrency, }: {
|
|
|
40
40
|
baseCurrency: string;
|
|
41
41
|
quoteCurrency: string;
|
|
42
42
|
}) => string;
|
|
43
|
+
declare const createIndexId: ({ ticker }: {
|
|
44
|
+
ticker: string;
|
|
45
|
+
}) => string;
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
type:
|
|
46
|
-
isin
|
|
47
|
-
mic
|
|
48
|
-
currency
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
type StockId = {
|
|
48
|
+
type: 'STOCK';
|
|
49
|
+
isin: string;
|
|
50
|
+
mic: string;
|
|
51
|
+
currency: string;
|
|
52
|
+
};
|
|
53
|
+
type ForexId = {
|
|
54
|
+
type: 'FOREX';
|
|
55
|
+
baseCurrency: string;
|
|
56
|
+
quoteCurrency: string;
|
|
57
|
+
};
|
|
58
|
+
type IndexId = {
|
|
59
|
+
type: 'INDEX';
|
|
60
|
+
ticker: string;
|
|
51
61
|
};
|
|
62
|
+
declare const parseId: (id: string) => StockId | ForexId | IndexId;
|
|
52
63
|
|
|
53
64
|
declare const TickersTopic = "tradeinsight.tickers";
|
|
54
65
|
type TickersPubSubChannels = {
|
|
55
66
|
[TickersTopic]: TickerMessage;
|
|
56
67
|
};
|
|
57
68
|
|
|
58
|
-
export { CloudSchema, type InstrumentPrice, type Ticker, type TickerMessage, type TickersPubSubChannels, TickersTopic, createForexId, createStockId, parseId };
|
|
69
|
+
export { CloudSchema, type InstrumentPrice, type Ticker, type TickerMessage, type TickersPubSubChannels, TickersTopic, createForexId, createIndexId, createStockId, parseId };
|
package/dist/index.d.ts
CHANGED
|
@@ -40,19 +40,30 @@ declare const createForexId: ({ quoteCurrency, baseCurrency, }: {
|
|
|
40
40
|
baseCurrency: string;
|
|
41
41
|
quoteCurrency: string;
|
|
42
42
|
}) => string;
|
|
43
|
+
declare const createIndexId: ({ ticker }: {
|
|
44
|
+
ticker: string;
|
|
45
|
+
}) => string;
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
type:
|
|
46
|
-
isin
|
|
47
|
-
mic
|
|
48
|
-
currency
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
type StockId = {
|
|
48
|
+
type: 'STOCK';
|
|
49
|
+
isin: string;
|
|
50
|
+
mic: string;
|
|
51
|
+
currency: string;
|
|
52
|
+
};
|
|
53
|
+
type ForexId = {
|
|
54
|
+
type: 'FOREX';
|
|
55
|
+
baseCurrency: string;
|
|
56
|
+
quoteCurrency: string;
|
|
57
|
+
};
|
|
58
|
+
type IndexId = {
|
|
59
|
+
type: 'INDEX';
|
|
60
|
+
ticker: string;
|
|
51
61
|
};
|
|
62
|
+
declare const parseId: (id: string) => StockId | ForexId | IndexId;
|
|
52
63
|
|
|
53
64
|
declare const TickersTopic = "tradeinsight.tickers";
|
|
54
65
|
type TickersPubSubChannels = {
|
|
55
66
|
[TickersTopic]: TickerMessage;
|
|
56
67
|
};
|
|
57
68
|
|
|
58
|
-
export { CloudSchema, type InstrumentPrice, type Ticker, type TickerMessage, type TickersPubSubChannels, TickersTopic, createForexId, createStockId, parseId };
|
|
69
|
+
export { CloudSchema, type InstrumentPrice, type Ticker, type TickerMessage, type TickersPubSubChannels, TickersTopic, createForexId, createIndexId, createStockId, parseId };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(index_exports, {
|
|
|
23
23
|
CloudSchema: () => CloudSchema,
|
|
24
24
|
TickersTopic: () => TickersTopic,
|
|
25
25
|
createForexId: () => createForexId,
|
|
26
|
+
createIndexId: () => createIndexId,
|
|
26
27
|
createStockId: () => createStockId,
|
|
27
28
|
parseId: () => parseId
|
|
28
29
|
});
|
|
@@ -119,16 +120,17 @@ var createStockId = ({
|
|
|
119
120
|
isin,
|
|
120
121
|
mic,
|
|
121
122
|
currency
|
|
122
|
-
}) => `STOCK-${isin}
|
|
123
|
+
}) => `STOCK-${isin}_${mic}_${currency}`.toUpperCase();
|
|
123
124
|
var createForexId = ({
|
|
124
125
|
quoteCurrency,
|
|
125
126
|
baseCurrency
|
|
126
|
-
}) => `FOREX-${baseCurrency}
|
|
127
|
+
}) => `FOREX-${baseCurrency}_${quoteCurrency}`.toUpperCase();
|
|
128
|
+
var createIndexId = ({ ticker }) => `INDEX-${ticker}`.toUpperCase();
|
|
127
129
|
|
|
128
130
|
// src/instruments/parseId.ts
|
|
129
131
|
var parseId = (id) => {
|
|
130
132
|
const [type, ...rest] = id.split("-");
|
|
131
|
-
const [first, second, third] = rest.join(
|
|
133
|
+
const [first, second, third] = rest.join().split("_");
|
|
132
134
|
if (type === "STOCK") {
|
|
133
135
|
if (!second) {
|
|
134
136
|
throw new Error("Missing MIC");
|
|
@@ -156,6 +158,15 @@ var parseId = (id) => {
|
|
|
156
158
|
quoteCurrency: second
|
|
157
159
|
};
|
|
158
160
|
}
|
|
161
|
+
if (type === "INDEX") {
|
|
162
|
+
if (!first) {
|
|
163
|
+
throw new Error("Missing ticker");
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
type,
|
|
167
|
+
ticker: first
|
|
168
|
+
};
|
|
169
|
+
}
|
|
159
170
|
throw new Error("Invalid type");
|
|
160
171
|
};
|
|
161
172
|
|
|
@@ -166,6 +177,7 @@ var TickersTopic = "tradeinsight.tickers";
|
|
|
166
177
|
CloudSchema,
|
|
167
178
|
TickersTopic,
|
|
168
179
|
createForexId,
|
|
180
|
+
createIndexId,
|
|
169
181
|
createStockId,
|
|
170
182
|
parseId
|
|
171
183
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -89,16 +89,17 @@ var createStockId = ({
|
|
|
89
89
|
isin,
|
|
90
90
|
mic,
|
|
91
91
|
currency
|
|
92
|
-
}) => `STOCK-${isin}
|
|
92
|
+
}) => `STOCK-${isin}_${mic}_${currency}`.toUpperCase();
|
|
93
93
|
var createForexId = ({
|
|
94
94
|
quoteCurrency,
|
|
95
95
|
baseCurrency
|
|
96
|
-
}) => `FOREX-${baseCurrency}
|
|
96
|
+
}) => `FOREX-${baseCurrency}_${quoteCurrency}`.toUpperCase();
|
|
97
|
+
var createIndexId = ({ ticker }) => `INDEX-${ticker}`.toUpperCase();
|
|
97
98
|
|
|
98
99
|
// src/instruments/parseId.ts
|
|
99
100
|
var parseId = (id) => {
|
|
100
101
|
const [type, ...rest] = id.split("-");
|
|
101
|
-
const [first, second, third] = rest.join(
|
|
102
|
+
const [first, second, third] = rest.join().split("_");
|
|
102
103
|
if (type === "STOCK") {
|
|
103
104
|
if (!second) {
|
|
104
105
|
throw new Error("Missing MIC");
|
|
@@ -126,6 +127,15 @@ var parseId = (id) => {
|
|
|
126
127
|
quoteCurrency: second
|
|
127
128
|
};
|
|
128
129
|
}
|
|
130
|
+
if (type === "INDEX") {
|
|
131
|
+
if (!first) {
|
|
132
|
+
throw new Error("Missing ticker");
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
type,
|
|
136
|
+
ticker: first
|
|
137
|
+
};
|
|
138
|
+
}
|
|
129
139
|
throw new Error("Invalid type");
|
|
130
140
|
};
|
|
131
141
|
|
|
@@ -135,6 +145,7 @@ export {
|
|
|
135
145
|
CloudSchema,
|
|
136
146
|
TickersTopic,
|
|
137
147
|
createForexId,
|
|
148
|
+
createIndexId,
|
|
138
149
|
createStockId,
|
|
139
150
|
parseId
|
|
140
151
|
};
|