@sebspark/tradeinsight 0.5.1 → 1.0.1
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 +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +7 -7
- package/dist/index.mjs +7 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -25,9 +25,20 @@ declare const createStockId: ({ isin, mic, currency, }: {
|
|
|
25
25
|
currency: string;
|
|
26
26
|
mic: string;
|
|
27
27
|
}) => string;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Create an ID for a FOREX instrument, i.e. a currency relationship.
|
|
30
|
+
* The structure matches a currency pair:
|
|
31
|
+
*
|
|
32
|
+
* Base currency / quote currency = Exchange rate
|
|
33
|
+
*
|
|
34
|
+
* @see https://en.wikipedia.org/wiki/Currency_pair
|
|
35
|
+
* @example
|
|
36
|
+
* EUR/USD = 1.45
|
|
37
|
+
* This means a person would need 1.45 US dollars to purchase one Euro.
|
|
38
|
+
*/
|
|
39
|
+
declare const createForexId: ({ quoteCurrency, baseCurrency, }: {
|
|
40
|
+
baseCurrency: string;
|
|
41
|
+
quoteCurrency: string;
|
|
31
42
|
}) => string;
|
|
32
43
|
|
|
33
44
|
declare const parseId: (id: string) => {
|
|
@@ -35,8 +46,8 @@ declare const parseId: (id: string) => {
|
|
|
35
46
|
isin?: string;
|
|
36
47
|
mic?: string;
|
|
37
48
|
currency?: string;
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
baseCurrency?: string;
|
|
50
|
+
quoteCurrency?: string;
|
|
40
51
|
};
|
|
41
52
|
|
|
42
53
|
declare const TickersTopic = "tradeinsight.tickers";
|
package/dist/index.d.ts
CHANGED
|
@@ -25,9 +25,20 @@ declare const createStockId: ({ isin, mic, currency, }: {
|
|
|
25
25
|
currency: string;
|
|
26
26
|
mic: string;
|
|
27
27
|
}) => string;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Create an ID for a FOREX instrument, i.e. a currency relationship.
|
|
30
|
+
* The structure matches a currency pair:
|
|
31
|
+
*
|
|
32
|
+
* Base currency / quote currency = Exchange rate
|
|
33
|
+
*
|
|
34
|
+
* @see https://en.wikipedia.org/wiki/Currency_pair
|
|
35
|
+
* @example
|
|
36
|
+
* EUR/USD = 1.45
|
|
37
|
+
* This means a person would need 1.45 US dollars to purchase one Euro.
|
|
38
|
+
*/
|
|
39
|
+
declare const createForexId: ({ quoteCurrency, baseCurrency, }: {
|
|
40
|
+
baseCurrency: string;
|
|
41
|
+
quoteCurrency: string;
|
|
31
42
|
}) => string;
|
|
32
43
|
|
|
33
44
|
declare const parseId: (id: string) => {
|
|
@@ -35,8 +46,8 @@ declare const parseId: (id: string) => {
|
|
|
35
46
|
isin?: string;
|
|
36
47
|
mic?: string;
|
|
37
48
|
currency?: string;
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
baseCurrency?: string;
|
|
50
|
+
quoteCurrency?: string;
|
|
40
51
|
};
|
|
41
52
|
|
|
42
53
|
declare const TickersTopic = "tradeinsight.tickers";
|
package/dist/index.js
CHANGED
|
@@ -121,9 +121,9 @@ var createStockId = ({
|
|
|
121
121
|
currency
|
|
122
122
|
}) => `STOCK-${isin};${mic};${currency}`.toUpperCase();
|
|
123
123
|
var createForexId = ({
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}) => `FOREX-${
|
|
124
|
+
quoteCurrency,
|
|
125
|
+
baseCurrency
|
|
126
|
+
}) => `FOREX-${baseCurrency};${quoteCurrency}`.toUpperCase();
|
|
127
127
|
|
|
128
128
|
// src/instruments/parseId.ts
|
|
129
129
|
var parseId = (id) => {
|
|
@@ -145,15 +145,15 @@ var parseId = (id) => {
|
|
|
145
145
|
}
|
|
146
146
|
if (type === "FOREX") {
|
|
147
147
|
if (!first) {
|
|
148
|
-
throw new Error("Missing
|
|
148
|
+
throw new Error("Missing baseCurrency");
|
|
149
149
|
}
|
|
150
150
|
if (!second) {
|
|
151
|
-
throw new Error("Missing
|
|
151
|
+
throw new Error("Missing quoteCurrency");
|
|
152
152
|
}
|
|
153
153
|
return {
|
|
154
154
|
type,
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
baseCurrency: first,
|
|
156
|
+
quoteCurrency: second
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
throw new Error("Invalid type");
|
package/dist/index.mjs
CHANGED
|
@@ -91,9 +91,9 @@ var createStockId = ({
|
|
|
91
91
|
currency
|
|
92
92
|
}) => `STOCK-${isin};${mic};${currency}`.toUpperCase();
|
|
93
93
|
var createForexId = ({
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}) => `FOREX-${
|
|
94
|
+
quoteCurrency,
|
|
95
|
+
baseCurrency
|
|
96
|
+
}) => `FOREX-${baseCurrency};${quoteCurrency}`.toUpperCase();
|
|
97
97
|
|
|
98
98
|
// src/instruments/parseId.ts
|
|
99
99
|
var parseId = (id) => {
|
|
@@ -115,15 +115,15 @@ var parseId = (id) => {
|
|
|
115
115
|
}
|
|
116
116
|
if (type === "FOREX") {
|
|
117
117
|
if (!first) {
|
|
118
|
-
throw new Error("Missing
|
|
118
|
+
throw new Error("Missing baseCurrency");
|
|
119
119
|
}
|
|
120
120
|
if (!second) {
|
|
121
|
-
throw new Error("Missing
|
|
121
|
+
throw new Error("Missing quoteCurrency");
|
|
122
122
|
}
|
|
123
123
|
return {
|
|
124
124
|
type,
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
baseCurrency: first,
|
|
126
|
+
quoteCurrency: second
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
throw new Error("Invalid type");
|