@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.
Files changed (82) hide show
  1. package/node/fintekkers/models/security/security_pb.d.ts +0 -80
  2. package/node/fintekkers/models/security/security_pb.js +1 -723
  3. package/node/fintekkers/models/security/security_pb.test.js +15 -15
  4. package/node/fintekkers/models/security/security_pb.test.js.map +1 -1
  5. package/node/fintekkers/models/security/security_pb.test.ts +17 -18
  6. package/node/wrappers/models/price/Price.cash.test.js +1 -1
  7. package/node/wrappers/models/price/Price.cash.test.js.map +1 -1
  8. package/node/wrappers/models/price/Price.cash.test.ts +2 -2
  9. package/node/wrappers/models/security/BondSecurity.d.ts +41 -3
  10. package/node/wrappers/models/security/BondSecurity.fromPricerInputs.test.d.ts +1 -0
  11. package/node/wrappers/models/security/BondSecurity.fromPricerInputs.test.js +75 -0
  12. package/node/wrappers/models/security/BondSecurity.fromPricerInputs.test.js.map +1 -0
  13. package/node/wrappers/models/security/BondSecurity.fromPricerInputs.test.ts +95 -0
  14. package/node/wrappers/models/security/BondSecurity.js +57 -9
  15. package/node/wrappers/models/security/BondSecurity.js.map +1 -1
  16. package/node/wrappers/models/security/BondSecurity.priceScale.test.js +5 -3
  17. package/node/wrappers/models/security/BondSecurity.priceScale.test.js.map +1 -1
  18. package/node/wrappers/models/security/BondSecurity.priceScale.test.ts +7 -5
  19. package/node/wrappers/models/security/BondSecurity.test.js +28 -20
  20. package/node/wrappers/models/security/BondSecurity.test.js.map +1 -1
  21. package/node/wrappers/models/security/BondSecurity.test.ts +29 -21
  22. package/node/wrappers/models/security/BondSecurity.ts +72 -10
  23. package/node/wrappers/models/security/FloatingRateNote.d.ts +30 -0
  24. package/node/wrappers/models/security/FloatingRateNote.js +80 -0
  25. package/node/wrappers/models/security/FloatingRateNote.js.map +1 -0
  26. package/node/wrappers/models/security/FloatingRateNote.ts +67 -0
  27. package/node/wrappers/models/security/IndexSecurity.d.ts +16 -0
  28. package/node/wrappers/models/security/IndexSecurity.js +26 -0
  29. package/node/wrappers/models/security/IndexSecurity.js.map +1 -0
  30. package/node/wrappers/models/security/IndexSecurity.test.d.ts +1 -0
  31. package/node/wrappers/models/security/IndexSecurity.test.js +60 -0
  32. package/node/wrappers/models/security/IndexSecurity.test.js.map +1 -0
  33. package/node/wrappers/models/security/IndexSecurity.test.ts +60 -0
  34. package/node/wrappers/models/security/IndexSecurity.ts +24 -0
  35. package/node/wrappers/models/security/Issuance.d.ts +35 -0
  36. package/node/wrappers/models/security/Issuance.js +64 -0
  37. package/node/wrappers/models/security/Issuance.js.map +1 -0
  38. package/node/wrappers/models/security/Issuance.test.d.ts +1 -0
  39. package/node/wrappers/models/security/Issuance.test.js +55 -0
  40. package/node/wrappers/models/security/Issuance.test.js.map +1 -0
  41. package/node/wrappers/models/security/Issuance.test.ts +52 -0
  42. package/node/wrappers/models/security/Issuance.ts +74 -0
  43. package/node/wrappers/models/security/TIPSBond.d.ts +30 -0
  44. package/node/wrappers/models/security/TIPSBond.js +83 -0
  45. package/node/wrappers/models/security/TIPSBond.js.map +1 -0
  46. package/node/wrappers/models/security/TIPSBond.ts +70 -0
  47. package/node/wrappers/models/security/security-roundtrip.test.js +77 -61
  48. package/node/wrappers/models/security/security-roundtrip.test.js.map +1 -1
  49. package/node/wrappers/models/security/security-roundtrip.test.ts +78 -62
  50. package/node/wrappers/models/security/security.d.ts +21 -6
  51. package/node/wrappers/models/security/security.identifiers.test.d.ts +1 -0
  52. package/node/wrappers/models/security/security.identifiers.test.js +67 -0
  53. package/node/wrappers/models/security/security.identifiers.test.js.map +1 -0
  54. package/node/wrappers/models/security/security.identifiers.test.ts +67 -0
  55. package/node/wrappers/models/security/security.js +72 -29
  56. package/node/wrappers/models/security/security.js.map +1 -1
  57. package/node/wrappers/models/security/security.test.js +16 -12
  58. package/node/wrappers/models/security/security.test.js.map +1 -1
  59. package/node/wrappers/models/security/security.test.ts +17 -15
  60. package/node/wrappers/models/security/security.ts +75 -29
  61. package/node/wrappers/models/transaction/transaction.derived.test.js +8 -6
  62. package/node/wrappers/models/transaction/transaction.derived.test.js.map +1 -1
  63. package/node/wrappers/models/transaction/transaction.derived.test.ts +9 -7
  64. package/node/wrappers/models/transaction/transaction.js +4 -2
  65. package/node/wrappers/models/transaction/transaction.js.map +1 -1
  66. package/node/wrappers/models/transaction/transaction.ts +4 -2
  67. package/node/wrappers/models/transaction/transaction_constructor.test.js +8 -6
  68. package/node/wrappers/models/transaction/transaction_constructor.test.js.map +1 -1
  69. package/node/wrappers/models/transaction/transaction_constructor.test.ts +9 -7
  70. package/node/wrappers/services/searchWithSecurities.test.js +2 -2
  71. package/node/wrappers/services/searchWithSecurities.test.js.map +1 -1
  72. package/node/wrappers/services/searchWithSecurities.test.ts +2 -2
  73. package/node/wrappers/services/security-service/security.maturityLadder.test.js +5 -3
  74. package/node/wrappers/services/security-service/security.maturityLadder.test.js.map +1 -1
  75. package/node/wrappers/services/security-service/security.maturityLadder.test.ts +5 -3
  76. package/node/wrappers/services/security-service/security.test.js +10 -8
  77. package/node/wrappers/services/security-service/security.test.js.map +1 -1
  78. package/node/wrappers/services/security-service/security.test.ts +12 -9
  79. package/node/wrappers/util/link-resolver.test.js +1 -1
  80. package/node/wrappers/util/link-resolver.test.js.map +1 -1
  81. package/node/wrappers/util/link-resolver.test.ts +1 -1
  82. package/package.json +1 -1
@@ -32,12 +32,14 @@ function testBondSecurityCreation() {
32
32
  securityProto.setProductType(product_type_pb_1.ProductTypeProto.TREASURY_NOTE);
33
33
  securityProto.setAssetClass('FixedIncome');
34
34
  securityProto.setIssuerName('Test Issuer');
35
- securityProto.setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED);
36
- securityProto.setCouponFrequency(coupon_frequency_pb_1.CouponFrequencyProto.SEMIANNUALLY);
37
- securityProto.setCouponRate(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('0.05'));
38
- securityProto.setFaceValue(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
39
- securityProto.setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(1));
40
- securityProto.setMaturityDate(new local_date_pb_1.LocalDateProto().setYear(2031).setMonth(1).setDay(1));
35
+ const bond = new security_pb_1.BondDetailsProto();
36
+ bond.setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED);
37
+ bond.setCouponFrequency(coupon_frequency_pb_1.CouponFrequencyProto.SEMIANNUALLY);
38
+ bond.setCouponRate(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('0.05'));
39
+ bond.setFaceValue(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
40
+ bond.setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(1));
41
+ bond.setMaturityDate(new local_date_pb_1.LocalDateProto().setYear(2031).setMonth(1).setDay(1));
42
+ securityProto.setBondDetails(bond);
41
43
  securityProto.setDescription('Test Bond Security');
42
44
  // Call Security.create and validate it returns a BondSecurity
43
45
  const security = security_1.default.create(securityProto);
@@ -60,14 +62,16 @@ function testBondSecurityTenor() {
60
62
  securityProto.setProductType(product_type_pb_1.ProductTypeProto.TREASURY_NOTE);
61
63
  securityProto.setAssetClass('FixedIncome');
62
64
  securityProto.setIssuerName('Test Issuer');
63
- securityProto.setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED);
64
- securityProto.setCouponFrequency(coupon_frequency_pb_1.CouponFrequencyProto.SEMIANNUALLY);
65
- securityProto.setCouponRate(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('0.05'));
66
- securityProto.setFaceValue(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
65
+ const bond = new security_pb_1.BondDetailsProto();
66
+ bond.setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED);
67
+ bond.setCouponFrequency(coupon_frequency_pb_1.CouponFrequencyProto.SEMIANNUALLY);
68
+ bond.setCouponRate(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('0.05'));
69
+ bond.setFaceValue(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
67
70
  // Set issue date: January 1, 2021
68
- securityProto.setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(1));
71
+ bond.setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(1));
69
72
  // Set maturity date: January 1, 2031 (exactly 10 years later)
70
- securityProto.setMaturityDate(new local_date_pb_1.LocalDateProto().setYear(2031).setMonth(1).setDay(1));
73
+ bond.setMaturityDate(new local_date_pb_1.LocalDateProto().setYear(2031).setMonth(1).setDay(1));
74
+ securityProto.setBondDetails(bond);
71
75
  securityProto.setDescription('Test 10-Year Bond Security');
72
76
  // Create BondSecurity
73
77
  const security = security_1.default.create(securityProto);
@@ -98,14 +102,16 @@ function testBondSecurityTenor() {
98
102
  securityProto2.setProductType(product_type_pb_1.ProductTypeProto.TREASURY_NOTE);
99
103
  securityProto2.setAssetClass('FixedIncome');
100
104
  securityProto2.setIssuerName('Test Issuer');
101
- securityProto2.setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED);
102
- securityProto2.setCouponFrequency(coupon_frequency_pb_1.CouponFrequencyProto.SEMIANNUALLY);
103
- securityProto2.setCouponRate(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('0.05'));
104
- securityProto2.setFaceValue(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
105
+ const bond2 = new security_pb_1.BondDetailsProto();
106
+ bond2.setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED);
107
+ bond2.setCouponFrequency(coupon_frequency_pb_1.CouponFrequencyProto.SEMIANNUALLY);
108
+ bond2.setCouponRate(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('0.05'));
109
+ bond2.setFaceValue(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
105
110
  // Set issue date: January 15, 2021
106
- securityProto2.setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(15));
111
+ bond2.setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(15));
107
112
  // Set maturity date: July 20, 2023 (2 years, 6 months, 5 days)
108
- securityProto2.setMaturityDate(new local_date_pb_1.LocalDateProto().setYear(2023).setMonth(7).setDay(20));
113
+ bond2.setMaturityDate(new local_date_pb_1.LocalDateProto().setYear(2023).setMonth(7).setDay(20));
114
+ securityProto2.setBondDetails(bond2);
109
115
  securityProto2.setDescription('Test Bond with Months and Days');
110
116
  const bondSecurity2 = security_1.default.create(securityProto2);
111
117
  const tenor2 = bondSecurity2.getTenor();
@@ -123,9 +129,11 @@ function testBondSecurityTenorWithAsOfDate() {
123
129
  // Create a SecurityProto with BOND_SECURITY type and dates for a 10-year bond
124
130
  const securityProto = new security_pb_1.SecurityProto();
125
131
  securityProto.setProductType(product_type_pb_1.ProductTypeProto.TREASURY_NOTE);
126
- securityProto.setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(1));
132
+ const bond3 = new security_pb_1.BondDetailsProto();
133
+ bond3.setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(1));
127
134
  // Set maturity date: January 1, 2031 (exactly 10 years later)
128
- securityProto.setMaturityDate(new local_date_pb_1.LocalDateProto().setYear(2031).setMonth(1).setDay(1));
135
+ bond3.setMaturityDate(new local_date_pb_1.LocalDateProto().setYear(2031).setMonth(1).setDay(1));
136
+ securityProto.setBondDetails(bond3);
129
137
  // Create BondSecurity
130
138
  const security = security_1.default.create(securityProto);
131
139
  const bondSecurity = security;
@@ -1 +1 @@
1
- {"version":3,"file":"BondSecurity.test.js","sourceRoot":"","sources":["BondSecurity.test.ts"],"names":[],"mappings":";;;;;AAAA,iCAAkC;AAClC,0DAAkC;AAClC,kEAA0C;AAC1C,iFAAgF;AAChF,yFA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AM,WAAW,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IACrC,MAAM,CAAC,WAAW,KAAK,UAAU,EAAE,6BAA6B,WAAW,GAAG,CAAC,CAAC;AACpF,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import assert = require('assert');
2
2
  import Security from './security';
3
3
  import BondSecurity from './BondSecurity';
4
- import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
4
+ import { SecurityProto, BondDetailsProto } from '../../../fintekkers/models/security/security_pb';
5
5
  import { ProductTypeProto } from "../../../fintekkers/models/security/product_type_pb";
6
6
  import { CouponTypeProto } from '../../../fintekkers/models/security/coupon_type_pb';
7
7
  import { CouponFrequencyProto } from '../../../fintekkers/models/security/coupon_frequency_pb';
@@ -32,12 +32,14 @@ function testBondSecurityCreation(): void {
32
32
  securityProto.setProductType(ProductTypeProto.TREASURY_NOTE);
33
33
  securityProto.setAssetClass('FixedIncome');
34
34
  securityProto.setIssuerName('Test Issuer');
35
- securityProto.setCouponType(CouponTypeProto.FIXED);
36
- securityProto.setCouponFrequency(CouponFrequencyProto.SEMIANNUALLY);
37
- securityProto.setCouponRate(new DecimalValueProto().setArbitraryPrecisionValue('0.05'));
38
- securityProto.setFaceValue(new DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
39
- securityProto.setIssueDate(new LocalDateProto().setYear(2021).setMonth(1).setDay(1));
40
- securityProto.setMaturityDate(new LocalDateProto().setYear(2031).setMonth(1).setDay(1));
35
+ const bond = new BondDetailsProto();
36
+ bond.setCouponType(CouponTypeProto.FIXED);
37
+ bond.setCouponFrequency(CouponFrequencyProto.SEMIANNUALLY);
38
+ bond.setCouponRate(new DecimalValueProto().setArbitraryPrecisionValue('0.05'));
39
+ bond.setFaceValue(new DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
40
+ bond.setIssueDate(new LocalDateProto().setYear(2021).setMonth(1).setDay(1));
41
+ bond.setMaturityDate(new LocalDateProto().setYear(2031).setMonth(1).setDay(1));
42
+ securityProto.setBondDetails(bond);
41
43
  securityProto.setDescription('Test Bond Security');
42
44
 
43
45
  // Call Security.create and validate it returns a BondSecurity
@@ -65,15 +67,17 @@ function testBondSecurityTenor(): void {
65
67
  securityProto.setProductType(ProductTypeProto.TREASURY_NOTE);
66
68
  securityProto.setAssetClass('FixedIncome');
67
69
  securityProto.setIssuerName('Test Issuer');
68
- securityProto.setCouponType(CouponTypeProto.FIXED);
69
- securityProto.setCouponFrequency(CouponFrequencyProto.SEMIANNUALLY);
70
- securityProto.setCouponRate(new DecimalValueProto().setArbitraryPrecisionValue('0.05'));
71
- securityProto.setFaceValue(new DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
70
+ const bond = new BondDetailsProto();
71
+ bond.setCouponType(CouponTypeProto.FIXED);
72
+ bond.setCouponFrequency(CouponFrequencyProto.SEMIANNUALLY);
73
+ bond.setCouponRate(new DecimalValueProto().setArbitraryPrecisionValue('0.05'));
74
+ bond.setFaceValue(new DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
72
75
 
73
76
  // Set issue date: January 1, 2021
74
- securityProto.setIssueDate(new LocalDateProto().setYear(2021).setMonth(1).setDay(1));
77
+ bond.setIssueDate(new LocalDateProto().setYear(2021).setMonth(1).setDay(1));
75
78
  // Set maturity date: January 1, 2031 (exactly 10 years later)
76
- securityProto.setMaturityDate(new LocalDateProto().setYear(2031).setMonth(1).setDay(1));
79
+ bond.setMaturityDate(new LocalDateProto().setYear(2031).setMonth(1).setDay(1));
80
+ securityProto.setBondDetails(bond);
77
81
  securityProto.setDescription('Test 10-Year Bond Security');
78
82
 
79
83
  // Create BondSecurity
@@ -110,15 +114,17 @@ function testBondSecurityTenor(): void {
110
114
  securityProto2.setProductType(ProductTypeProto.TREASURY_NOTE);
111
115
  securityProto2.setAssetClass('FixedIncome');
112
116
  securityProto2.setIssuerName('Test Issuer');
113
- securityProto2.setCouponType(CouponTypeProto.FIXED);
114
- securityProto2.setCouponFrequency(CouponFrequencyProto.SEMIANNUALLY);
115
- securityProto2.setCouponRate(new DecimalValueProto().setArbitraryPrecisionValue('0.05'));
116
- securityProto2.setFaceValue(new DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
117
+ const bond2 = new BondDetailsProto();
118
+ bond2.setCouponType(CouponTypeProto.FIXED);
119
+ bond2.setCouponFrequency(CouponFrequencyProto.SEMIANNUALLY);
120
+ bond2.setCouponRate(new DecimalValueProto().setArbitraryPrecisionValue('0.05'));
121
+ bond2.setFaceValue(new DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
117
122
 
118
123
  // Set issue date: January 15, 2021
119
- securityProto2.setIssueDate(new LocalDateProto().setYear(2021).setMonth(1).setDay(15));
124
+ bond2.setIssueDate(new LocalDateProto().setYear(2021).setMonth(1).setDay(15));
120
125
  // Set maturity date: July 20, 2023 (2 years, 6 months, 5 days)
121
- securityProto2.setMaturityDate(new LocalDateProto().setYear(2023).setMonth(7).setDay(20));
126
+ bond2.setMaturityDate(new LocalDateProto().setYear(2023).setMonth(7).setDay(20));
127
+ securityProto2.setBondDetails(bond2);
122
128
  securityProto2.setDescription('Test Bond with Months and Days');
123
129
 
124
130
  const bondSecurity2 = Security.create(securityProto2) as BondSecurity;
@@ -141,9 +147,11 @@ function testBondSecurityTenorWithAsOfDate(): void {
141
147
  const securityProto = new SecurityProto();
142
148
 
143
149
  securityProto.setProductType(ProductTypeProto.TREASURY_NOTE);
144
- securityProto.setIssueDate(new LocalDateProto().setYear(2021).setMonth(1).setDay(1));
150
+ const bond3 = new BondDetailsProto();
151
+ bond3.setIssueDate(new LocalDateProto().setYear(2021).setMonth(1).setDay(1));
145
152
  // Set maturity date: January 1, 2031 (exactly 10 years later)
146
- securityProto.setMaturityDate(new LocalDateProto().setYear(2031).setMonth(1).setDay(1));
153
+ bond3.setMaturityDate(new LocalDateProto().setYear(2031).setMonth(1).setDay(1));
154
+ securityProto.setBondDetails(bond3);
147
155
 
148
156
  // Create BondSecurity
149
157
  const security = Security.create(securityProto);
@@ -1,15 +1,60 @@
1
1
  import Security from './security';
2
- import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
2
+ import { SecurityProto, BondDetailsProto } from '../../../fintekkers/models/security/security_pb';
3
3
  import { ProductTypeProto } from "../../../fintekkers/models/security/product_type_pb";
4
4
  import { DecimalValueProto } from '../../../fintekkers/models/util/decimal_value_pb';
5
+ import { LocalDateProto } from '../../../fintekkers/models/util/local_date_pb';
5
6
  import { LocalDate } from '../utils/date';
6
7
  import { IssuanceProto } from '../../../fintekkers/models/security/bond/issuance_pb';
7
8
  import { CouponFrequency } from './coupon_frequency';
8
9
  import { CouponType } from './coupon_type';
9
10
  import { Tenor, Period } from './term';
10
11
  import { TenorTypeProto } from '../../../fintekkers/models/security/tenor_type_pb';
12
+ import { CouponTypeProto } from '../../../fintekkers/models/security/coupon_type_pb';
13
+ import { CouponFrequencyProto } from '../../../fintekkers/models/security/coupon_frequency_pb';
11
14
  import { Decimal } from 'decimal.js';
12
15
  import { isDescendantOf } from './product_hierarchy';
16
+ import Issuance from './Issuance';
17
+
18
+ /**
19
+ * Inputs required to mint a SecurityProto for the bond pricer. Shared by
20
+ * BondSecurity / TIPSBond / FloatingRateNote builders.
21
+ */
22
+ export interface BondPricerInputs {
23
+ faceValue: Decimal;
24
+ couponRate: Decimal;
25
+ couponType: CouponTypeProto;
26
+ couponFrequency: CouponFrequencyProto;
27
+ issueDate: LocalDate;
28
+ maturityDate: LocalDate;
29
+ }
30
+
31
+ /**
32
+ * Build a LocalDateProto from a LocalDate wrapper. Exported so subclass
33
+ * builders (TIPSBond, FloatingRateNote) can re-use it without poking at
34
+ * LocalDate's proto privately.
35
+ */
36
+ export function localDateToProto(d: LocalDate): LocalDateProto {
37
+ return d.toProto();
38
+ }
39
+
40
+ /** Build a DecimalValueProto from a Decimal. */
41
+ export function decimalToProto(v: Decimal): DecimalValueProto {
42
+ return new DecimalValueProto().setArbitraryPrecisionValue(v.toString());
43
+ }
44
+
45
+ /**
46
+ * Build a populated BondDetailsProto from BondPricerInputs. Shared helper
47
+ * so the three pricer-input builders stay in sync.
48
+ */
49
+ export function buildBondDetails(args: BondPricerInputs): BondDetailsProto {
50
+ return new BondDetailsProto()
51
+ .setFaceValue(decimalToProto(args.faceValue))
52
+ .setCouponRate(decimalToProto(args.couponRate))
53
+ .setCouponType(args.couponType)
54
+ .setCouponFrequency(args.couponFrequency)
55
+ .setIssueDate(localDateToProto(args.issueDate))
56
+ .setMaturityDate(localDateToProto(args.maturityDate));
57
+ }
13
58
 
14
59
  class BondSecurity extends Security {
15
60
  constructor(proto: SecurityProto) {
@@ -77,41 +122,58 @@ class BondSecurity extends Security {
77
122
 
78
123
  getCouponRate(): DecimalValueProto {
79
124
  const bond = this.getBondLikeDetails();
80
- const rate = bond ? bond.getCouponRate() : this.proto.getCouponRate();
125
+ const rate = bond ? bond.getCouponRate() : undefined;
81
126
  if (!rate) throw new Error("Coupon rate is required for bonds");
82
127
  return rate;
83
128
  }
84
129
 
85
130
  getFaceValue(): DecimalValueProto {
86
131
  const bond = this.getBondLikeDetails();
87
- const faceValue = bond ? bond.getFaceValue() : this.proto.getFaceValue();
132
+ const faceValue = bond ? bond.getFaceValue() : undefined;
88
133
  if (!faceValue) throw new Error("Face value is required for bonds");
89
134
  return faceValue;
90
135
  }
91
136
 
92
137
  getCouponType(): CouponType {
93
138
  const bond = this.getBondLikeDetails();
94
- const couponType = bond ? bond.getCouponType() : this.proto.getCouponType();
95
- if (!couponType) throw new Error("Coupon Type is required for bonds");
139
+ const couponType = bond ? bond.getCouponType() : undefined;
140
+ if (couponType === undefined) throw new Error("Coupon Type is required for bonds");
96
141
  return new CouponType(couponType);
97
142
  }
98
143
 
99
144
  getCouponFrequency(): CouponFrequency {
100
145
  const bond = this.getBondLikeDetails();
101
- const couponFrequency = bond ? bond.getCouponFrequency() : this.proto.getCouponFrequency();
102
- if (!couponFrequency) throw new Error("Coupon Frequency is required for bonds");
146
+ const couponFrequency = bond ? bond.getCouponFrequency() : undefined;
147
+ if (couponFrequency === undefined) throw new Error("Coupon Frequency is required for bonds");
103
148
  return new CouponFrequency(couponFrequency);
104
149
  }
105
150
 
106
151
  getDatedDate(): LocalDate | undefined {
107
152
  const bond = this.getBondLikeDetails();
108
- const datedDate = bond ? bond.getDatedDate() : this.proto.getDatedDate();
153
+ const datedDate = bond ? bond.getDatedDate() : undefined;
109
154
  return datedDate ? new LocalDate(datedDate) : undefined;
110
155
  }
111
156
 
112
- getIssuanceInfo(): IssuanceProto[] {
157
+ /**
158
+ * Returns every auction/reopening record on this bond as typed Issuance
159
+ * wrappers. Empty list if bond_details is unset or has no issuances.
160
+ */
161
+ getIssuances(): Issuance[] {
113
162
  const bond = this.getBondLikeDetails();
114
- return bond ? bond.getIssuanceInfoList() : this.proto.getIssuanceInfoList();
163
+ const list: IssuanceProto[] = bond ? bond.getIssuanceInfoList() : [];
164
+ return list.map(p => new Issuance(p));
165
+ }
166
+
167
+ /**
168
+ * Build a fresh SecurityProto for a vanilla treasury note from pricer
169
+ * inputs. Use TIPSBond.fromPricerInputs / FloatingRateNote.fromPricerInputs
170
+ * for the inflation-linked / floating variants.
171
+ */
172
+ static fromPricerInputs(args: BondPricerInputs): SecurityProto {
173
+ const bond = buildBondDetails(args);
174
+ return new SecurityProto()
175
+ .setProductType(ProductTypeProto.TREASURY_NOTE)
176
+ .setBondDetails(bond);
115
177
  }
116
178
 
117
179
  /**
@@ -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 { CouponFrequencyProto } from '../../../fintekkers/models/security/coupon_frequency_pb';
5
+ import { Decimal } from 'decimal.js';
6
+ /**
7
+ * FRN-specific accessors layered on top of BondSecurity. The floating-rate
8
+ * fields live in the parallel frn_extension sub-message; bond_details
9
+ * still carries face value / dates / etc.
10
+ */
11
+ declare class FloatingRateNote extends BondSecurity {
12
+ constructor(proto: SecurityProto);
13
+ private getFrnExtension;
14
+ /** Spread added on top of the reference rate at each reset. */
15
+ getSpread(): Decimal | null;
16
+ /** Which index the coupon resets off (SOFR on a US TREASURY_FRN). */
17
+ getReferenceRateIndex(): IndexTypeProto;
18
+ /** Reset cadence (e.g. QUARTERLY). */
19
+ getResetFrequency(): CouponFrequencyProto;
20
+ /**
21
+ * Build a fresh SecurityProto for a floating-rate note. product_type is
22
+ * set to TREASURY_FRN so Security.create routes back to this wrapper.
23
+ */
24
+ static fromPricerInputs(args: BondPricerInputs & {
25
+ spread: Decimal;
26
+ referenceRateIndex: IndexTypeProto;
27
+ resetFrequency: CouponFrequencyProto;
28
+ }): SecurityProto;
29
+ }
30
+ export default FloatingRateNote;
@@ -0,0 +1,80 @@
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 coupon_frequency_pb_1 = require("../../../fintekkers/models/security/coupon_frequency_pb");
31
+ const decimal_js_1 = require("decimal.js");
32
+ /**
33
+ * FRN-specific accessors layered on top of BondSecurity. The floating-rate
34
+ * fields live in the parallel frn_extension sub-message; bond_details
35
+ * still carries face value / dates / etc.
36
+ */
37
+ class FloatingRateNote extends BondSecurity_1.default {
38
+ constructor(proto) {
39
+ super(proto);
40
+ }
41
+ getFrnExtension() {
42
+ var _a;
43
+ return (_a = this.proto.getFrnExtension()) !== null && _a !== void 0 ? _a : undefined;
44
+ }
45
+ /** Spread added on top of the reference rate at each reset. */
46
+ getSpread() {
47
+ const ext = this.getFrnExtension();
48
+ const v = ext ? ext.getSpread() : undefined;
49
+ if (!v)
50
+ return null;
51
+ return new decimal_js_1.Decimal(v.getArbitraryPrecisionValue());
52
+ }
53
+ /** Which index the coupon resets off (SOFR on a US TREASURY_FRN). */
54
+ getReferenceRateIndex() {
55
+ const ext = this.getFrnExtension();
56
+ return ext ? ext.getReferenceRateIndex() : index_type_pb_1.IndexTypeProto.UNKNOWN_INDEX_TYPE;
57
+ }
58
+ /** Reset cadence (e.g. QUARTERLY). */
59
+ getResetFrequency() {
60
+ const ext = this.getFrnExtension();
61
+ return ext ? ext.getResetFrequency() : coupon_frequency_pb_1.CouponFrequencyProto.UNKNOWN_COUPON_FREQUENCY;
62
+ }
63
+ /**
64
+ * Build a fresh SecurityProto for a floating-rate note. product_type is
65
+ * set to TREASURY_FRN so Security.create routes back to this wrapper.
66
+ */
67
+ static fromPricerInputs(args) {
68
+ const bond = (0, BondSecurity_1.buildBondDetails)(args);
69
+ const frn = new security_pb_1.FrnExtensionProto()
70
+ .setSpread((0, BondSecurity_1.decimalToProto)(args.spread))
71
+ .setReferenceRateIndex(args.referenceRateIndex)
72
+ .setResetFrequency(args.resetFrequency);
73
+ return new security_pb_1.SecurityProto()
74
+ .setProductType(product_type_pb_1.ProductTypeProto.TREASURY_FRN)
75
+ .setBondDetails(bond)
76
+ .setFrnExtension(frn);
77
+ }
78
+ }
79
+ exports.default = FloatingRateNote;
80
+ //# sourceMappingURL=FloatingRateNote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FloatingRateNote.js","sourceRoot":"","sources":["FloatingRateNote.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAIwB;AACxB,iFAAmG;AACnG,yFAAuF;AACvF,2FAAyF;AACzF,iGAA+F;AAC/F,2CAAqC;AAErC;;;;GAIG;AACH,MAAM,gBAAiB,SAAQ,sBAAY;IACzC,YAAY,KAAoB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAEO,eAAe;;QACrB,OAAO,MAAA,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,mCAAI,SAAS,CAAC;IACnD,CAAC;IAED,+DAA+D;IAC/D,SAAS;QACP,MAAM,GAAG,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACnC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAC5C,IAAI,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QACpB,OAAO,IAAI,oBAAO,CAAC,CAAC,CAAC,0BAA0B,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,qEAAqE;IACrE,qBAAqB;QACnB,MAAM,GAAG,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACnC,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,8BAAc,CAAC,kBAAkB,CAAC;IAC/E,CAAC;IAED,sCAAsC;IACtC,iBAAiB;QACf,MAAM,GAAG,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACnC,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,0CAAoB,CAAC,wBAAwB,CAAC;IACvF,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAIvB;QACC,MAAM,IAAI,GAAG,IAAA,+BAAgB,EAAC,IAAI,CAAC,CAAC;QACpC,MAAM,GAAG,GAAG,IAAI,+BAAiB,EAAE;aAChC,SAAS,CAAC,IAAA,6BAAc,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACtC,qBAAqB,CAAC,IAAI,CAAC,kBAAkB,CAAC;aAC9C,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC1C,OAAO,IAAI,2BAAa,EAAE;aACvB,cAAc,CAAC,kCAAgB,CAAC,YAAY,CAAC;aAC7C,cAAc,CAAC,IAAI,CAAC;aACpB,eAAe,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;CACF;AAED,kBAAe,gBAAgB,CAAC"}
@@ -0,0 +1,67 @@
1
+ import BondSecurity, {
2
+ BondPricerInputs,
3
+ buildBondDetails,
4
+ decimalToProto,
5
+ } from './BondSecurity';
6
+ import { SecurityProto, FrnExtensionProto } from '../../../fintekkers/models/security/security_pb';
7
+ import { ProductTypeProto } from '../../../fintekkers/models/security/product_type_pb';
8
+ import { IndexTypeProto } from '../../../fintekkers/models/security/index/index_type_pb';
9
+ import { CouponFrequencyProto } from '../../../fintekkers/models/security/coupon_frequency_pb';
10
+ import { Decimal } from 'decimal.js';
11
+
12
+ /**
13
+ * FRN-specific accessors layered on top of BondSecurity. The floating-rate
14
+ * fields live in the parallel frn_extension sub-message; bond_details
15
+ * still carries face value / dates / etc.
16
+ */
17
+ class FloatingRateNote extends BondSecurity {
18
+ constructor(proto: SecurityProto) {
19
+ super(proto);
20
+ }
21
+
22
+ private getFrnExtension(): FrnExtensionProto | undefined {
23
+ return this.proto.getFrnExtension() ?? undefined;
24
+ }
25
+
26
+ /** Spread added on top of the reference rate at each reset. */
27
+ getSpread(): Decimal | null {
28
+ const ext = this.getFrnExtension();
29
+ const v = ext ? ext.getSpread() : undefined;
30
+ if (!v) return null;
31
+ return new Decimal(v.getArbitraryPrecisionValue());
32
+ }
33
+
34
+ /** Which index the coupon resets off (SOFR on a US TREASURY_FRN). */
35
+ getReferenceRateIndex(): IndexTypeProto {
36
+ const ext = this.getFrnExtension();
37
+ return ext ? ext.getReferenceRateIndex() : IndexTypeProto.UNKNOWN_INDEX_TYPE;
38
+ }
39
+
40
+ /** Reset cadence (e.g. QUARTERLY). */
41
+ getResetFrequency(): CouponFrequencyProto {
42
+ const ext = this.getFrnExtension();
43
+ return ext ? ext.getResetFrequency() : CouponFrequencyProto.UNKNOWN_COUPON_FREQUENCY;
44
+ }
45
+
46
+ /**
47
+ * Build a fresh SecurityProto for a floating-rate note. product_type is
48
+ * set to TREASURY_FRN so Security.create routes back to this wrapper.
49
+ */
50
+ static fromPricerInputs(args: BondPricerInputs & {
51
+ spread: Decimal;
52
+ referenceRateIndex: IndexTypeProto;
53
+ resetFrequency: CouponFrequencyProto;
54
+ }): SecurityProto {
55
+ const bond = buildBondDetails(args);
56
+ const frn = new FrnExtensionProto()
57
+ .setSpread(decimalToProto(args.spread))
58
+ .setReferenceRateIndex(args.referenceRateIndex)
59
+ .setResetFrequency(args.resetFrequency);
60
+ return new SecurityProto()
61
+ .setProductType(ProductTypeProto.TREASURY_FRN)
62
+ .setBondDetails(bond)
63
+ .setFrnExtension(frn);
64
+ }
65
+ }
66
+
67
+ export default FloatingRateNote;
@@ -0,0 +1,16 @@
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
+ * Wrapper for Security messages whose product_type is a descendant of
6
+ * INDEX in hierarchy.json (CPI_SERIES, SOFR_SERIES, EQUITY_INDEX, etc.).
7
+ * The index-specific fields live in the index_details sub-message (one of
8
+ * the non_bond_details oneof variants).
9
+ */
10
+ declare class IndexSecurity extends Security {
11
+ constructor(proto: SecurityProto);
12
+ /** Which index family this security represents. Defaults to
13
+ * UNKNOWN_INDEX_TYPE when index_details is not populated. */
14
+ getIndexType(): IndexTypeProto;
15
+ }
16
+ export default IndexSecurity;
@@ -0,0 +1,26 @@
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 security_1 = __importDefault(require("./security"));
7
+ const index_type_pb_1 = require("../../../fintekkers/models/security/index/index_type_pb");
8
+ /**
9
+ * Wrapper for Security messages whose product_type is a descendant of
10
+ * INDEX in hierarchy.json (CPI_SERIES, SOFR_SERIES, EQUITY_INDEX, etc.).
11
+ * The index-specific fields live in the index_details sub-message (one of
12
+ * the non_bond_details oneof variants).
13
+ */
14
+ class IndexSecurity extends security_1.default {
15
+ constructor(proto) {
16
+ super(proto);
17
+ }
18
+ /** Which index family this security represents. Defaults to
19
+ * UNKNOWN_INDEX_TYPE when index_details is not populated. */
20
+ getIndexType() {
21
+ const details = this.proto.getIndexDetails();
22
+ return details ? details.getIndexType() : index_type_pb_1.IndexTypeProto.UNKNOWN_INDEX_TYPE;
23
+ }
24
+ }
25
+ exports.default = IndexSecurity;
26
+ //# sourceMappingURL=IndexSecurity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndexSecurity.js","sourceRoot":"","sources":["IndexSecurity.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAElC,2FAAyF;AAEzF;;;;;GAKG;AACH,MAAM,aAAc,SAAQ,kBAAQ;IAClC,YAAY,KAAoB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED;iEAC6D;IAC7D,YAAY;QACV,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;QAC7C,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,8BAAc,CAAC,kBAAkB,CAAC;IAC9E,CAAC;CACF;AAED,kBAAe,aAAa,CAAC"}
@@ -0,0 +1,60 @@
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 security_1 = __importDefault(require("./security"));
7
+ const IndexSecurity_1 = __importDefault(require("./IndexSecurity"));
8
+ const security_pb_1 = require("../../../fintekkers/models/security/security_pb");
9
+ const product_type_pb_1 = require("../../../fintekkers/models/security/product_type_pb");
10
+ const index_type_pb_1 = require("../../../fintekkers/models/security/index/index_type_pb");
11
+ const uuid_1 = require("../utils/uuid");
12
+ test('Security.create routes CPI_SERIES to IndexSecurity', () => {
13
+ const proto = new security_pb_1.SecurityProto()
14
+ .setObjectClass('Security')
15
+ .setVersion('0.0.1')
16
+ .setUuid(uuid_1.UUID.random().toUUIDProto())
17
+ .setProductType(product_type_pb_1.ProductTypeProto.CPI_SERIES)
18
+ .setAssetClass('Index');
19
+ proto.setIndexDetails(new security_pb_1.IndexDetailsProto().setIndexType(index_type_pb_1.IndexTypeProto.CPI_U));
20
+ const sec = security_1.default.create(proto);
21
+ expect(sec).toBeInstanceOf(IndexSecurity_1.default);
22
+ expect(sec.getIndexType()).toBe(index_type_pb_1.IndexTypeProto.CPI_U);
23
+ });
24
+ test('Security.create routes SOFR_SERIES to IndexSecurity', () => {
25
+ const proto = new security_pb_1.SecurityProto()
26
+ .setObjectClass('Security')
27
+ .setVersion('0.0.1')
28
+ .setUuid(uuid_1.UUID.random().toUUIDProto())
29
+ .setProductType(product_type_pb_1.ProductTypeProto.SOFR_SERIES)
30
+ .setAssetClass('Index');
31
+ proto.setIndexDetails(new security_pb_1.IndexDetailsProto().setIndexType(index_type_pb_1.IndexTypeProto.SOFR));
32
+ const sec = security_1.default.create(proto);
33
+ expect(sec).toBeInstanceOf(IndexSecurity_1.default);
34
+ expect(sec.getIndexType()).toBe(index_type_pb_1.IndexTypeProto.SOFR);
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 security_pb_1.SecurityProto()
40
+ .setObjectClass('Security')
41
+ .setVersion('0.0.1')
42
+ .setUuid(uuid_1.UUID.random().toUUIDProto())
43
+ .setProductType(product_type_pb_1.ProductTypeProto.CPI_SERIES)
44
+ .setAssetClass('Index');
45
+ const sec = security_1.default.create(proto);
46
+ expect(sec.getIndexType()).toBe(index_type_pb_1.IndexTypeProto.UNKNOWN_INDEX_TYPE);
47
+ });
48
+ test('IndexSecurity extends Security (not BondSecurity)', () => {
49
+ const proto = new security_pb_1.SecurityProto()
50
+ .setObjectClass('Security')
51
+ .setVersion('0.0.1')
52
+ .setUuid(uuid_1.UUID.random().toUUIDProto())
53
+ .setProductType(product_type_pb_1.ProductTypeProto.EQUITY_INDEX);
54
+ proto.setIndexDetails(new security_pb_1.IndexDetailsProto().setIndexType(index_type_pb_1.IndexTypeProto.US_TREASURY));
55
+ const sec = security_1.default.create(proto);
56
+ expect(sec).toBeInstanceOf(IndexSecurity_1.default);
57
+ expect(sec).toBeInstanceOf(security_1.default);
58
+ expect(sec.isBond()).toBe(false);
59
+ });
60
+ //# sourceMappingURL=IndexSecurity.test.js.map