@fintekkers/ledger-models 1.1.30 → 1.1.31
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/catalog/measures.json +18 -0
- package/node/fintekkers/models/position/measure_pb.d.ts +1 -0
- package/node/fintekkers/models/position/measure_pb.js +2 -1
- package/node/wrappers/models/position/measure.test.js +37 -0
- package/node/wrappers/models/position/measure.test.js.map +1 -1
- package/node/wrappers/models/position/measure.test.ts +17 -0
- package/package.json +1 -1
package/catalog/measures.json
CHANGED
|
@@ -517,6 +517,24 @@
|
|
|
517
517
|
"implemented": true,
|
|
518
518
|
"computed_by": "valuation-service",
|
|
519
519
|
"depends_on": ["REFERENCE_CPI", "SECURITY_TERMS"]
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
"name": "INFLATION_COMPENSATION",
|
|
523
|
+
"enum_value": 30,
|
|
524
|
+
"display_name": "Inflation Compensation",
|
|
525
|
+
"description": "TIPS only. The dollar inflation accrual on original face at the as-of date. Absent, not zero, for other input types.",
|
|
526
|
+
"formula": "See MeasureProto.INFLATION_COMPENSATION in measure.proto (the spec).",
|
|
527
|
+
"units": "Dollars (nominal)",
|
|
528
|
+
"category": "valuation",
|
|
529
|
+
"applies_to": ["TIPS"],
|
|
530
|
+
"model_assumptions": [
|
|
531
|
+
"No deflation floor: may be negative",
|
|
532
|
+
"Absent when INDEX_RATIO is absent",
|
|
533
|
+
"Not computed yet: valuation-service computes it from VS-155"
|
|
534
|
+
],
|
|
535
|
+
"implemented": false,
|
|
536
|
+
"computed_by": "valuation-service",
|
|
537
|
+
"depends_on": ["DIRECTED_QUANTITY", "INDEX_RATIO"]
|
|
520
538
|
}
|
|
521
539
|
]
|
|
522
540
|
}
|
|
@@ -54,7 +54,8 @@ proto.fintekkers.models.position.MeasureProto = {
|
|
|
54
54
|
DISCOUNT_YIELD: 26,
|
|
55
55
|
BOND_EQUIVALENT_YIELD: 27,
|
|
56
56
|
REFERENCE_CPI: 28,
|
|
57
|
-
INDEX_RATIO: 29
|
|
57
|
+
INDEX_RATIO: 29,
|
|
58
|
+
INFLATION_COMPENSATION: 30
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
goog.object.extend(exports, proto.fintekkers.models.position);
|
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const fs = __importStar(require("fs"));
|
|
27
|
+
const path = __importStar(require("path"));
|
|
3
28
|
const measure_1 = require("./measure");
|
|
4
29
|
const measure_pb_1 = require("../../../fintekkers/models/position/measure_pb");
|
|
30
|
+
const MEASURE_PROTO = path.resolve(__dirname, '../../../../../ledger-models-protos/fintekkers/models/position/measure.proto');
|
|
5
31
|
describe('Measure.fromName', () => {
|
|
6
32
|
test.each(measure_1.Measure.getAllTypeNames())('fromName("%s") returns the matching numeric enum value', (name) => {
|
|
7
33
|
const value = measure_1.Measure.fromName(name);
|
|
@@ -36,6 +62,15 @@ describe('Measure.fromName', () => {
|
|
|
36
62
|
expect(measure_1.Measure.fromName('UNKNOWN_MEASURE')).toBe(measure_pb_1.MeasureProto.UNKNOWN_MEASURE);
|
|
37
63
|
});
|
|
38
64
|
});
|
|
65
|
+
describe('INFLATION_COMPENSATION (LM-433)', () => {
|
|
66
|
+
test('resolves by name to the number declared in measure.proto', () => {
|
|
67
|
+
const declared = fs.readFileSync(MEASURE_PROTO, 'utf8').match(/^\s*INFLATION_COMPENSATION\s*=\s*(\d+)\s*;/m);
|
|
68
|
+
expect(declared).not.toBeNull();
|
|
69
|
+
const number = Number(declared[1]);
|
|
70
|
+
expect(measure_1.Measure.fromName('INFLATION_COMPENSATION')).toBe(number);
|
|
71
|
+
expect(measure_pb_1.MeasureProto['INFLATION_COMPENSATION']).toBe(number);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
39
74
|
describe('Measure.getAllTypeNames', () => {
|
|
40
75
|
test('returns the expected set in proto-declaration order, excluding UNKNOWN_MEASURE', () => {
|
|
41
76
|
// Proto-declared order in measure.proto (post-PR #192 additions):
|
|
@@ -68,6 +103,7 @@ describe('Measure.getAllTypeNames', () => {
|
|
|
68
103
|
// BOND_EQUIVALENT_YIELD = 27; (v0.2.3, #209)
|
|
69
104
|
// REFERENCE_CPI = 28; (LM-343 — TIPS index ratio inputs)
|
|
70
105
|
// INDEX_RATIO = 29; (LM-343)
|
|
106
|
+
// INFLATION_COMPENSATION = 30; (LM-433 — TIPS inflation accrual)
|
|
71
107
|
expect(measure_1.Measure.getAllTypeNames()).toEqual([
|
|
72
108
|
'DIRECTED_QUANTITY',
|
|
73
109
|
'MARKET_VALUE',
|
|
@@ -97,6 +133,7 @@ describe('Measure.getAllTypeNames', () => {
|
|
|
97
133
|
'BOND_EQUIVALENT_YIELD',
|
|
98
134
|
'REFERENCE_CPI',
|
|
99
135
|
'INDEX_RATIO',
|
|
136
|
+
'INFLATION_COMPENSATION',
|
|
100
137
|
]);
|
|
101
138
|
});
|
|
102
139
|
test('excludes the UNKNOWN_MEASURE sentinel', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure.test.js","sourceRoot":"","sources":["measure.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"measure.test.js","sourceRoot":"","sources":["measure.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,uCAAoC;AACpC,+EAA8E;AAE9E,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,8EAA8E,CAAC,CAAC;AAE9H,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC9B,IAAI,CAAC,IAAI,CAAC,iBAAO,CAAC,eAAe,EAAE,CAAC,CAChC,wDAAwD,EACxD,CAAC,IAAY,EAAE,EAAE;QACb,MAAM,KAAK,GAAG,iBAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,QAAQ,GAAI,yBAAkD,CAAC,IAAI,CAAC,CAAC;QAC3E,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,CACJ,CAAC;IAEF,IAAI,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,IAAI,GAAsB,CAAC;QAC3B,IAAI;YACA,iBAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;SAC1C;QAAC,OAAO,CAAC,EAAE;YACR,GAAG,GAAG,CAAU,CAAC;SACpB;QACD,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAI,CAAC,OAAO,CAAC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AAE;QAC/C,MAAM,CAAC,iBAAO,CAAC,eAAe,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
|
|
1
4
|
import { Measure } from './measure';
|
|
2
5
|
import { MeasureProto } from '../../../fintekkers/models/position/measure_pb';
|
|
3
6
|
|
|
7
|
+
const MEASURE_PROTO = path.resolve(__dirname, '../../../../../ledger-models-protos/fintekkers/models/position/measure.proto');
|
|
8
|
+
|
|
4
9
|
describe('Measure.fromName', () => {
|
|
5
10
|
test.each(Measure.getAllTypeNames())(
|
|
6
11
|
'fromName("%s") returns the matching numeric enum value',
|
|
@@ -43,6 +48,16 @@ describe('Measure.fromName', () => {
|
|
|
43
48
|
});
|
|
44
49
|
});
|
|
45
50
|
|
|
51
|
+
describe('INFLATION_COMPENSATION (LM-433)', () => {
|
|
52
|
+
test('resolves by name to the number declared in measure.proto', () => {
|
|
53
|
+
const declared = fs.readFileSync(MEASURE_PROTO, 'utf8').match(/^\s*INFLATION_COMPENSATION\s*=\s*(\d+)\s*;/m);
|
|
54
|
+
expect(declared).not.toBeNull();
|
|
55
|
+
const number = Number(declared![1]);
|
|
56
|
+
expect(Measure.fromName('INFLATION_COMPENSATION')).toBe(number);
|
|
57
|
+
expect((MeasureProto as unknown as Record<string, number>)['INFLATION_COMPENSATION']).toBe(number);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
46
61
|
describe('Measure.getAllTypeNames', () => {
|
|
47
62
|
test('returns the expected set in proto-declaration order, excluding UNKNOWN_MEASURE', () => {
|
|
48
63
|
// Proto-declared order in measure.proto (post-PR #192 additions):
|
|
@@ -75,6 +90,7 @@ describe('Measure.getAllTypeNames', () => {
|
|
|
75
90
|
// BOND_EQUIVALENT_YIELD = 27; (v0.2.3, #209)
|
|
76
91
|
// REFERENCE_CPI = 28; (LM-343 — TIPS index ratio inputs)
|
|
77
92
|
// INDEX_RATIO = 29; (LM-343)
|
|
93
|
+
// INFLATION_COMPENSATION = 30; (LM-433 — TIPS inflation accrual)
|
|
78
94
|
expect(Measure.getAllTypeNames()).toEqual([
|
|
79
95
|
'DIRECTED_QUANTITY',
|
|
80
96
|
'MARKET_VALUE',
|
|
@@ -104,6 +120,7 @@ describe('Measure.getAllTypeNames', () => {
|
|
|
104
120
|
'BOND_EQUIVALENT_YIELD',
|
|
105
121
|
'REFERENCE_CPI',
|
|
106
122
|
'INDEX_RATIO',
|
|
123
|
+
'INFLATION_COMPENSATION',
|
|
107
124
|
]);
|
|
108
125
|
});
|
|
109
126
|
|