@sebspark/tradeinsight 4.0.0 → 4.0.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.
- package/dist/index-v2.d.mts +116 -0
- package/dist/index-v2.d.mts.map +1 -0
- package/dist/index-v2.mjs +123 -0
- package/dist/index-v2.mjs.map +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
//#region src/instruments/types.d.ts
|
|
2
|
+
declare const types: {
|
|
3
|
+
readonly BNE: "BNE";
|
|
4
|
+
readonly BND: "BND";
|
|
5
|
+
readonly DER: "DER";
|
|
6
|
+
readonly ETF: "ETF";
|
|
7
|
+
readonly ETP: "ETP";
|
|
8
|
+
readonly FXS: "FXS";
|
|
9
|
+
readonly FND: "FND";
|
|
10
|
+
readonly IDX: "IDX";
|
|
11
|
+
readonly STO: "STO";
|
|
12
|
+
};
|
|
13
|
+
type BondExchangeId = {
|
|
14
|
+
type: (typeof types)['BNE'];
|
|
15
|
+
isin: string;
|
|
16
|
+
mic: string;
|
|
17
|
+
currency: string;
|
|
18
|
+
};
|
|
19
|
+
type BondOTCId = {
|
|
20
|
+
type: (typeof types)['BND'];
|
|
21
|
+
isin: string;
|
|
22
|
+
currency: string;
|
|
23
|
+
};
|
|
24
|
+
type DerivativeId = {
|
|
25
|
+
type: (typeof types)['DER'];
|
|
26
|
+
ticker: string;
|
|
27
|
+
mic: string;
|
|
28
|
+
currency: string;
|
|
29
|
+
strike: string;
|
|
30
|
+
expiry: string;
|
|
31
|
+
};
|
|
32
|
+
type ETFId = {
|
|
33
|
+
type: (typeof types)['ETF'];
|
|
34
|
+
isin: string;
|
|
35
|
+
mic: string;
|
|
36
|
+
currency: string;
|
|
37
|
+
};
|
|
38
|
+
type ETPId = {
|
|
39
|
+
type: (typeof types)['ETP'];
|
|
40
|
+
isin: string;
|
|
41
|
+
mic: string;
|
|
42
|
+
currency: string;
|
|
43
|
+
};
|
|
44
|
+
type ForexId = {
|
|
45
|
+
type: (typeof types)['FXS'];
|
|
46
|
+
baseCurrency: string;
|
|
47
|
+
quoteCurrency: string;
|
|
48
|
+
};
|
|
49
|
+
type FundId = {
|
|
50
|
+
type: (typeof types)['FND'];
|
|
51
|
+
isin: string;
|
|
52
|
+
currency: string;
|
|
53
|
+
};
|
|
54
|
+
type IndexId = {
|
|
55
|
+
type: (typeof types)['IDX'];
|
|
56
|
+
ticker: string;
|
|
57
|
+
currency: string;
|
|
58
|
+
};
|
|
59
|
+
type StockId = {
|
|
60
|
+
type: (typeof types)['STO'];
|
|
61
|
+
isin: string;
|
|
62
|
+
mic: string;
|
|
63
|
+
currency: string;
|
|
64
|
+
};
|
|
65
|
+
type TradeInsightId = BondExchangeId | BondOTCId | DerivativeId | ETFId | ETPId | ForexId | FundId | IndexId | StockId;
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/instruments/v2/createId.d.ts
|
|
68
|
+
declare const createBondExchangeId: ({
|
|
69
|
+
isin,
|
|
70
|
+
mic,
|
|
71
|
+
currency
|
|
72
|
+
}: Omit<BondExchangeId, "type">) => string;
|
|
73
|
+
declare const createBondOTCId: ({
|
|
74
|
+
isin,
|
|
75
|
+
currency
|
|
76
|
+
}: Omit<BondOTCId, "type">) => string;
|
|
77
|
+
declare const createDerivativeId: ({
|
|
78
|
+
ticker,
|
|
79
|
+
mic,
|
|
80
|
+
currency,
|
|
81
|
+
strike,
|
|
82
|
+
expiry
|
|
83
|
+
}: Omit<DerivativeId, "type">) => string;
|
|
84
|
+
declare const createETFId: ({
|
|
85
|
+
mic,
|
|
86
|
+
isin,
|
|
87
|
+
currency
|
|
88
|
+
}: Omit<ETFId, "type">) => string;
|
|
89
|
+
declare const createETPId: ({
|
|
90
|
+
mic,
|
|
91
|
+
isin,
|
|
92
|
+
currency
|
|
93
|
+
}: Omit<ETPId, "type">) => string;
|
|
94
|
+
declare const createFundId: ({
|
|
95
|
+
isin,
|
|
96
|
+
currency
|
|
97
|
+
}: Omit<FundId, "type">) => string;
|
|
98
|
+
declare const createIndexId: ({
|
|
99
|
+
ticker,
|
|
100
|
+
currency
|
|
101
|
+
}: IndexId) => string;
|
|
102
|
+
declare const createForexId: ({
|
|
103
|
+
quoteCurrency,
|
|
104
|
+
baseCurrency
|
|
105
|
+
}: ForexId) => string;
|
|
106
|
+
declare const createStockId: ({
|
|
107
|
+
isin,
|
|
108
|
+
mic,
|
|
109
|
+
currency
|
|
110
|
+
}: Omit<StockId, "type">) => string;
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/instruments/v2/parseId.d.ts
|
|
113
|
+
declare const parseId: (id: string) => TradeInsightId;
|
|
114
|
+
//#endregion
|
|
115
|
+
export { createBondExchangeId, createBondOTCId, createDerivativeId, createETFId, createETPId, createForexId, createFundId, createIndexId, createStockId, parseId };
|
|
116
|
+
//# sourceMappingURL=index-v2.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-v2.d.mts","names":[],"sources":["../src/instruments/types.ts","../src/instruments/v2/createId.ts","../src/instruments/v2/parseId.ts"],"sourcesContent":[],"mappings":";cAAa;EAAA,SAUH,GAAA,EAAA,KAAA;EAEE,SAAA,GAAA,EAAA,KAAc;EAOd,SAAA,GAAS,EAAA,KAAA;EAMT,SAAA,GAAA,EAAA,KAAY;EASZ,SAAK,GAAA,EAAA,KAAA;EAOL,SAAK,GAAA,EAAA,KAAA;EAOL,SAAA,GAAO,EAAA,KAAA;EAMP,SAAM,GAAA,EAAA,KAAA;EAMN,SAAA,GAAO,EAAA,KAAA;AAMnB,CAAA;AAOY,KA7DA,cAAA,GA6Dc;EACtB,IAAA,EAAA,CAAA,OA7DY,KA6DZ,CAAA,CAAA,KAAA,CAAA;EACA,IAAA,EAAA,MAAA;EACA,GAAA,EAAA,MAAA;EACA,QAAA,EAAA,MAAA;CACA;AACA,KA5DQ,SAAA,GA4DR;EACA,IAAA,EAAA,CAAA,OA5DY,KA4DZ,CAAA,CAAA,KAAA,CAAA;EACA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R,cEcA,OFJH,EAAA,CAAA,EAAA,EAAA,MAAA,EAAA,GEI2B,cFJ3B"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
//#region src/instruments/types.ts
|
|
2
|
+
const types = {
|
|
3
|
+
BNE: "BNE",
|
|
4
|
+
BND: "BND",
|
|
5
|
+
DER: "DER",
|
|
6
|
+
ETF: "ETF",
|
|
7
|
+
ETP: "ETP",
|
|
8
|
+
FXS: "FXS",
|
|
9
|
+
FND: "FND",
|
|
10
|
+
IDX: "IDX",
|
|
11
|
+
STO: "STO"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/instruments/v2/createId.ts
|
|
16
|
+
const createBondExchangeId = ({ isin, mic, currency }) => `${types.BNE}_${isin}_${mic}_${currency}`.toUpperCase();
|
|
17
|
+
const createBondOTCId = ({ isin, currency }) => `${types.BND}_${isin}_${currency}`.toUpperCase();
|
|
18
|
+
const createDerivativeId = ({ ticker, mic, currency, strike, expiry }) => `${types.DER}_${ticker}_${mic}_${currency}_${strike}_${expiry}`.toUpperCase();
|
|
19
|
+
const createETFId = ({ mic, isin, currency }) => `${types.ETF}_${isin}_${mic}_${currency}`.toUpperCase();
|
|
20
|
+
const createETPId = ({ mic, isin, currency }) => `${types.ETP}_${isin}_${mic}_${currency}`.toUpperCase();
|
|
21
|
+
const createFundId = ({ isin, currency }) => `${types.FND}_${isin}_${currency}`.toUpperCase();
|
|
22
|
+
const createIndexId = ({ ticker, currency }) => `${types.IDX}_${ticker}_${currency}`.toUpperCase();
|
|
23
|
+
const createForexId = ({ quoteCurrency, baseCurrency }) => `${types.FXS}_${baseCurrency}_${quoteCurrency}`.toUpperCase();
|
|
24
|
+
const createStockId = ({ isin, mic, currency }) => `${types.STO}_${isin}_${mic}_${currency}`.toUpperCase();
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/instruments/v2/parseId.ts
|
|
28
|
+
const parseId = (id) => {
|
|
29
|
+
const [initial, first, second, third, fourth, fifth] = id.split("_");
|
|
30
|
+
switch (initial) {
|
|
31
|
+
case "BNE":
|
|
32
|
+
if (!first) throw new Error("Missing isin");
|
|
33
|
+
if (!second) throw new Error("Missing mic");
|
|
34
|
+
if (!third) throw new Error("Missing currency");
|
|
35
|
+
return {
|
|
36
|
+
type: "BNE",
|
|
37
|
+
isin: first,
|
|
38
|
+
mic: second,
|
|
39
|
+
currency: third
|
|
40
|
+
};
|
|
41
|
+
case "BND":
|
|
42
|
+
if (!first) throw new Error("Missing isin");
|
|
43
|
+
if (!second) throw new Error("Missing currency");
|
|
44
|
+
return {
|
|
45
|
+
type: "BND",
|
|
46
|
+
isin: first,
|
|
47
|
+
currency: second
|
|
48
|
+
};
|
|
49
|
+
case "DER":
|
|
50
|
+
if (!first) throw new Error("Missing ticker");
|
|
51
|
+
if (!second) throw new Error("Missing mic");
|
|
52
|
+
if (!third) throw new Error("Missing currency");
|
|
53
|
+
if (!fourth) throw new Error("Missing strike");
|
|
54
|
+
if (!fifth) throw new Error("Missing expiry");
|
|
55
|
+
return {
|
|
56
|
+
type: "DER",
|
|
57
|
+
ticker: first,
|
|
58
|
+
mic: second,
|
|
59
|
+
currency: third,
|
|
60
|
+
strike: fourth,
|
|
61
|
+
expiry: fifth
|
|
62
|
+
};
|
|
63
|
+
case "ETF":
|
|
64
|
+
if (!first) throw new Error("Missing isin");
|
|
65
|
+
if (!second) throw new Error("Missing mic");
|
|
66
|
+
if (!third) throw new Error("Missing currency");
|
|
67
|
+
return {
|
|
68
|
+
type: "ETF",
|
|
69
|
+
isin: first,
|
|
70
|
+
mic: second,
|
|
71
|
+
currency: third
|
|
72
|
+
};
|
|
73
|
+
case "ETP":
|
|
74
|
+
if (!first) throw new Error("Missing isin");
|
|
75
|
+
if (!second) throw new Error("Missing mic");
|
|
76
|
+
if (!third) throw new Error("Missing currency");
|
|
77
|
+
return {
|
|
78
|
+
type: "ETP",
|
|
79
|
+
isin: first,
|
|
80
|
+
mic: second,
|
|
81
|
+
currency: third
|
|
82
|
+
};
|
|
83
|
+
case "FXS":
|
|
84
|
+
if (!first) throw new Error("Missing baseCurrency");
|
|
85
|
+
if (!second) throw new Error("Missing quoteCurrency");
|
|
86
|
+
return {
|
|
87
|
+
type: "FXS",
|
|
88
|
+
baseCurrency: first,
|
|
89
|
+
quoteCurrency: second
|
|
90
|
+
};
|
|
91
|
+
case "FND":
|
|
92
|
+
if (!first) throw new Error("Missing isin");
|
|
93
|
+
if (!second) throw new Error("Missing currency");
|
|
94
|
+
return {
|
|
95
|
+
type: "FND",
|
|
96
|
+
isin: first,
|
|
97
|
+
currency: second
|
|
98
|
+
};
|
|
99
|
+
case "IDX":
|
|
100
|
+
if (!first) throw new Error("Missing ticker");
|
|
101
|
+
if (!second) throw new Error("Missing currency");
|
|
102
|
+
return {
|
|
103
|
+
type: "IDX",
|
|
104
|
+
ticker: first,
|
|
105
|
+
currency: second
|
|
106
|
+
};
|
|
107
|
+
case "STO":
|
|
108
|
+
if (!first) throw new Error("Missing isin");
|
|
109
|
+
if (!second) throw new Error("Missing mic");
|
|
110
|
+
if (!third) throw new Error("Missing currency");
|
|
111
|
+
return {
|
|
112
|
+
type: "STO",
|
|
113
|
+
isin: first,
|
|
114
|
+
mic: second,
|
|
115
|
+
currency: third
|
|
116
|
+
};
|
|
117
|
+
default: throw new Error("Invalid type");
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
export { createBondExchangeId, createBondOTCId, createDerivativeId, createETFId, createETPId, createForexId, createFundId, createIndexId, createStockId, parseId };
|
|
123
|
+
//# sourceMappingURL=index-v2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-v2.mjs","names":[],"sources":["../src/instruments/types.ts","../src/instruments/v2/createId.ts","../src/instruments/v2/parseId.ts"],"sourcesContent":["export const types = {\n BNE: 'BNE',\n BND: 'BND',\n DER: 'DER',\n ETF: 'ETF',\n ETP: 'ETP',\n FXS: 'FXS',\n FND: 'FND',\n IDX: 'IDX',\n STO: 'STO',\n} as const\n\nexport type BondExchangeId = {\n type: (typeof types)['BNE']\n isin: string\n mic: string\n currency: string\n}\n\nexport type BondOTCId = {\n type: (typeof types)['BND']\n isin: string\n currency: string\n}\n\nexport type DerivativeId = {\n type: (typeof types)['DER']\n ticker: string\n mic: string\n currency: string\n strike: string\n expiry: string\n}\n\nexport type ETFId = {\n type: (typeof types)['ETF']\n isin: string\n mic: string\n currency: string\n}\n\nexport type ETPId = {\n type: (typeof types)['ETP']\n isin: string\n mic: string\n currency: string\n}\n\nexport type ForexId = {\n type: (typeof types)['FXS']\n baseCurrency: string\n quoteCurrency: string\n}\n\nexport type FundId = {\n type: (typeof types)['FND']\n isin: string\n currency: string\n}\n\nexport type IndexId = {\n type: (typeof types)['IDX']\n ticker: string\n currency: string\n}\n\nexport type StockId = {\n type: (typeof types)['STO']\n isin: string\n mic: string\n currency: string\n}\n\nexport type TradeInsightId =\n | BondExchangeId\n | BondOTCId\n | DerivativeId\n | ETFId\n | ETPId\n | ForexId\n | FundId\n | IndexId\n | StockId\n","import {\n type BondExchangeId,\n type BondOTCId,\n type DerivativeId,\n type ETFId,\n type ETPId,\n type ForexId,\n type FundId,\n type IndexId,\n type StockId,\n types,\n} from '../types'\n\nexport const createBondExchangeId = ({\n isin,\n mic,\n currency,\n}: Omit<BondExchangeId, 'type'>) =>\n `${types.BNE}_${isin}_${mic}_${currency}`.toUpperCase()\n\nexport const createBondOTCId = ({ isin, currency }: Omit<BondOTCId, 'type'>) =>\n `${types.BND}_${isin}_${currency}`.toUpperCase()\n\nexport const createDerivativeId = ({\n ticker,\n mic,\n currency,\n strike,\n expiry,\n}: Omit<DerivativeId, 'type'>) =>\n `${types.DER}_${ticker}_${mic}_${currency}_${strike}_${expiry}`.toUpperCase()\n\nexport const createETFId = ({ mic, isin, currency }: Omit<ETFId, 'type'>) =>\n `${types.ETF}_${isin}_${mic}_${currency}`.toUpperCase()\n\nexport const createETPId = ({ mic, isin, currency }: Omit<ETPId, 'type'>) =>\n `${types.ETP}_${isin}_${mic}_${currency}`.toUpperCase()\n\nexport const createFundId = ({ isin, currency }: Omit<FundId, 'type'>) =>\n `${types.FND}_${isin}_${currency}`.toUpperCase()\n\nexport const createIndexId = ({ ticker, currency }: IndexId) =>\n `${types.IDX}_${ticker}_${currency}`.toUpperCase()\n\nexport const createForexId = ({ quoteCurrency, baseCurrency }: ForexId) =>\n `${types.FXS}_${baseCurrency}_${quoteCurrency}`.toUpperCase()\n\nexport const createStockId = ({ isin, mic, currency }: Omit<StockId, 'type'>) =>\n `${types.STO}_${isin}_${mic}_${currency}`.toUpperCase()\n","import type {\n BondExchangeId,\n BondOTCId,\n DerivativeId,\n ETFId,\n ETPId,\n ForexId,\n FundId,\n IndexId,\n StockId,\n TradeInsightId,\n types,\n} from '../types'\n\nexport const parseId = (id: string): TradeInsightId => {\n const [initial, first, second, third, fourth, fifth] = id.split('_')\n const type = initial as keyof typeof types\n\n switch (type) {\n case 'BNE':\n if (!first) {\n throw new Error('Missing isin')\n }\n if (!second) {\n throw new Error('Missing mic')\n }\n if (!third) {\n throw new Error('Missing currency')\n }\n return {\n type: 'BNE',\n isin: first,\n mic: second,\n currency: third,\n } satisfies BondExchangeId as BondExchangeId\n\n case 'BND':\n if (!first) {\n throw new Error('Missing isin')\n }\n if (!second) {\n throw new Error('Missing currency')\n }\n return {\n type: 'BND',\n isin: first,\n currency: second,\n } satisfies BondOTCId as BondOTCId\n\n case 'DER': {\n if (!first) {\n throw new Error('Missing ticker')\n }\n if (!second) {\n throw new Error('Missing mic')\n }\n if (!third) {\n throw new Error('Missing currency')\n }\n if (!fourth) {\n throw new Error('Missing strike')\n }\n if (!fifth) {\n throw new Error('Missing expiry')\n }\n return {\n type: 'DER',\n ticker: first,\n mic: second,\n currency: third,\n strike: fourth,\n expiry: fifth,\n } satisfies DerivativeId as DerivativeId\n }\n\n case 'ETF': {\n if (!first) {\n throw new Error('Missing isin')\n }\n if (!second) {\n throw new Error('Missing mic')\n }\n if (!third) {\n throw new Error('Missing currency')\n }\n return {\n type: 'ETF',\n isin: first,\n mic: second,\n currency: third,\n } satisfies ETFId as ETFId\n }\n\n case 'ETP': {\n if (!first) {\n throw new Error('Missing isin')\n }\n if (!second) {\n throw new Error('Missing mic')\n }\n if (!third) {\n throw new Error('Missing currency')\n }\n return {\n type: 'ETP',\n isin: first,\n mic: second,\n currency: third,\n } satisfies ETPId as ETPId\n }\n\n case 'FXS': {\n if (!first) {\n throw new Error('Missing baseCurrency')\n }\n if (!second) {\n throw new Error('Missing quoteCurrency')\n }\n return {\n type: 'FXS',\n baseCurrency: first,\n quoteCurrency: second,\n } satisfies ForexId as ForexId\n }\n\n case 'FND': {\n if (!first) {\n throw new Error('Missing isin')\n }\n if (!second) {\n throw new Error('Missing currency')\n }\n return {\n type: 'FND',\n isin: first,\n currency: second,\n } satisfies FundId as FundId\n }\n\n case 'IDX': {\n if (!first) {\n throw new Error('Missing ticker')\n }\n if (!second) {\n throw new Error('Missing currency')\n }\n return {\n type: 'IDX',\n ticker: first,\n currency: second,\n } satisfies IndexId as IndexId\n }\n\n case 'STO': {\n if (!first) {\n throw new Error('Missing isin')\n }\n if (!second) {\n throw new Error('Missing mic')\n }\n if (!third) {\n throw new Error('Missing currency')\n }\n return {\n type: 'STO',\n isin: first,\n mic: second,\n currency: third,\n } satisfies StockId as StockId\n }\n\n default:\n throw new Error('Invalid type')\n }\n}\n"],"mappings":";AAAA,MAAa,QAAQ;CACnB,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN;;;;ACGD,MAAa,wBAAwB,EACnC,MACA,KACA,eAEA,GAAG,MAAM,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,WAAW,aAAa;AAEzD,MAAa,mBAAmB,EAAE,MAAM,eACtC,GAAG,MAAM,IAAI,GAAG,KAAK,GAAG,WA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Q;IACR,UAAU;IACX;EAGH,KAAK;AACH,OAAI,CAAC,MACH,OAAM,IAAI,MAAM,eAAe;AAEjC,OAAI,CAAC,OACH,OAAM,IAAI,MAAM,cAAc;AAEhC,OAAI,CAAC,MACH,OAAM,IAAI,MAAM,mBAAmB;AAErC,UAAO;IACL,MAAM;IACN,MAAM;IACN,KAAK;IACL,UAAU;IACX;EAGH,QACE,OAAM,IAAI,MAAM,eAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebspark/tradeinsight",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -8,13 +8,18 @@
|
|
|
8
8
|
"types": "./dist/index.d.mts",
|
|
9
9
|
"import": "./dist/index.mjs",
|
|
10
10
|
"react-native": "./dist/index.mjs"
|
|
11
|
+
},
|
|
12
|
+
"./v2": {
|
|
13
|
+
"types": "./dist/index-v2.d.mts",
|
|
14
|
+
"import": "./dist/index-v2.mjs",
|
|
15
|
+
"react-native": "./dist/index-v2.mjs"
|
|
11
16
|
}
|
|
12
17
|
},
|
|
13
18
|
"files": [
|
|
14
19
|
"dist"
|
|
15
20
|
],
|
|
16
21
|
"scripts": {
|
|
17
|
-
"build": "spark-build src/index.ts
|
|
22
|
+
"build": "spark-build src/index.ts src/index-v2.ts",
|
|
18
23
|
"depcheck": "depcheck",
|
|
19
24
|
"dev": "tsc --watch --noEmit",
|
|
20
25
|
"generate:avro": "ts-node ./scripts/avro-to-ts.ts",
|