@fintekkers/ledger-models 0.1.143 → 0.2.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/hierarchy.json +131 -0
- package/node/fintekkers/models/security/asset_class_pb.d.ts +1 -0
- package/node/fintekkers/models/security/asset_class_pb.js +2 -1
- package/node/fintekkers/models/security/instrument_type_pb.d.ts +14 -0
- package/node/fintekkers/models/security/{security_type_pb.js → instrument_type_pb.js} +7 -14
- package/node/fintekkers/models/security/product_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/product_type_pb.d.ts +37 -0
- package/node/fintekkers/models/security/product_type_pb.js +58 -0
- package/node/fintekkers/models/security/security_id_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/security_id_pb.d.ts +31 -0
- package/node/fintekkers/models/security/security_id_pb.js +199 -0
- package/node/fintekkers/models/security/security_pb.d.ts +14 -4
- package/node/fintekkers/models/security/security_pb.js +100 -13
- package/node/fintekkers/models/security/security_pb.test.js +2 -2
- package/node/fintekkers/models/security/security_pb.test.js.map +1 -1
- package/node/fintekkers/models/security/security_pb.test.ts +2 -2
- package/node/wrappers/models/position/position_filter_operator.js +1 -1
- package/node/wrappers/models/position/position_filter_operator.js.map +1 -1
- package/node/wrappers/models/position/position_filter_operator.ts +1 -1
- package/node/wrappers/models/price/Price.cash.test.js +2 -2
- package/node/wrappers/models/price/Price.cash.test.js.map +1 -1
- package/node/wrappers/models/price/Price.cash.test.ts +2 -2
- package/node/wrappers/models/security/BondSecurity.js +11 -3
- package/node/wrappers/models/security/BondSecurity.js.map +1 -1
- package/node/wrappers/models/security/BondSecurity.priceScale.test.js +2 -2
- package/node/wrappers/models/security/BondSecurity.priceScale.test.js.map +1 -1
- package/node/wrappers/models/security/BondSecurity.priceScale.test.ts +2 -2
- package/node/wrappers/models/security/BondSecurity.test.js +5 -5
- package/node/wrappers/models/security/BondSecurity.test.js.map +1 -1
- package/node/wrappers/models/security/BondSecurity.test.ts +5 -5
- package/node/wrappers/models/security/BondSecurity.ts +11 -3
- package/node/wrappers/models/security/asset_class.test.js +2 -0
- package/node/wrappers/models/security/asset_class.test.js.map +1 -1
- package/node/wrappers/models/security/asset_class.test.ts +2 -0
- package/node/wrappers/models/security/product_hierarchy.d.ts +42 -0
- package/node/wrappers/models/security/product_hierarchy.js +157 -0
- package/node/wrappers/models/security/product_hierarchy.js.map +1 -0
- package/node/wrappers/models/security/product_hierarchy.ts +159 -0
- package/node/wrappers/models/security/security-roundtrip.test.js +13 -13
- package/node/wrappers/models/security/security-roundtrip.test.js.map +1 -1
- package/node/wrappers/models/security/security-roundtrip.test.ts +13 -13
- package/node/wrappers/models/security/security.js +11 -11
- package/node/wrappers/models/security/security.js.map +1 -1
- package/node/wrappers/models/security/security.test.js +3 -3
- package/node/wrappers/models/security/security.test.js.map +1 -1
- package/node/wrappers/models/security/security.test.ts +3 -3
- package/node/wrappers/models/security/security.ts +12 -12
- package/node/wrappers/models/transaction/transaction.derived.test.js +5 -5
- package/node/wrappers/models/transaction/transaction.derived.test.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.derived.test.ts +5 -5
- package/node/wrappers/models/transaction/transaction.js +14 -14
- package/node/wrappers/models/transaction/transaction.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.ts +14 -14
- package/node/wrappers/services/security-service/security.test.js +2 -2
- package/node/wrappers/services/security-service/security.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.test.ts +2 -2
- package/package.json +1 -1
- package/tsconfig.json +2 -1
- package/node/fintekkers/models/security/security_type_pb.d.ts +0 -21
- package/node/wrappers/models/security/security_type.d.ts +0 -31
- package/node/wrappers/models/security/security_type.js +0 -45
- package/node/wrappers/models/security/security_type.js.map +0 -1
- package/node/wrappers/models/security/security_type.test.d.ts +0 -1
- package/node/wrappers/models/security/security_type.test.js +0 -68
- package/node/wrappers/models/security/security_type.test.js.map +0 -1
- package/node/wrappers/models/security/security_type.test.ts +0 -74
- package/node/wrappers/models/security/security_type.ts +0 -47
- /package/node/fintekkers/models/security/{security_type_grpc_pb.js → instrument_type_grpc_pb.js} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-language registry helper backed by ledger-models-protos/hierarchy.json.
|
|
3
|
+
*
|
|
4
|
+
* Identical signatures across Java / Rust / Python / JS-TS so consumers can
|
|
5
|
+
* rely on the same query shape regardless of language. M1 of #257.
|
|
6
|
+
*
|
|
7
|
+
* Two trees are exposed:
|
|
8
|
+
* - product_type — what kind of contract is this. Walked via parentOf,
|
|
9
|
+
* descendantsOf, isDescendantOf.
|
|
10
|
+
* - asset_class — what exposure family does it belong to. Same shape via
|
|
11
|
+
* assetClassParentOf, etc.
|
|
12
|
+
*
|
|
13
|
+
* Plus per-leaf classification lookups: assetClassOf, instrumentTypeOf,
|
|
14
|
+
* labelOf.
|
|
15
|
+
*
|
|
16
|
+
* `indexTypeOf` is intentionally absent — that dimension is deferred per
|
|
17
|
+
* the M1 descope.
|
|
18
|
+
*/
|
|
19
|
+
/** Parent product_type node (abstract or leaf). null for top-level nodes;
|
|
20
|
+
* null for unknown nodes. */
|
|
21
|
+
export declare function parentOf(node: string): string | null;
|
|
22
|
+
/** All descendant nodes (transitive) of `ancestor` in the product_type tree.
|
|
23
|
+
* Includes leaves and abstract intermediates beneath `ancestor` but NOT
|
|
24
|
+
* `ancestor` itself. Returns sorted array (empty if `ancestor` is unknown). */
|
|
25
|
+
export declare function descendantsOf(ancestor: string): string[];
|
|
26
|
+
/** True iff `node` is a strict descendant of `ancestor` (any depth) in the
|
|
27
|
+
* product_type tree. False if either is unknown or they are the same. */
|
|
28
|
+
export declare function isDescendantOf(node: string, ancestor: string): boolean;
|
|
29
|
+
/** Display label, or null if the node is unknown. */
|
|
30
|
+
export declare function labelOf(node: string): string | null;
|
|
31
|
+
/** Asset class for a leaf product_type. null for abstract or unknown. */
|
|
32
|
+
export declare function assetClassOf(productType: string): string | null;
|
|
33
|
+
/** instrument_type for a leaf product_type. null for abstract or unknown. */
|
|
34
|
+
export declare function instrumentTypeOf(productType: string): string | null;
|
|
35
|
+
export declare function assetClassParentOf(node: string): string | null;
|
|
36
|
+
export declare function assetClassDescendantsOf(ancestor: string): string[];
|
|
37
|
+
export declare function isAssetClassDescendantOf(node: string, ancestor: string): boolean;
|
|
38
|
+
export declare function assetClassLabelOf(node: string): string | null;
|
|
39
|
+
export declare function allProductTypes(): string[];
|
|
40
|
+
export declare function activeProductTypes(): string[];
|
|
41
|
+
export declare function allAssetClasses(): string[];
|
|
42
|
+
export declare function allInstrumentTypes(): string[];
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Multi-language registry helper backed by ledger-models-protos/hierarchy.json.
|
|
4
|
+
*
|
|
5
|
+
* Identical signatures across Java / Rust / Python / JS-TS so consumers can
|
|
6
|
+
* rely on the same query shape regardless of language. M1 of #257.
|
|
7
|
+
*
|
|
8
|
+
* Two trees are exposed:
|
|
9
|
+
* - product_type — what kind of contract is this. Walked via parentOf,
|
|
10
|
+
* descendantsOf, isDescendantOf.
|
|
11
|
+
* - asset_class — what exposure family does it belong to. Same shape via
|
|
12
|
+
* assetClassParentOf, etc.
|
|
13
|
+
*
|
|
14
|
+
* Plus per-leaf classification lookups: assetClassOf, instrumentTypeOf,
|
|
15
|
+
* labelOf.
|
|
16
|
+
*
|
|
17
|
+
* `indexTypeOf` is intentionally absent — that dimension is deferred per
|
|
18
|
+
* the M1 descope.
|
|
19
|
+
*/
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.allInstrumentTypes = exports.allAssetClasses = exports.activeProductTypes = exports.allProductTypes = exports.assetClassLabelOf = exports.isAssetClassDescendantOf = exports.assetClassDescendantsOf = exports.assetClassParentOf = exports.instrumentTypeOf = exports.assetClassOf = exports.labelOf = exports.isDescendantOf = exports.descendantsOf = exports.parentOf = void 0;
|
|
25
|
+
// hierarchy.json is bundled into the npm package via the package's `files`
|
|
26
|
+
// list (see package.json). Bundlers handle this `import` at build time
|
|
27
|
+
// (TypeScript's resolveJsonModule is enabled).
|
|
28
|
+
const hierarchy_json_1 = __importDefault(require("../../../../hierarchy.json"));
|
|
29
|
+
const registry = hierarchy_json_1.default;
|
|
30
|
+
// ---------- product_type tree ----------
|
|
31
|
+
/** Parent product_type node (abstract or leaf). null for top-level nodes;
|
|
32
|
+
* null for unknown nodes. */
|
|
33
|
+
function parentOf(node) {
|
|
34
|
+
var _a;
|
|
35
|
+
const entry = registry.product_types[node];
|
|
36
|
+
return (_a = entry === null || entry === void 0 ? void 0 : entry.parent) !== null && _a !== void 0 ? _a : null;
|
|
37
|
+
}
|
|
38
|
+
exports.parentOf = parentOf;
|
|
39
|
+
/** All descendant nodes (transitive) of `ancestor` in the product_type tree.
|
|
40
|
+
* Includes leaves and abstract intermediates beneath `ancestor` but NOT
|
|
41
|
+
* `ancestor` itself. Returns sorted array (empty if `ancestor` is unknown). */
|
|
42
|
+
function descendantsOf(ancestor) {
|
|
43
|
+
var _a, _b, _c;
|
|
44
|
+
const out = [];
|
|
45
|
+
for (const [name, entry] of Object.entries(registry.product_types)) {
|
|
46
|
+
let p = (_a = entry.parent) !== null && _a !== void 0 ? _a : null;
|
|
47
|
+
while (p) {
|
|
48
|
+
if (p === ancestor) {
|
|
49
|
+
out.push(name);
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
p = (_c = (_b = registry.product_types[p]) === null || _b === void 0 ? void 0 : _b.parent) !== null && _c !== void 0 ? _c : null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return out.sort();
|
|
56
|
+
}
|
|
57
|
+
exports.descendantsOf = descendantsOf;
|
|
58
|
+
/** True iff `node` is a strict descendant of `ancestor` (any depth) in the
|
|
59
|
+
* product_type tree. False if either is unknown or they are the same. */
|
|
60
|
+
function isDescendantOf(node, ancestor) {
|
|
61
|
+
var _a, _b, _c;
|
|
62
|
+
if (node === ancestor)
|
|
63
|
+
return false;
|
|
64
|
+
const entry = registry.product_types[node];
|
|
65
|
+
if (!entry)
|
|
66
|
+
return false;
|
|
67
|
+
let p = (_a = entry.parent) !== null && _a !== void 0 ? _a : null;
|
|
68
|
+
while (p) {
|
|
69
|
+
if (p === ancestor)
|
|
70
|
+
return true;
|
|
71
|
+
p = (_c = (_b = registry.product_types[p]) === null || _b === void 0 ? void 0 : _b.parent) !== null && _c !== void 0 ? _c : null;
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
exports.isDescendantOf = isDescendantOf;
|
|
76
|
+
/** Display label, or null if the node is unknown. */
|
|
77
|
+
function labelOf(node) {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
return (_b = (_a = registry.product_types[node]) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : null;
|
|
80
|
+
}
|
|
81
|
+
exports.labelOf = labelOf;
|
|
82
|
+
/** Asset class for a leaf product_type. null for abstract or unknown. */
|
|
83
|
+
function assetClassOf(productType) {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
return (_b = (_a = registry.product_types[productType]) === null || _a === void 0 ? void 0 : _a.asset_class) !== null && _b !== void 0 ? _b : null;
|
|
86
|
+
}
|
|
87
|
+
exports.assetClassOf = assetClassOf;
|
|
88
|
+
/** instrument_type for a leaf product_type. null for abstract or unknown. */
|
|
89
|
+
function instrumentTypeOf(productType) {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
return (_b = (_a = registry.product_types[productType]) === null || _a === void 0 ? void 0 : _a.instrument_type) !== null && _b !== void 0 ? _b : null;
|
|
92
|
+
}
|
|
93
|
+
exports.instrumentTypeOf = instrumentTypeOf;
|
|
94
|
+
// ---------- asset_class tree ----------
|
|
95
|
+
function assetClassParentOf(node) {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
return (_b = (_a = registry.asset_classes[node]) === null || _a === void 0 ? void 0 : _a.parent) !== null && _b !== void 0 ? _b : null;
|
|
98
|
+
}
|
|
99
|
+
exports.assetClassParentOf = assetClassParentOf;
|
|
100
|
+
function assetClassDescendantsOf(ancestor) {
|
|
101
|
+
var _a, _b, _c;
|
|
102
|
+
const out = [];
|
|
103
|
+
for (const [name, entry] of Object.entries(registry.asset_classes)) {
|
|
104
|
+
let p = (_a = entry.parent) !== null && _a !== void 0 ? _a : null;
|
|
105
|
+
while (p) {
|
|
106
|
+
if (p === ancestor) {
|
|
107
|
+
out.push(name);
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
p = (_c = (_b = registry.asset_classes[p]) === null || _b === void 0 ? void 0 : _b.parent) !== null && _c !== void 0 ? _c : null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return out.sort();
|
|
114
|
+
}
|
|
115
|
+
exports.assetClassDescendantsOf = assetClassDescendantsOf;
|
|
116
|
+
function isAssetClassDescendantOf(node, ancestor) {
|
|
117
|
+
var _a, _b, _c;
|
|
118
|
+
if (node === ancestor)
|
|
119
|
+
return false;
|
|
120
|
+
const entry = registry.asset_classes[node];
|
|
121
|
+
if (!entry)
|
|
122
|
+
return false;
|
|
123
|
+
let p = (_a = entry.parent) !== null && _a !== void 0 ? _a : null;
|
|
124
|
+
while (p) {
|
|
125
|
+
if (p === ancestor)
|
|
126
|
+
return true;
|
|
127
|
+
p = (_c = (_b = registry.asset_classes[p]) === null || _b === void 0 ? void 0 : _b.parent) !== null && _c !== void 0 ? _c : null;
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
exports.isAssetClassDescendantOf = isAssetClassDescendantOf;
|
|
132
|
+
function assetClassLabelOf(node) {
|
|
133
|
+
var _a, _b;
|
|
134
|
+
return (_b = (_a = registry.asset_classes[node]) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : null;
|
|
135
|
+
}
|
|
136
|
+
exports.assetClassLabelOf = assetClassLabelOf;
|
|
137
|
+
// ---------- introspection ----------
|
|
138
|
+
function allProductTypes() {
|
|
139
|
+
return Object.keys(registry.product_types).sort();
|
|
140
|
+
}
|
|
141
|
+
exports.allProductTypes = allProductTypes;
|
|
142
|
+
function activeProductTypes() {
|
|
143
|
+
return Object.entries(registry.product_types)
|
|
144
|
+
.filter(([, e]) => e.status === 'active')
|
|
145
|
+
.map(([k]) => k)
|
|
146
|
+
.sort();
|
|
147
|
+
}
|
|
148
|
+
exports.activeProductTypes = activeProductTypes;
|
|
149
|
+
function allAssetClasses() {
|
|
150
|
+
return Object.keys(registry.asset_classes).sort();
|
|
151
|
+
}
|
|
152
|
+
exports.allAssetClasses = allAssetClasses;
|
|
153
|
+
function allInstrumentTypes() {
|
|
154
|
+
return [...registry.instrument_types];
|
|
155
|
+
}
|
|
156
|
+
exports.allInstrumentTypes = allInstrumentTypes;
|
|
157
|
+
//# sourceMappingURL=product_hierarchy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product_hierarchy.js","sourceRoot":"","sources":["product_hierarchy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;AAEH,2EAA2E;AAC3E,uEAAuE;AACvE,+CAA+C;AAC/C,gFAAmD;AAsBnD,MAAM,QAAQ,GAAa,wBAAqB,CAAC;AAEjD,0CAA0C;AAE1C;6BAC6B;AAC7B,SAAgB,QAAQ,CAAC,IAAY;;IACnC,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,mCAAI,IAAI,CAAC;AAC/B,CAAC;AAHD,4BAGC;AAED;;+EAE+E;AAC/E,SAAgB,aAAa,CAAC,QAAgB;;IAC5C,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,CAAC,IAAI,EAAE,K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Python / JS-TS so consumers can
|
|
5
|
+
* rely on the same query shape regardless of language. M1 of #257.
|
|
6
|
+
*
|
|
7
|
+
* Two trees are exposed:
|
|
8
|
+
* - product_type — what kind of contract is this. Walked via parentOf,
|
|
9
|
+
* descendantsOf, isDescendantOf.
|
|
10
|
+
* - asset_class — what exposure family does it belong to. Same shape via
|
|
11
|
+
* assetClassParentOf, etc.
|
|
12
|
+
*
|
|
13
|
+
* Plus per-leaf classification lookups: assetClassOf, instrumentTypeOf,
|
|
14
|
+
* labelOf.
|
|
15
|
+
*
|
|
16
|
+
* `indexTypeOf` is intentionally absent — that dimension is deferred per
|
|
17
|
+
* the M1 descope.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// hierarchy.json is bundled into the npm package via the package's `files`
|
|
21
|
+
// list (see package.json). Bundlers handle this `import` at build time
|
|
22
|
+
// (TypeScript's resolveJsonModule is enabled).
|
|
23
|
+
import hierarchy from '../../../../hierarchy.json';
|
|
24
|
+
|
|
25
|
+
interface ProductTypeEntry {
|
|
26
|
+
parent?: string | null;
|
|
27
|
+
abstract?: boolean;
|
|
28
|
+
asset_class?: string;
|
|
29
|
+
instrument_type?: string;
|
|
30
|
+
label?: string;
|
|
31
|
+
status?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface AssetClassEntry {
|
|
35
|
+
parent?: string | null;
|
|
36
|
+
label?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface Registry {
|
|
40
|
+
product_types: Record<string, ProductTypeEntry>;
|
|
41
|
+
asset_classes: Record<string, AssetClassEntry>;
|
|
42
|
+
instrument_types: string[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const registry: Registry = hierarchy as Registry;
|
|
46
|
+
|
|
47
|
+
// ---------- product_type tree ----------
|
|
48
|
+
|
|
49
|
+
/** Parent product_type node (abstract or leaf). null for top-level nodes;
|
|
50
|
+
* null for unknown nodes. */
|
|
51
|
+
export function parentOf(node: string): string | null {
|
|
52
|
+
const entry = registry.product_types[node];
|
|
53
|
+
return entry?.parent ?? null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** All descendant nodes (transitive) of `ancestor` in the product_type tree.
|
|
57
|
+
* Includes leaves and abstract intermediates beneath `ancestor` but NOT
|
|
58
|
+
* `ancestor` itself. Returns sorted array (empty if `ancestor` is unknown). */
|
|
59
|
+
export function descendantsOf(ancestor: string): string[] {
|
|
60
|
+
const out: string[] = [];
|
|
61
|
+
for (const [name, entry] of Object.entries(registry.product_types)) {
|
|
62
|
+
let p = entry.parent ?? null;
|
|
63
|
+
while (p) {
|
|
64
|
+
if (p === ancestor) {
|
|
65
|
+
out.push(name);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
p = registry.product_types[p]?.parent ?? null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return out.sort();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** True iff `node` is a strict descendant of `ancestor` (any depth) in the
|
|
75
|
+
* product_type tree. False if either is unknown or they are the same. */
|
|
76
|
+
export function isDescendantOf(node: string, ancestor: string): boolean {
|
|
77
|
+
if (node === ancestor) return false;
|
|
78
|
+
const entry = registry.product_types[node];
|
|
79
|
+
if (!entry) return false;
|
|
80
|
+
let p = entry.parent ?? null;
|
|
81
|
+
while (p) {
|
|
82
|
+
if (p === ancestor) return true;
|
|
83
|
+
p = registry.product_types[p]?.parent ?? null;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Display label, or null if the node is unknown. */
|
|
89
|
+
export function labelOf(node: string): string | null {
|
|
90
|
+
return registry.product_types[node]?.label ?? null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Asset class for a leaf product_type. null for abstract or unknown. */
|
|
94
|
+
export function assetClassOf(productType: string): string | null {
|
|
95
|
+
return registry.product_types[productType]?.asset_class ?? null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** instrument_type for a leaf product_type. null for abstract or unknown. */
|
|
99
|
+
export function instrumentTypeOf(productType: string): string | null {
|
|
100
|
+
return registry.product_types[productType]?.instrument_type ?? null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ---------- asset_class tree ----------
|
|
104
|
+
|
|
105
|
+
export function assetClassParentOf(node: string): string | null {
|
|
106
|
+
return registry.asset_classes[node]?.parent ?? null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function assetClassDescendantsOf(ancestor: string): string[] {
|
|
110
|
+
const out: string[] = [];
|
|
111
|
+
for (const [name, entry] of Object.entries(registry.asset_classes)) {
|
|
112
|
+
let p = entry.parent ?? null;
|
|
113
|
+
while (p) {
|
|
114
|
+
if (p === ancestor) {
|
|
115
|
+
out.push(name);
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
p = registry.asset_classes[p]?.parent ?? null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return out.sort();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function isAssetClassDescendantOf(node: string, ancestor: string): boolean {
|
|
125
|
+
if (node === ancestor) return false;
|
|
126
|
+
const entry = registry.asset_classes[node];
|
|
127
|
+
if (!entry) return false;
|
|
128
|
+
let p = entry.parent ?? null;
|
|
129
|
+
while (p) {
|
|
130
|
+
if (p === ancestor) return true;
|
|
131
|
+
p = registry.asset_classes[p]?.parent ?? null;
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function assetClassLabelOf(node: string): string | null {
|
|
137
|
+
return registry.asset_classes[node]?.label ?? null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ---------- introspection ----------
|
|
141
|
+
|
|
142
|
+
export function allProductTypes(): string[] {
|
|
143
|
+
return Object.keys(registry.product_types).sort();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function activeProductTypes(): string[] {
|
|
147
|
+
return Object.entries(registry.product_types)
|
|
148
|
+
.filter(([, e]) => e.status === 'active')
|
|
149
|
+
.map(([k]) => k)
|
|
150
|
+
.sort();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function allAssetClasses(): string[] {
|
|
154
|
+
return Object.keys(registry.asset_classes).sort();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function allInstrumentTypes(): string[] {
|
|
158
|
+
return [...registry.instrument_types];
|
|
159
|
+
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
* For each type: construct → serialize to bytes → deserialize → verify all fields match.
|
|
7
7
|
*/
|
|
8
8
|
const security_pb_1 = require("../../../fintekkers/models/security/security_pb");
|
|
9
|
-
const
|
|
9
|
+
const product_type_pb_1 = require("../../../fintekkers/models/security/product_type_pb");
|
|
10
10
|
const coupon_frequency_pb_1 = require("../../../fintekkers/models/security/coupon_frequency_pb");
|
|
11
11
|
const coupon_type_pb_1 = require("../../../fintekkers/models/security/coupon_type_pb");
|
|
12
12
|
const security_quantity_type_pb_1 = require("../../../fintekkers/models/security/security_quantity_type_pb");
|
|
@@ -29,7 +29,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
29
29
|
const original = new security_pb_1.SecurityProto();
|
|
30
30
|
original.setObjectClass('Security');
|
|
31
31
|
original.setVersion('0.0.1');
|
|
32
|
-
original.
|
|
32
|
+
original.setProductType(product_type_pb_1.ProductTypeProto.TREASURY_NOTE);
|
|
33
33
|
original.setAssetClass('Fixed Income');
|
|
34
34
|
original.setIssuerName('US Treasury');
|
|
35
35
|
original.setQuantityType(security_quantity_type_pb_1.SecurityQuantityTypeProto.ORIGINAL_FACE_VALUE);
|
|
@@ -44,7 +44,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
44
44
|
original.setMaturityDate(makeDate(2030, 1, 15));
|
|
45
45
|
const bytes = original.serializeBinary();
|
|
46
46
|
const parsed = security_pb_1.SecurityProto.deserializeBinary(bytes);
|
|
47
|
-
expect(parsed.
|
|
47
|
+
expect(parsed.getProductType()).toBe(product_type_pb_1.ProductTypeProto.TREASURY_NOTE);
|
|
48
48
|
expect(parsed.getAssetClass()).toBe('Fixed Income');
|
|
49
49
|
expect(parsed.getIssuerName()).toBe('US Treasury');
|
|
50
50
|
expect(parsed.getDescription()).toBe('UST 5% 2030');
|
|
@@ -65,7 +65,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
65
65
|
const original = new security_pb_1.SecurityProto();
|
|
66
66
|
original.setObjectClass('Security');
|
|
67
67
|
original.setVersion('0.0.1');
|
|
68
|
-
original.
|
|
68
|
+
original.setProductType(product_type_pb_1.ProductTypeProto.TIPS);
|
|
69
69
|
original.setAssetClass('Fixed Income');
|
|
70
70
|
original.setIssuerName('US Treasury');
|
|
71
71
|
original.setCouponRate(makeDecimal('0.625'));
|
|
@@ -77,7 +77,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
77
77
|
original.setInflationIndexType(index_type_pb_1.IndexTypeProto.CPI_U);
|
|
78
78
|
const bytes = original.serializeBinary();
|
|
79
79
|
const parsed = security_pb_1.SecurityProto.deserializeBinary(bytes);
|
|
80
|
-
expect(parsed.
|
|
80
|
+
expect(parsed.getProductType()).toBe(product_type_pb_1.ProductTypeProto.TIPS);
|
|
81
81
|
expect(parsed.getCouponRate().getArbitraryPrecisionValue()).toBe('0.625');
|
|
82
82
|
expect(parsed.getCouponType()).toBe(coupon_type_pb_1.CouponTypeProto.FIXED);
|
|
83
83
|
expect(parsed.getCouponFrequency()).toBe(coupon_frequency_pb_1.CouponFrequencyProto.SEMIANNUALLY);
|
|
@@ -90,7 +90,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
90
90
|
const original = new security_pb_1.SecurityProto();
|
|
91
91
|
original.setObjectClass('Security');
|
|
92
92
|
original.setVersion('0.0.1');
|
|
93
|
-
original.
|
|
93
|
+
original.setProductType(product_type_pb_1.ProductTypeProto.TREASURY_FRN);
|
|
94
94
|
original.setAssetClass('Fixed Income');
|
|
95
95
|
original.setIssuerName('US Treasury');
|
|
96
96
|
original.setCouponType(coupon_type_pb_1.CouponTypeProto.FLOAT);
|
|
@@ -102,7 +102,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
102
102
|
// Note: setResetFrequency (field 92) not yet in generated JS — codegen needs update
|
|
103
103
|
const bytes = original.serializeBinary();
|
|
104
104
|
const parsed = security_pb_1.SecurityProto.deserializeBinary(bytes);
|
|
105
|
-
expect(parsed.
|
|
105
|
+
expect(parsed.getProductType()).toBe(product_type_pb_1.ProductTypeProto.TREASURY_FRN);
|
|
106
106
|
expect(parsed.getCouponType()).toBe(coupon_type_pb_1.CouponTypeProto.FLOAT);
|
|
107
107
|
expect(parsed.getCouponFrequency()).toBe(coupon_frequency_pb_1.CouponFrequencyProto.QUARTERLY);
|
|
108
108
|
expect(parsed.getFaceValue().getArbitraryPrecisionValue()).toBe('100');
|
|
@@ -114,7 +114,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
114
114
|
const original = new security_pb_1.SecurityProto();
|
|
115
115
|
original.setObjectClass('Security');
|
|
116
116
|
original.setVersion('0.0.1');
|
|
117
|
-
original.
|
|
117
|
+
original.setProductType(product_type_pb_1.ProductTypeProto.COMMON_STOCK);
|
|
118
118
|
original.setAssetClass('Equity');
|
|
119
119
|
original.setIssuerName('Apple Inc.');
|
|
120
120
|
original.setQuantityType(security_quantity_type_pb_1.SecurityQuantityTypeProto.UNITS);
|
|
@@ -122,7 +122,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
122
122
|
original.setDescription('Apple Inc. Common Stock');
|
|
123
123
|
const bytes = original.serializeBinary();
|
|
124
124
|
const parsed = security_pb_1.SecurityProto.deserializeBinary(bytes);
|
|
125
|
-
expect(parsed.
|
|
125
|
+
expect(parsed.getProductType()).toBe(product_type_pb_1.ProductTypeProto.COMMON_STOCK);
|
|
126
126
|
expect(parsed.getAssetClass()).toBe('Equity');
|
|
127
127
|
expect(parsed.getIssuerName()).toBe('Apple Inc.');
|
|
128
128
|
expect(parsed.getQuantityType()).toBe(security_quantity_type_pb_1.SecurityQuantityTypeProto.UNITS);
|
|
@@ -134,7 +134,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
134
134
|
const original = new security_pb_1.SecurityProto();
|
|
135
135
|
original.setObjectClass('Security');
|
|
136
136
|
original.setVersion('0.0.1');
|
|
137
|
-
original.
|
|
137
|
+
original.setProductType(product_type_pb_1.ProductTypeProto.CURRENCY);
|
|
138
138
|
original.setAssetClass('Cash');
|
|
139
139
|
original.setIssuerName('Federal Reserve');
|
|
140
140
|
original.setQuantityType(security_quantity_type_pb_1.SecurityQuantityTypeProto.UNITS);
|
|
@@ -143,7 +143,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
143
143
|
original.setIdentifier(makeIdentifier(identifier_type_pb_1.IdentifierTypeProto.CASH, 'USD'));
|
|
144
144
|
const bytes = original.serializeBinary();
|
|
145
145
|
const parsed = security_pb_1.SecurityProto.deserializeBinary(bytes);
|
|
146
|
-
expect(parsed.
|
|
146
|
+
expect(parsed.getProductType()).toBe(product_type_pb_1.ProductTypeProto.CURRENCY);
|
|
147
147
|
expect(parsed.getAssetClass()).toBe('Cash');
|
|
148
148
|
expect(parsed.getCashId()).toBe('USD');
|
|
149
149
|
expect(parsed.getDescription()).toBe('US Dollar');
|
|
@@ -154,7 +154,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
154
154
|
const original = new security_pb_1.SecurityProto();
|
|
155
155
|
original.setObjectClass('Security');
|
|
156
156
|
original.setVersion('0.0.1');
|
|
157
|
-
original.
|
|
157
|
+
original.setProductType(product_type_pb_1.ProductTypeProto.EQUITY_INDEX);
|
|
158
158
|
original.setAssetClass('Index');
|
|
159
159
|
original.setIssuerName('Bureau of Labor Statistics');
|
|
160
160
|
original.setDescription('US CPI-U All Urban Consumers');
|
|
@@ -162,7 +162,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
162
162
|
original.setIdentifier(makeIdentifier(identifier_type_pb_1.IdentifierTypeProto.CUSIP, 'CPI-U'));
|
|
163
163
|
const bytes = original.serializeBinary();
|
|
164
164
|
const parsed = security_pb_1.SecurityProto.deserializeBinary(bytes);
|
|
165
|
-
expect(parsed.
|
|
165
|
+
expect(parsed.getProductType()).toBe(product_type_pb_1.ProductTypeProto.EQUITY_INDEX);
|
|
166
166
|
expect(parsed.getAssetClass()).toBe('Index');
|
|
167
167
|
expect(parsed.getIssuerName()).toBe('Bureau of Labor Statistics');
|
|
168
168
|
expect(parsed.getDescription()).toBe('US CPI-U All Urban Consumers');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-roundtrip.test.js","sourceRoot":"","sources":["security-roundtrip.test.ts"],"names":[],"mappings":";;AAAA;;;;GAIG;AACH,iFAAgF;AAChF,
|
|
1
|
+
{"version":3,"file":"security-roundtrip.test.js","sourceRoot":"","sources":["security-roundtrip.test.ts"],"names":[],"mappings":";;AAAA;;;;GAIG;AACH,iFAAgF;AAChF,yFAAuF;AACvF,iGAA+F;AAC/F,uFAAqF;AACrF,6GAA0G;AAC1G,gGAA+F;AAC/F,0GAAwG;AACxG,2FAAyF;AACzF,uFAAqF;AACrF,iFAA+E;AAE/E,SAAS,WAAW,CAAC,KAAa;IAC9B,OAAO,IAAI,oCAAiB,EAAE,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,KAAa,EAAE,GAAW;IACtD,OAAO,IAAI,8BAAc,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC1E,CA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AAO,CAAC,CAAC,CAAC;QAE3E,MAAM,KAAK,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,2BAAa,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAEtD,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,kCAAgB,CAAC,YAAY,CAAC,CAAC;QACpE,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAClE,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QACrE,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,8BAAc,CAAC,KAAK,CAAC,CAAC;QACzD,MAAM,CAAC,MAAM,CAAC,aAAa,EAAG,CAAC,kBAAkB,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* For each type: construct → serialize to bytes → deserialize → verify all fields match.
|
|
5
5
|
*/
|
|
6
6
|
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
7
|
-
import {
|
|
7
|
+
import { ProductTypeProto } from "../../../fintekkers/models/security/product_type_pb";
|
|
8
8
|
import { CouponFrequencyProto } from '../../../fintekkers/models/security/coupon_frequency_pb';
|
|
9
9
|
import { CouponTypeProto } from '../../../fintekkers/models/security/coupon_type_pb';
|
|
10
10
|
import { SecurityQuantityTypeProto } from '../../../fintekkers/models/security/security_quantity_type_pb';
|
|
@@ -32,7 +32,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
32
32
|
const original = new SecurityProto();
|
|
33
33
|
original.setObjectClass('Security');
|
|
34
34
|
original.setVersion('0.0.1');
|
|
35
|
-
original.
|
|
35
|
+
original.setProductType(ProductTypeProto.TREASURY_NOTE);
|
|
36
36
|
original.setAssetClass('Fixed Income');
|
|
37
37
|
original.setIssuerName('US Treasury');
|
|
38
38
|
original.setQuantityType(SecurityQuantityTypeProto.ORIGINAL_FACE_VALUE);
|
|
@@ -49,7 +49,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
49
49
|
const bytes = original.serializeBinary();
|
|
50
50
|
const parsed = SecurityProto.deserializeBinary(bytes);
|
|
51
51
|
|
|
52
|
-
expect(parsed.
|
|
52
|
+
expect(parsed.getProductType()).toBe(ProductTypeProto.TREASURY_NOTE);
|
|
53
53
|
expect(parsed.getAssetClass()).toBe('Fixed Income');
|
|
54
54
|
expect(parsed.getIssuerName()).toBe('US Treasury');
|
|
55
55
|
expect(parsed.getDescription()).toBe('UST 5% 2030');
|
|
@@ -71,7 +71,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
71
71
|
const original = new SecurityProto();
|
|
72
72
|
original.setObjectClass('Security');
|
|
73
73
|
original.setVersion('0.0.1');
|
|
74
|
-
original.
|
|
74
|
+
original.setProductType(ProductTypeProto.TIPS);
|
|
75
75
|
original.setAssetClass('Fixed Income');
|
|
76
76
|
original.setIssuerName('US Treasury');
|
|
77
77
|
original.setCouponRate(makeDecimal('0.625'));
|
|
@@ -85,7 +85,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
85
85
|
const bytes = original.serializeBinary();
|
|
86
86
|
const parsed = SecurityProto.deserializeBinary(bytes);
|
|
87
87
|
|
|
88
|
-
expect(parsed.
|
|
88
|
+
expect(parsed.getProductType()).toBe(ProductTypeProto.TIPS);
|
|
89
89
|
expect(parsed.getCouponRate()!.getArbitraryPrecisionValue()).toBe('0.625');
|
|
90
90
|
expect(parsed.getCouponType()).toBe(CouponTypeProto.FIXED);
|
|
91
91
|
expect(parsed.getCouponFrequency()).toBe(CouponFrequencyProto.SEMIANNUALLY);
|
|
@@ -99,7 +99,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
99
99
|
const original = new SecurityProto();
|
|
100
100
|
original.setObjectClass('Security');
|
|
101
101
|
original.setVersion('0.0.1');
|
|
102
|
-
original.
|
|
102
|
+
original.setProductType(ProductTypeProto.TREASURY_FRN);
|
|
103
103
|
original.setAssetClass('Fixed Income');
|
|
104
104
|
original.setIssuerName('US Treasury');
|
|
105
105
|
original.setCouponType(CouponTypeProto.FLOAT);
|
|
@@ -113,7 +113,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
113
113
|
const bytes = original.serializeBinary();
|
|
114
114
|
const parsed = SecurityProto.deserializeBinary(bytes);
|
|
115
115
|
|
|
116
|
-
expect(parsed.
|
|
116
|
+
expect(parsed.getProductType()).toBe(ProductTypeProto.TREASURY_FRN);
|
|
117
117
|
expect(parsed.getCouponType()).toBe(CouponTypeProto.FLOAT);
|
|
118
118
|
expect(parsed.getCouponFrequency()).toBe(CouponFrequencyProto.QUARTERLY);
|
|
119
119
|
expect(parsed.getFaceValue()!.getArbitraryPrecisionValue()).toBe('100');
|
|
@@ -126,7 +126,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
126
126
|
const original = new SecurityProto();
|
|
127
127
|
original.setObjectClass('Security');
|
|
128
128
|
original.setVersion('0.0.1');
|
|
129
|
-
original.
|
|
129
|
+
original.setProductType(ProductTypeProto.COMMON_STOCK);
|
|
130
130
|
original.setAssetClass('Equity');
|
|
131
131
|
original.setIssuerName('Apple Inc.');
|
|
132
132
|
original.setQuantityType(SecurityQuantityTypeProto.UNITS);
|
|
@@ -136,7 +136,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
136
136
|
const bytes = original.serializeBinary();
|
|
137
137
|
const parsed = SecurityProto.deserializeBinary(bytes);
|
|
138
138
|
|
|
139
|
-
expect(parsed.
|
|
139
|
+
expect(parsed.getProductType()).toBe(ProductTypeProto.COMMON_STOCK);
|
|
140
140
|
expect(parsed.getAssetClass()).toBe('Equity');
|
|
141
141
|
expect(parsed.getIssuerName()).toBe('Apple Inc.');
|
|
142
142
|
expect(parsed.getQuantityType()).toBe(SecurityQuantityTypeProto.UNITS);
|
|
@@ -149,7 +149,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
149
149
|
const original = new SecurityProto();
|
|
150
150
|
original.setObjectClass('Security');
|
|
151
151
|
original.setVersion('0.0.1');
|
|
152
|
-
original.
|
|
152
|
+
original.setProductType(ProductTypeProto.CURRENCY);
|
|
153
153
|
original.setAssetClass('Cash');
|
|
154
154
|
original.setIssuerName('Federal Reserve');
|
|
155
155
|
original.setQuantityType(SecurityQuantityTypeProto.UNITS);
|
|
@@ -160,7 +160,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
160
160
|
const bytes = original.serializeBinary();
|
|
161
161
|
const parsed = SecurityProto.deserializeBinary(bytes);
|
|
162
162
|
|
|
163
|
-
expect(parsed.
|
|
163
|
+
expect(parsed.getProductType()).toBe(ProductTypeProto.CURRENCY);
|
|
164
164
|
expect(parsed.getAssetClass()).toBe('Cash');
|
|
165
165
|
expect(parsed.getCashId()).toBe('USD');
|
|
166
166
|
expect(parsed.getDescription()).toBe('US Dollar');
|
|
@@ -172,7 +172,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
172
172
|
const original = new SecurityProto();
|
|
173
173
|
original.setObjectClass('Security');
|
|
174
174
|
original.setVersion('0.0.1');
|
|
175
|
-
original.
|
|
175
|
+
original.setProductType(ProductTypeProto.EQUITY_INDEX);
|
|
176
176
|
original.setAssetClass('Index');
|
|
177
177
|
original.setIssuerName('Bureau of Labor Statistics');
|
|
178
178
|
original.setDescription('US CPI-U All Urban Consumers');
|
|
@@ -182,7 +182,7 @@ describe('SecurityProto Round-Trip Serialization — All 6 Security Types', () =
|
|
|
182
182
|
const bytes = original.serializeBinary();
|
|
183
183
|
const parsed = SecurityProto.deserializeBinary(bytes);
|
|
184
184
|
|
|
185
|
-
expect(parsed.
|
|
185
|
+
expect(parsed.getProductType()).toBe(ProductTypeProto.EQUITY_INDEX);
|
|
186
186
|
expect(parsed.getAssetClass()).toBe('Index');
|
|
187
187
|
expect(parsed.getIssuerName()).toBe('Bureau of Labor Statistics');
|
|
188
188
|
expect(parsed.getDescription()).toBe('US CPI-U All Urban Consumers');
|