@fintekkers/ledger-models 0.3.1 → 0.4.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/node/fintekkers/models/security/security_pb.d.ts +0 -80
- package/node/fintekkers/models/security/security_pb.js +1 -723
- package/node/fintekkers/models/security/security_pb.test.js +15 -15
- package/node/fintekkers/models/security/security_pb.test.js.map +1 -1
- package/node/fintekkers/models/security/security_pb.test.ts +17 -18
- package/node/wrappers/models/price/Price.cash.test.js +1 -1
- 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.d.ts +41 -3
- package/node/wrappers/models/security/BondSecurity.fromPricerInputs.test.d.ts +1 -0
- package/node/wrappers/models/security/BondSecurity.fromPricerInputs.test.js +75 -0
- package/node/wrappers/models/security/BondSecurity.fromPricerInputs.test.js.map +1 -0
- package/node/wrappers/models/security/BondSecurity.fromPricerInputs.test.ts +95 -0
- package/node/wrappers/models/security/BondSecurity.js +57 -9
- package/node/wrappers/models/security/BondSecurity.js.map +1 -1
- package/node/wrappers/models/security/BondSecurity.priceScale.test.js +5 -3
- package/node/wrappers/models/security/BondSecurity.priceScale.test.js.map +1 -1
- package/node/wrappers/models/security/BondSecurity.priceScale.test.ts +7 -5
- package/node/wrappers/models/security/BondSecurity.test.js +28 -20
- package/node/wrappers/models/security/BondSecurity.test.js.map +1 -1
- package/node/wrappers/models/security/BondSecurity.test.ts +29 -21
- package/node/wrappers/models/security/BondSecurity.ts +72 -10
- package/node/wrappers/models/security/FloatingRateNote.d.ts +30 -0
- package/node/wrappers/models/security/FloatingRateNote.js +80 -0
- package/node/wrappers/models/security/FloatingRateNote.js.map +1 -0
- package/node/wrappers/models/security/FloatingRateNote.ts +67 -0
- package/node/wrappers/models/security/IndexSecurity.d.ts +16 -0
- package/node/wrappers/models/security/IndexSecurity.js +26 -0
- package/node/wrappers/models/security/IndexSecurity.js.map +1 -0
- package/node/wrappers/models/security/IndexSecurity.test.d.ts +1 -0
- package/node/wrappers/models/security/IndexSecurity.test.js +60 -0
- package/node/wrappers/models/security/IndexSecurity.test.js.map +1 -0
- package/node/wrappers/models/security/IndexSecurity.test.ts +60 -0
- package/node/wrappers/models/security/IndexSecurity.ts +24 -0
- package/node/wrappers/models/security/Issuance.d.ts +35 -0
- package/node/wrappers/models/security/Issuance.js +64 -0
- package/node/wrappers/models/security/Issuance.js.map +1 -0
- package/node/wrappers/models/security/Issuance.test.d.ts +1 -0
- package/node/wrappers/models/security/Issuance.test.js +55 -0
- package/node/wrappers/models/security/Issuance.test.js.map +1 -0
- package/node/wrappers/models/security/Issuance.test.ts +52 -0
- package/node/wrappers/models/security/Issuance.ts +74 -0
- package/node/wrappers/models/security/TIPSBond.d.ts +30 -0
- package/node/wrappers/models/security/TIPSBond.js +83 -0
- package/node/wrappers/models/security/TIPSBond.js.map +1 -0
- package/node/wrappers/models/security/TIPSBond.ts +70 -0
- package/node/wrappers/models/security/security-roundtrip.test.js +77 -61
- package/node/wrappers/models/security/security-roundtrip.test.js.map +1 -1
- package/node/wrappers/models/security/security-roundtrip.test.ts +78 -62
- package/node/wrappers/models/security/security.d.ts +21 -6
- package/node/wrappers/models/security/security.identifiers.test.d.ts +1 -0
- package/node/wrappers/models/security/security.identifiers.test.js +67 -0
- package/node/wrappers/models/security/security.identifiers.test.js.map +1 -0
- package/node/wrappers/models/security/security.identifiers.test.ts +67 -0
- package/node/wrappers/models/security/security.js +72 -29
- package/node/wrappers/models/security/security.js.map +1 -1
- package/node/wrappers/models/security/security.test.js +16 -12
- package/node/wrappers/models/security/security.test.js.map +1 -1
- package/node/wrappers/models/security/security.test.ts +17 -15
- package/node/wrappers/models/security/security.ts +75 -29
- package/node/wrappers/models/transaction/transaction.derived.test.js +8 -6
- package/node/wrappers/models/transaction/transaction.derived.test.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.derived.test.ts +9 -7
- package/node/wrappers/models/transaction/transaction.js +4 -2
- package/node/wrappers/models/transaction/transaction.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.ts +4 -2
- package/node/wrappers/models/transaction/transaction_constructor.test.js +8 -6
- package/node/wrappers/models/transaction/transaction_constructor.test.js.map +1 -1
- package/node/wrappers/models/transaction/transaction_constructor.test.ts +9 -7
- package/node/wrappers/services/searchWithSecurities.test.js +2 -2
- package/node/wrappers/services/searchWithSecurities.test.js.map +1 -1
- package/node/wrappers/services/searchWithSecurities.test.ts +2 -2
- package/node/wrappers/services/security-service/security.maturityLadder.test.js +5 -3
- package/node/wrappers/services/security-service/security.maturityLadder.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.maturityLadder.test.ts +5 -3
- package/node/wrappers/services/security-service/security.test.js +10 -8
- package/node/wrappers/services/security-service/security.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.test.ts +12 -9
- package/node/wrappers/util/link-resolver.test.js +1 -1
- package/node/wrappers/util/link-resolver.test.js.map +1 -1
- package/node/wrappers/util/link-resolver.test.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndexSecurity.test.js","sourceRoot":"","sources":["IndexSecurity.test.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAClC,oEAA4C;AAC5C,iFAAmG;AACnG,yFAAuF;AACvF,2FAAyF;AACzF,wCAAqC;AAErC,IAAI,CAAC,oDAAoD,EAAE,GAAG,EAAE;IAC9D,MAAM,KAAK,GAAG,IAAI,2BAAa,EAAE;SAC9B,cAAc,CAAC,UAAU,CAAC;SAC1B,UAAU,CAAC,OAAO,CAAC;SACnB,OAAO,CAAC,WAAI,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;SACpC,cAAc,CAAC,kCAAgB,CAAC,UAAU,CAAC;SAC3C,aAAa,CAAC,OAAO,CAAC,CAAC;IAC1B,KAAK,CAAC,eAAe,CAAC,IAAI,+BAAiB,EAAE,CAAC,YAAY,CAAC,8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AAgB,CAAC,UAAU,CAAC;SAC3C,aAAa,CAAC,OAAO,CAAC,CAAC;IAC1B,MAAM,GAAG,GAAG,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAkB,CAAC;IACpD,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,8BAAc,CAAC,kBAAkB,CAAC,CAAC;AACrE,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,mDAAmD,EAAE,GAAG,EAAE;IAC7D,MAAM,KAAK,GAAG,IAAI,2BAAa,EAAE;SAC9B,cAAc,CAAC,UAAU,CAAC;SAC1B,UAAU,CAAC,OAAO,CAAC;SACnB,OAAO,CAAC,WAAI,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;SACpC,cAAc,CAAC,kCAAgB,CAAC,YAAY,CAAC,CAAC;IACjD,KAAK,CAAC,eAAe,CAAC,IAAI,+BAAiB,EAAE,CAAC,YAAY,CAAC,8BAAc,CAAC,WAAW,CAAC,CAAC,CAAC;IACxF,MAAM,GAAG,GAAG,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,uBAAa,CAAC,CAAC;IAC1C,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,kBAAQ,CAAC,CAAC;IACrC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import Security from './security';
|
|
2
|
+
import IndexSecurity from './IndexSecurity';
|
|
3
|
+
import { SecurityProto, IndexDetailsProto } from '../../../fintekkers/models/security/security_pb';
|
|
4
|
+
import { ProductTypeProto } from '../../../fintekkers/models/security/product_type_pb';
|
|
5
|
+
import { IndexTypeProto } from '../../../fintekkers/models/security/index/index_type_pb';
|
|
6
|
+
import { UUID } from '../utils/uuid';
|
|
7
|
+
|
|
8
|
+
test('Security.create routes CPI_SERIES to IndexSecurity', () => {
|
|
9
|
+
const proto = new SecurityProto()
|
|
10
|
+
.setObjectClass('Security')
|
|
11
|
+
.setVersion('0.0.1')
|
|
12
|
+
.setUuid(UUID.random().toUUIDProto())
|
|
13
|
+
.setProductType(ProductTypeProto.CPI_SERIES)
|
|
14
|
+
.setAssetClass('Index');
|
|
15
|
+
proto.setIndexDetails(new IndexDetailsProto().setIndexType(IndexTypeProto.CPI_U));
|
|
16
|
+
|
|
17
|
+
const sec = Security.create(proto);
|
|
18
|
+
expect(sec).toBeInstanceOf(IndexSecurity);
|
|
19
|
+
expect((sec as IndexSecurity).getIndexType()).toBe(IndexTypeProto.CPI_U);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('Security.create routes SOFR_SERIES to IndexSecurity', () => {
|
|
23
|
+
const proto = new SecurityProto()
|
|
24
|
+
.setObjectClass('Security')
|
|
25
|
+
.setVersion('0.0.1')
|
|
26
|
+
.setUuid(UUID.random().toUUIDProto())
|
|
27
|
+
.setProductType(ProductTypeProto.SOFR_SERIES)
|
|
28
|
+
.setAssetClass('Index');
|
|
29
|
+
proto.setIndexDetails(new IndexDetailsProto().setIndexType(IndexTypeProto.SOFR));
|
|
30
|
+
|
|
31
|
+
const sec = Security.create(proto);
|
|
32
|
+
expect(sec).toBeInstanceOf(IndexSecurity);
|
|
33
|
+
expect((sec as IndexSecurity).getIndexType()).toBe(IndexTypeProto.SOFR);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('IndexSecurity.getIndexType returns UNKNOWN when index_details is unset', () => {
|
|
37
|
+
// Force-construct without populating index_details so we exercise the
|
|
38
|
+
// null-safe branch in the getter.
|
|
39
|
+
const proto = new SecurityProto()
|
|
40
|
+
.setObjectClass('Security')
|
|
41
|
+
.setVersion('0.0.1')
|
|
42
|
+
.setUuid(UUID.random().toUUIDProto())
|
|
43
|
+
.setProductType(ProductTypeProto.CPI_SERIES)
|
|
44
|
+
.setAssetClass('Index');
|
|
45
|
+
const sec = Security.create(proto) as IndexSecurity;
|
|
46
|
+
expect(sec.getIndexType()).toBe(IndexTypeProto.UNKNOWN_INDEX_TYPE);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('IndexSecurity extends Security (not BondSecurity)', () => {
|
|
50
|
+
const proto = new SecurityProto()
|
|
51
|
+
.setObjectClass('Security')
|
|
52
|
+
.setVersion('0.0.1')
|
|
53
|
+
.setUuid(UUID.random().toUUIDProto())
|
|
54
|
+
.setProductType(ProductTypeProto.EQUITY_INDEX);
|
|
55
|
+
proto.setIndexDetails(new IndexDetailsProto().setIndexType(IndexTypeProto.US_TREASURY));
|
|
56
|
+
const sec = Security.create(proto);
|
|
57
|
+
expect(sec).toBeInstanceOf(IndexSecurity);
|
|
58
|
+
expect(sec).toBeInstanceOf(Security);
|
|
59
|
+
expect(sec.isBond()).toBe(false);
|
|
60
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Security from './security';
|
|
2
|
+
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
3
|
+
import { IndexTypeProto } from '../../../fintekkers/models/security/index/index_type_pb';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Wrapper for Security messages whose product_type is a descendant of
|
|
7
|
+
* INDEX in hierarchy.json (CPI_SERIES, SOFR_SERIES, EQUITY_INDEX, etc.).
|
|
8
|
+
* The index-specific fields live in the index_details sub-message (one of
|
|
9
|
+
* the non_bond_details oneof variants).
|
|
10
|
+
*/
|
|
11
|
+
class IndexSecurity extends Security {
|
|
12
|
+
constructor(proto: SecurityProto) {
|
|
13
|
+
super(proto);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Which index family this security represents. Defaults to
|
|
17
|
+
* UNKNOWN_INDEX_TYPE when index_details is not populated. */
|
|
18
|
+
getIndexType(): IndexTypeProto {
|
|
19
|
+
const details = this.proto.getIndexDetails();
|
|
20
|
+
return details ? details.getIndexType() : IndexTypeProto.UNKNOWN_INDEX_TYPE;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default IndexSecurity;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IssuanceProto } from "../../../fintekkers/models/security/bond/issuance_pb";
|
|
2
|
+
import { AuctionTypeProto } from "../../../fintekkers/models/security/bond/auction_type_pb";
|
|
3
|
+
import { LocalDate } from "../utils/date";
|
|
4
|
+
import Decimal from "decimal.js";
|
|
5
|
+
/**
|
|
6
|
+
* Typed wrapper around a single IssuanceProto. Returns null for unset
|
|
7
|
+
* sub-messages and Decimal/LocalDate for populated ones — callers no longer
|
|
8
|
+
* have to spell out the proto / Decimal coercions at every call site.
|
|
9
|
+
*
|
|
10
|
+
* Note: IssuanceProto has no `dated_date` or `auction_date` field on the
|
|
11
|
+
* proto today, so those accessors are intentionally absent.
|
|
12
|
+
*/
|
|
13
|
+
declare class Issuance {
|
|
14
|
+
proto: IssuanceProto;
|
|
15
|
+
constructor(proto: IssuanceProto);
|
|
16
|
+
private static _toDecimal;
|
|
17
|
+
private static _toLocalDate;
|
|
18
|
+
/** Auction issue (settlement) date. Null if unset. */
|
|
19
|
+
getIssueDate(): LocalDate | null;
|
|
20
|
+
/** Auction announcement date. Null if unset. */
|
|
21
|
+
getAnnouncementDate(): LocalDate | null;
|
|
22
|
+
/** Auction offering amount (original face value offered). Null if unset. */
|
|
23
|
+
getOriginalFaceValue(): Decimal | null;
|
|
24
|
+
/** Total quantity accepted at auction. Null if unset. */
|
|
25
|
+
getTotalAccepted(): Decimal | null;
|
|
26
|
+
/** Outstanding quantity after auction settles. Null if unset. */
|
|
27
|
+
getPostAuctionOutstandingQuantity(): Decimal | null;
|
|
28
|
+
/** Quantity of the mature security used in reopenings. Null if unset. */
|
|
29
|
+
getMatureSecurityAmount(): Decimal | null;
|
|
30
|
+
/** Single-price auction clearing price. Null if unset (e.g., multi-price). */
|
|
31
|
+
getPriceForSinglePriceAuction(): Decimal | null;
|
|
32
|
+
/** Auction type enum (defaults to UNKNOWN_AUCTION_TYPE if unset). */
|
|
33
|
+
getAuctionType(): AuctionTypeProto;
|
|
34
|
+
}
|
|
35
|
+
export default Issuance;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const date_1 = require("../utils/date");
|
|
7
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
8
|
+
/**
|
|
9
|
+
* Typed wrapper around a single IssuanceProto. Returns null for unset
|
|
10
|
+
* sub-messages and Decimal/LocalDate for populated ones — callers no longer
|
|
11
|
+
* have to spell out the proto / Decimal coercions at every call site.
|
|
12
|
+
*
|
|
13
|
+
* Note: IssuanceProto has no `dated_date` or `auction_date` field on the
|
|
14
|
+
* proto today, so those accessors are intentionally absent.
|
|
15
|
+
*/
|
|
16
|
+
class Issuance {
|
|
17
|
+
constructor(proto) {
|
|
18
|
+
this.proto = proto;
|
|
19
|
+
}
|
|
20
|
+
static _toDecimal(value) {
|
|
21
|
+
if (!value)
|
|
22
|
+
return null;
|
|
23
|
+
return new decimal_js_1.default(value.getArbitraryPrecisionValue());
|
|
24
|
+
}
|
|
25
|
+
static _toLocalDate(value) {
|
|
26
|
+
if (!value)
|
|
27
|
+
return null;
|
|
28
|
+
return new date_1.LocalDate(value);
|
|
29
|
+
}
|
|
30
|
+
/** Auction issue (settlement) date. Null if unset. */
|
|
31
|
+
getIssueDate() {
|
|
32
|
+
return Issuance._toLocalDate(this.proto.getAuctionIssueDate());
|
|
33
|
+
}
|
|
34
|
+
/** Auction announcement date. Null if unset. */
|
|
35
|
+
getAnnouncementDate() {
|
|
36
|
+
return Issuance._toLocalDate(this.proto.getAuctionAnnouncementDate());
|
|
37
|
+
}
|
|
38
|
+
/** Auction offering amount (original face value offered). Null if unset. */
|
|
39
|
+
getOriginalFaceValue() {
|
|
40
|
+
return Issuance._toDecimal(this.proto.getAuctionOfferingAmount());
|
|
41
|
+
}
|
|
42
|
+
/** Total quantity accepted at auction. Null if unset. */
|
|
43
|
+
getTotalAccepted() {
|
|
44
|
+
return Issuance._toDecimal(this.proto.getTotalAccepted());
|
|
45
|
+
}
|
|
46
|
+
/** Outstanding quantity after auction settles. Null if unset. */
|
|
47
|
+
getPostAuctionOutstandingQuantity() {
|
|
48
|
+
return Issuance._toDecimal(this.proto.getPostAuctionOutstandingQuantity());
|
|
49
|
+
}
|
|
50
|
+
/** Quantity of the mature security used in reopenings. Null if unset. */
|
|
51
|
+
getMatureSecurityAmount() {
|
|
52
|
+
return Issuance._toDecimal(this.proto.getMatureSecurityAmount());
|
|
53
|
+
}
|
|
54
|
+
/** Single-price auction clearing price. Null if unset (e.g., multi-price). */
|
|
55
|
+
getPriceForSinglePriceAuction() {
|
|
56
|
+
return Issuance._toDecimal(this.proto.getPriceForSinglePriceAuction());
|
|
57
|
+
}
|
|
58
|
+
/** Auction type enum (defaults to UNKNOWN_AUCTION_TYPE if unset). */
|
|
59
|
+
getAuctionType() {
|
|
60
|
+
return this.proto.getAuctionType();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.default = Issuance;
|
|
64
|
+
//# sourceMappingURL=Issuance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Issuance.js","sourceRoot":"","sources":["Issuance.ts"],"names":[],"mappings":";;;;;AAIA,wCAA0C;AAC1C,4DAAiC;AAEjC;;;;;;;GAOG;AACH,MAAM,QAAQ;IAGZ,YAAY,KAAoB;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAEO,MAAM,CAAC,UAAU,CAAC,KAAoC;QAC5D,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACxB,OAAO,IAAI,oBAAO,CAAC,KA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1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Issuance_1 = __importDefault(require("./Issuance"));
|
|
7
|
+
const issuance_pb_1 = require("../../../fintekkers/models/security/bond/issuance_pb");
|
|
8
|
+
const auction_type_pb_1 = require("../../../fintekkers/models/security/bond/auction_type_pb");
|
|
9
|
+
const decimal_value_pb_1 = require("../../../fintekkers/models/util/decimal_value_pb");
|
|
10
|
+
const local_date_pb_1 = require("../../../fintekkers/models/util/local_date_pb");
|
|
11
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
12
|
+
function buildProto() {
|
|
13
|
+
const p = new issuance_pb_1.IssuanceProto();
|
|
14
|
+
p.setAuctionIssueDate(new local_date_pb_1.LocalDateProto().setYear(2023).setMonth(2).setDay(15));
|
|
15
|
+
p.setAuctionAnnouncementDate(new local_date_pb_1.LocalDateProto().setYear(2023).setMonth(2).setDay(8));
|
|
16
|
+
p.setAuctionOfferingAmount(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('45000000000'));
|
|
17
|
+
p.setTotalAccepted(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('44999500000'));
|
|
18
|
+
p.setPostAuctionOutstandingQuantity(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('44999500000'));
|
|
19
|
+
p.setMatureSecurityAmount(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('0'));
|
|
20
|
+
p.setPriceForSinglePriceAuction(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('99.875'));
|
|
21
|
+
p.setAuctionType(auction_type_pb_1.AuctionTypeProto.SINGLE_PRICE);
|
|
22
|
+
return p;
|
|
23
|
+
}
|
|
24
|
+
test('Issuance typed accessors return wrapped values', () => {
|
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
26
|
+
const iss = new Issuance_1.default(buildProto());
|
|
27
|
+
expect((_a = iss.getIssueDate()) === null || _a === void 0 ? void 0 : _a.toString()).toBe('2023-2-15');
|
|
28
|
+
expect((_b = iss.getAnnouncementDate()) === null || _b === void 0 ? void 0 : _b.toString()).toBe('2023-2-8');
|
|
29
|
+
expect((_c = iss.getOriginalFaceValue()) === null || _c === void 0 ? void 0 : _c.toString()).toBe('45000000000');
|
|
30
|
+
expect((_d = iss.getTotalAccepted()) === null || _d === void 0 ? void 0 : _d.toString()).toBe('44999500000');
|
|
31
|
+
expect((_e = iss.getPostAuctionOutstandingQuantity()) === null || _e === void 0 ? void 0 : _e.toString()).toBe('44999500000');
|
|
32
|
+
expect((_f = iss.getMatureSecurityAmount()) === null || _f === void 0 ? void 0 : _f.toString()).toBe('0');
|
|
33
|
+
expect((_g = iss.getPriceForSinglePriceAuction()) === null || _g === void 0 ? void 0 : _g.toString()).toBe('99.875');
|
|
34
|
+
expect(iss.getAuctionType()).toBe(auction_type_pb_1.AuctionTypeProto.SINGLE_PRICE);
|
|
35
|
+
});
|
|
36
|
+
test('Issuance returns null for unset sub-messages', () => {
|
|
37
|
+
const iss = new Issuance_1.default(new issuance_pb_1.IssuanceProto());
|
|
38
|
+
expect(iss.getIssueDate()).toBeNull();
|
|
39
|
+
expect(iss.getAnnouncementDate()).toBeNull();
|
|
40
|
+
expect(iss.getOriginalFaceValue()).toBeNull();
|
|
41
|
+
expect(iss.getTotalAccepted()).toBeNull();
|
|
42
|
+
expect(iss.getPostAuctionOutstandingQuantity()).toBeNull();
|
|
43
|
+
expect(iss.getMatureSecurityAmount()).toBeNull();
|
|
44
|
+
expect(iss.getPriceForSinglePriceAuction()).toBeNull();
|
|
45
|
+
// enum defaults to zero value
|
|
46
|
+
expect(iss.getAuctionType()).toBe(auction_type_pb_1.AuctionTypeProto.UNKNOWN_AUCTION_TYPE);
|
|
47
|
+
});
|
|
48
|
+
test('Issuance Decimal returns are Decimal instances (for math)', () => {
|
|
49
|
+
const iss = new Issuance_1.default(buildProto());
|
|
50
|
+
const faceValue = iss.getOriginalFaceValue();
|
|
51
|
+
expect(faceValue).toBeInstanceOf(decimal_js_1.default);
|
|
52
|
+
// smoke: doing arithmetic should work
|
|
53
|
+
expect(faceValue.plus(1).toString()).toBe('45000000001');
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=Issuance.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Issuance.test.js","sourceRoot":"","sources":["Issuance.test.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAClC,sFAAqF;AACrF,8FAA4F;AAC5F,uFAAqF;AACrF,iFAA+E;AAC/E,4DAAiC;AAEjC,SAAS,UAAU;IACjB,MAAM,CAAC,GAAG,IAAI,2BAAa,EAAE,CAAC;IAC9B,CAAC,CAAC,mBAAmB,CAAC,IAAI,8BAAc,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IACjF,CAAC,CAAC,0BAA0B,CAAC,IAAI,8BAAc,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACvF,CAAC,CAAC,wBAAwB,CAAC,IAAI,oCAAiB,EAAE,CAAC,0BAA0B,CAAC,aAAa,CAAC,CAAC,CAAC;IAC9F,CAAC,CAAC,gBAAgB,CAAC,IAAI,oCAAiB,EAAE,CAAC,0BAA0B,CAAC,aAAa,CAAC,CAAC,CAAC;IACtF,CAAC,CAAC,iCAAiC,CAAC,IAAI,oCAAiB,EAAE,CAAC,0BAA0B,CAAC,aAAa,CAAC,CAAC,CAAC;IACvG,CAAC,CAAC,uBAAuB,CAAC,IAAI,o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,CAAC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Issuance from './Issuance';
|
|
2
|
+
import { IssuanceProto } from '../../../fintekkers/models/security/bond/issuance_pb';
|
|
3
|
+
import { AuctionTypeProto } from '../../../fintekkers/models/security/bond/auction_type_pb';
|
|
4
|
+
import { DecimalValueProto } from '../../../fintekkers/models/util/decimal_value_pb';
|
|
5
|
+
import { LocalDateProto } from '../../../fintekkers/models/util/local_date_pb';
|
|
6
|
+
import Decimal from 'decimal.js';
|
|
7
|
+
|
|
8
|
+
function buildProto(): IssuanceProto {
|
|
9
|
+
const p = new IssuanceProto();
|
|
10
|
+
p.setAuctionIssueDate(new LocalDateProto().setYear(2023).setMonth(2).setDay(15));
|
|
11
|
+
p.setAuctionAnnouncementDate(new LocalDateProto().setYear(2023).setMonth(2).setDay(8));
|
|
12
|
+
p.setAuctionOfferingAmount(new DecimalValueProto().setArbitraryPrecisionValue('45000000000'));
|
|
13
|
+
p.setTotalAccepted(new DecimalValueProto().setArbitraryPrecisionValue('44999500000'));
|
|
14
|
+
p.setPostAuctionOutstandingQuantity(new DecimalValueProto().setArbitraryPrecisionValue('44999500000'));
|
|
15
|
+
p.setMatureSecurityAmount(new DecimalValueProto().setArbitraryPrecisionValue('0'));
|
|
16
|
+
p.setPriceForSinglePriceAuction(new DecimalValueProto().setArbitraryPrecisionValue('99.875'));
|
|
17
|
+
p.setAuctionType(AuctionTypeProto.SINGLE_PRICE);
|
|
18
|
+
return p;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
test('Issuance typed accessors return wrapped values', () => {
|
|
22
|
+
const iss = new Issuance(buildProto());
|
|
23
|
+
expect(iss.getIssueDate()?.toString()).toBe('2023-2-15');
|
|
24
|
+
expect(iss.getAnnouncementDate()?.toString()).toBe('2023-2-8');
|
|
25
|
+
expect(iss.getOriginalFaceValue()?.toString()).toBe('45000000000');
|
|
26
|
+
expect(iss.getTotalAccepted()?.toString()).toBe('44999500000');
|
|
27
|
+
expect(iss.getPostAuctionOutstandingQuantity()?.toString()).toBe('44999500000');
|
|
28
|
+
expect(iss.getMatureSecurityAmount()?.toString()).toBe('0');
|
|
29
|
+
expect(iss.getPriceForSinglePriceAuction()?.toString()).toBe('99.875');
|
|
30
|
+
expect(iss.getAuctionType()).toBe(AuctionTypeProto.SINGLE_PRICE);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('Issuance returns null for unset sub-messages', () => {
|
|
34
|
+
const iss = new Issuance(new IssuanceProto());
|
|
35
|
+
expect(iss.getIssueDate()).toBeNull();
|
|
36
|
+
expect(iss.getAnnouncementDate()).toBeNull();
|
|
37
|
+
expect(iss.getOriginalFaceValue()).toBeNull();
|
|
38
|
+
expect(iss.getTotalAccepted()).toBeNull();
|
|
39
|
+
expect(iss.getPostAuctionOutstandingQuantity()).toBeNull();
|
|
40
|
+
expect(iss.getMatureSecurityAmount()).toBeNull();
|
|
41
|
+
expect(iss.getPriceForSinglePriceAuction()).toBeNull();
|
|
42
|
+
// enum defaults to zero value
|
|
43
|
+
expect(iss.getAuctionType()).toBe(AuctionTypeProto.UNKNOWN_AUCTION_TYPE);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('Issuance Decimal returns are Decimal instances (for math)', () => {
|
|
47
|
+
const iss = new Issuance(buildProto());
|
|
48
|
+
const faceValue = iss.getOriginalFaceValue();
|
|
49
|
+
expect(faceValue).toBeInstanceOf(Decimal);
|
|
50
|
+
// smoke: doing arithmetic should work
|
|
51
|
+
expect(faceValue!.plus(1).toString()).toBe('45000000001');
|
|
52
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { IssuanceProto } from "../../../fintekkers/models/security/bond/issuance_pb";
|
|
2
|
+
import { AuctionTypeProto } from "../../../fintekkers/models/security/bond/auction_type_pb";
|
|
3
|
+
import { DecimalValueProto } from "../../../fintekkers/models/util/decimal_value_pb";
|
|
4
|
+
import { LocalDateProto } from "../../../fintekkers/models/util/local_date_pb";
|
|
5
|
+
import { LocalDate } from "../utils/date";
|
|
6
|
+
import Decimal from "decimal.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Typed wrapper around a single IssuanceProto. Returns null for unset
|
|
10
|
+
* sub-messages and Decimal/LocalDate for populated ones — callers no longer
|
|
11
|
+
* have to spell out the proto / Decimal coercions at every call site.
|
|
12
|
+
*
|
|
13
|
+
* Note: IssuanceProto has no `dated_date` or `auction_date` field on the
|
|
14
|
+
* proto today, so those accessors are intentionally absent.
|
|
15
|
+
*/
|
|
16
|
+
class Issuance {
|
|
17
|
+
proto: IssuanceProto;
|
|
18
|
+
|
|
19
|
+
constructor(proto: IssuanceProto) {
|
|
20
|
+
this.proto = proto;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private static _toDecimal(value: DecimalValueProto | undefined): Decimal | null {
|
|
24
|
+
if (!value) return null;
|
|
25
|
+
return new Decimal(value.getArbitraryPrecisionValue());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private static _toLocalDate(value: LocalDateProto | undefined): LocalDate | null {
|
|
29
|
+
if (!value) return null;
|
|
30
|
+
return new LocalDate(value);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Auction issue (settlement) date. Null if unset. */
|
|
34
|
+
getIssueDate(): LocalDate | null {
|
|
35
|
+
return Issuance._toLocalDate(this.proto.getAuctionIssueDate());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Auction announcement date. Null if unset. */
|
|
39
|
+
getAnnouncementDate(): LocalDate | null {
|
|
40
|
+
return Issuance._toLocalDate(this.proto.getAuctionAnnouncementDate());
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Auction offering amount (original face value offered). Null if unset. */
|
|
44
|
+
getOriginalFaceValue(): Decimal | null {
|
|
45
|
+
return Issuance._toDecimal(this.proto.getAuctionOfferingAmount());
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Total quantity accepted at auction. Null if unset. */
|
|
49
|
+
getTotalAccepted(): Decimal | null {
|
|
50
|
+
return Issuance._toDecimal(this.proto.getTotalAccepted());
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Outstanding quantity after auction settles. Null if unset. */
|
|
54
|
+
getPostAuctionOutstandingQuantity(): Decimal | null {
|
|
55
|
+
return Issuance._toDecimal(this.proto.getPostAuctionOutstandingQuantity());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Quantity of the mature security used in reopenings. Null if unset. */
|
|
59
|
+
getMatureSecurityAmount(): Decimal | null {
|
|
60
|
+
return Issuance._toDecimal(this.proto.getMatureSecurityAmount());
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Single-price auction clearing price. Null if unset (e.g., multi-price). */
|
|
64
|
+
getPriceForSinglePriceAuction(): Decimal | null {
|
|
65
|
+
return Issuance._toDecimal(this.proto.getPriceForSinglePriceAuction());
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Auction type enum (defaults to UNKNOWN_AUCTION_TYPE if unset). */
|
|
69
|
+
getAuctionType(): AuctionTypeProto {
|
|
70
|
+
return this.proto.getAuctionType();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default Issuance;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import BondSecurity, { BondPricerInputs } from './BondSecurity';
|
|
2
|
+
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
3
|
+
import { IndexTypeProto } from '../../../fintekkers/models/security/index/index_type_pb';
|
|
4
|
+
import { LocalDate } from '../utils/date';
|
|
5
|
+
import { Decimal } from 'decimal.js';
|
|
6
|
+
/**
|
|
7
|
+
* TIPS-specific accessors layered on top of BondSecurity. The inflation
|
|
8
|
+
* fields live in the parallel tips_extension sub-message; bond_details
|
|
9
|
+
* (coupon, maturity, etc.) still carries the rest.
|
|
10
|
+
*/
|
|
11
|
+
declare class TIPSBond extends BondSecurity {
|
|
12
|
+
constructor(proto: SecurityProto);
|
|
13
|
+
private getTipsExtension;
|
|
14
|
+
/** Base CPI value at issue, used to scale inflation-adjusted principal. */
|
|
15
|
+
getBaseCpi(): Decimal | null;
|
|
16
|
+
/** Reference date for the base CPI fixing. */
|
|
17
|
+
getIndexDate(): LocalDate | null;
|
|
18
|
+
/** Which inflation index drives accruals (CPI_U on US TIPS). */
|
|
19
|
+
getInflationIndexType(): IndexTypeProto;
|
|
20
|
+
/**
|
|
21
|
+
* Build a fresh SecurityProto for a TIPS bond. product_type is set to
|
|
22
|
+
* TIPS so Security.create routes back to this wrapper.
|
|
23
|
+
*/
|
|
24
|
+
static fromPricerInputs(args: BondPricerInputs & {
|
|
25
|
+
baseCpi: Decimal;
|
|
26
|
+
indexDate: LocalDate;
|
|
27
|
+
inflationIndexType: IndexTypeProto;
|
|
28
|
+
}): SecurityProto;
|
|
29
|
+
}
|
|
30
|
+
export default TIPSBond;
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const BondSecurity_1 = __importStar(require("./BondSecurity"));
|
|
27
|
+
const security_pb_1 = require("../../../fintekkers/models/security/security_pb");
|
|
28
|
+
const product_type_pb_1 = require("../../../fintekkers/models/security/product_type_pb");
|
|
29
|
+
const index_type_pb_1 = require("../../../fintekkers/models/security/index/index_type_pb");
|
|
30
|
+
const date_1 = require("../utils/date");
|
|
31
|
+
const decimal_js_1 = require("decimal.js");
|
|
32
|
+
/**
|
|
33
|
+
* TIPS-specific accessors layered on top of BondSecurity. The inflation
|
|
34
|
+
* fields live in the parallel tips_extension sub-message; bond_details
|
|
35
|
+
* (coupon, maturity, etc.) still carries the rest.
|
|
36
|
+
*/
|
|
37
|
+
class TIPSBond extends BondSecurity_1.default {
|
|
38
|
+
constructor(proto) {
|
|
39
|
+
super(proto);
|
|
40
|
+
}
|
|
41
|
+
getTipsExtension() {
|
|
42
|
+
var _a;
|
|
43
|
+
return (_a = this.proto.getTipsExtension()) !== null && _a !== void 0 ? _a : undefined;
|
|
44
|
+
}
|
|
45
|
+
/** Base CPI value at issue, used to scale inflation-adjusted principal. */
|
|
46
|
+
getBaseCpi() {
|
|
47
|
+
const ext = this.getTipsExtension();
|
|
48
|
+
const v = ext ? ext.getBaseCpi() : undefined;
|
|
49
|
+
if (!v)
|
|
50
|
+
return null;
|
|
51
|
+
return new decimal_js_1.Decimal(v.getArbitraryPrecisionValue());
|
|
52
|
+
}
|
|
53
|
+
/** Reference date for the base CPI fixing. */
|
|
54
|
+
getIndexDate() {
|
|
55
|
+
const ext = this.getTipsExtension();
|
|
56
|
+
const d = ext ? ext.getIndexDate() : undefined;
|
|
57
|
+
if (!d)
|
|
58
|
+
return null;
|
|
59
|
+
return new date_1.LocalDate(d);
|
|
60
|
+
}
|
|
61
|
+
/** Which inflation index drives accruals (CPI_U on US TIPS). */
|
|
62
|
+
getInflationIndexType() {
|
|
63
|
+
const ext = this.getTipsExtension();
|
|
64
|
+
return ext ? ext.getInflationIndexType() : index_type_pb_1.IndexTypeProto.UNKNOWN_INDEX_TYPE;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Build a fresh SecurityProto for a TIPS bond. product_type is set to
|
|
68
|
+
* TIPS so Security.create routes back to this wrapper.
|
|
69
|
+
*/
|
|
70
|
+
static fromPricerInputs(args) {
|
|
71
|
+
const bond = (0, BondSecurity_1.buildBondDetails)(args);
|
|
72
|
+
const tips = new security_pb_1.TipsExtensionProto()
|
|
73
|
+
.setBaseCpi((0, BondSecurity_1.decimalToProto)(args.baseCpi))
|
|
74
|
+
.setIndexDate((0, BondSecurity_1.localDateToProto)(args.indexDate))
|
|
75
|
+
.setInflationIndexType(args.inflationIndexType);
|
|
76
|
+
return new security_pb_1.SecurityProto()
|
|
77
|
+
.setProductType(product_type_pb_1.ProductTypeProto.TIPS)
|
|
78
|
+
.setBondDetails(bond)
|
|
79
|
+
.setTipsExtension(tips);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.default = TIPSBond;
|
|
83
|
+
//# sourceMappingURL=TIPSBond.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TIPSBond.js","sourceRoot":"","sources":["TIPSBond.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAKwB;AACxB,iFAAoG;AACpG,yFAAuF;AACvF,2FAAyF;AACzF,wCAA0C;AAC1C,2CAAqC;AAErC;;;;GAIG;AACH,MAAM,QAAS,SAAQ,sBAAY;IACjC,YAAY,KAAoB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAEO,gBAAgB;;QACtB,OAAO,MAAA,IAA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AClD,OAAO,IAAI,2BAAa,EAAE;aACvB,cAAc,CAAC,kCAAgB,CAAC,IAAI,CAAC;aACrC,cAAc,CAAC,IAAI,CAAC;aACpB,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF;AAED,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import BondSecurity, {
|
|
2
|
+
BondPricerInputs,
|
|
3
|
+
buildBondDetails,
|
|
4
|
+
decimalToProto,
|
|
5
|
+
localDateToProto,
|
|
6
|
+
} from './BondSecurity';
|
|
7
|
+
import { SecurityProto, TipsExtensionProto } from '../../../fintekkers/models/security/security_pb';
|
|
8
|
+
import { ProductTypeProto } from '../../../fintekkers/models/security/product_type_pb';
|
|
9
|
+
import { IndexTypeProto } from '../../../fintekkers/models/security/index/index_type_pb';
|
|
10
|
+
import { LocalDate } from '../utils/date';
|
|
11
|
+
import { Decimal } from 'decimal.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* TIPS-specific accessors layered on top of BondSecurity. The inflation
|
|
15
|
+
* fields live in the parallel tips_extension sub-message; bond_details
|
|
16
|
+
* (coupon, maturity, etc.) still carries the rest.
|
|
17
|
+
*/
|
|
18
|
+
class TIPSBond extends BondSecurity {
|
|
19
|
+
constructor(proto: SecurityProto) {
|
|
20
|
+
super(proto);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private getTipsExtension(): TipsExtensionProto | undefined {
|
|
24
|
+
return this.proto.getTipsExtension() ?? undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Base CPI value at issue, used to scale inflation-adjusted principal. */
|
|
28
|
+
getBaseCpi(): Decimal | null {
|
|
29
|
+
const ext = this.getTipsExtension();
|
|
30
|
+
const v = ext ? ext.getBaseCpi() : undefined;
|
|
31
|
+
if (!v) return null;
|
|
32
|
+
return new Decimal(v.getArbitraryPrecisionValue());
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Reference date for the base CPI fixing. */
|
|
36
|
+
getIndexDate(): LocalDate | null {
|
|
37
|
+
const ext = this.getTipsExtension();
|
|
38
|
+
const d = ext ? ext.getIndexDate() : undefined;
|
|
39
|
+
if (!d) return null;
|
|
40
|
+
return new LocalDate(d);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Which inflation index drives accruals (CPI_U on US TIPS). */
|
|
44
|
+
getInflationIndexType(): IndexTypeProto {
|
|
45
|
+
const ext = this.getTipsExtension();
|
|
46
|
+
return ext ? ext.getInflationIndexType() : IndexTypeProto.UNKNOWN_INDEX_TYPE;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Build a fresh SecurityProto for a TIPS bond. product_type is set to
|
|
51
|
+
* TIPS so Security.create routes back to this wrapper.
|
|
52
|
+
*/
|
|
53
|
+
static fromPricerInputs(args: BondPricerInputs & {
|
|
54
|
+
baseCpi: Decimal;
|
|
55
|
+
indexDate: LocalDate;
|
|
56
|
+
inflationIndexType: IndexTypeProto;
|
|
57
|
+
}): SecurityProto {
|
|
58
|
+
const bond = buildBondDetails(args);
|
|
59
|
+
const tips = new TipsExtensionProto()
|
|
60
|
+
.setBaseCpi(decimalToProto(args.baseCpi))
|
|
61
|
+
.setIndexDate(localDateToProto(args.indexDate))
|
|
62
|
+
.setInflationIndexType(args.inflationIndexType);
|
|
63
|
+
return new SecurityProto()
|
|
64
|
+
.setProductType(ProductTypeProto.TIPS)
|
|
65
|
+
.setBondDetails(bond)
|
|
66
|
+
.setTipsExtension(tips);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default TIPSBond;
|