@fintekkers/ledger-models 0.1.143 → 0.2.0
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
|
@@ -33,8 +33,12 @@ var fintekkers_models_security_identifier_identifier_pb = require('../../../fint
|
|
|
33
33
|
goog.object.extend(proto, fintekkers_models_security_identifier_identifier_pb);
|
|
34
34
|
var fintekkers_models_security_bond_issuance_pb = require('../../../fintekkers/models/security/bond/issuance_pb.js');
|
|
35
35
|
goog.object.extend(proto, fintekkers_models_security_bond_issuance_pb);
|
|
36
|
-
var
|
|
37
|
-
goog.object.extend(proto,
|
|
36
|
+
var fintekkers_models_security_product_type_pb = require('../../../fintekkers/models/security/product_type_pb.js');
|
|
37
|
+
goog.object.extend(proto, fintekkers_models_security_product_type_pb);
|
|
38
|
+
var fintekkers_models_security_instrument_type_pb = require('../../../fintekkers/models/security/instrument_type_pb.js');
|
|
39
|
+
goog.object.extend(proto, fintekkers_models_security_instrument_type_pb);
|
|
40
|
+
var fintekkers_models_security_security_id_pb = require('../../../fintekkers/models/security/security_id_pb.js');
|
|
41
|
+
goog.object.extend(proto, fintekkers_models_security_security_id_pb);
|
|
38
42
|
var fintekkers_models_security_security_quantity_type_pb = require('../../../fintekkers/models/security/security_quantity_type_pb.js');
|
|
39
43
|
goog.object.extend(proto, fintekkers_models_security_security_quantity_type_pb);
|
|
40
44
|
var fintekkers_models_security_coupon_frequency_pb = require('../../../fintekkers/models/security/coupon_frequency_pb.js');
|
|
@@ -226,7 +230,7 @@ if (goog.DEBUG && !COMPILED) {
|
|
|
226
230
|
* @private {!Array<number>}
|
|
227
231
|
* @const
|
|
228
232
|
*/
|
|
229
|
-
proto.fintekkers.models.security.SecurityProto.repeatedFields_ = [42,67];
|
|
233
|
+
proto.fintekkers.models.security.SecurityProto.repeatedFields_ = [17,42,67];
|
|
230
234
|
|
|
231
235
|
/**
|
|
232
236
|
* Oneof group definitions for this message. Each group defines the field
|
|
@@ -297,7 +301,10 @@ proto.fintekkers.models.security.SecurityProto.toObject = function(includeInstan
|
|
|
297
301
|
isLink: jspb.Message.getBooleanFieldWithDefault(msg, 7, false),
|
|
298
302
|
validFrom: (f = msg.getValidFrom()) && fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.toObject(includeInstance, f),
|
|
299
303
|
validTo: (f = msg.getValidTo()) && fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.toObject(includeInstance, f),
|
|
300
|
-
|
|
304
|
+
productType: jspb.Message.getFieldWithDefault(msg, 10, 0),
|
|
305
|
+
instrumentType: jspb.Message.getFieldWithDefault(msg, 16, 0),
|
|
306
|
+
legsList: jspb.Message.toObjectList(msg.getLegsList(),
|
|
307
|
+
fintekkers_models_security_security_id_pb.SecurityIdProto.toObject, includeInstance),
|
|
301
308
|
deletedAt: (f = msg.getDeletedAt()) && fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.toObject(includeInstance, f),
|
|
302
309
|
assetClass: jspb.Message.getFieldWithDefault(msg, 11, ""),
|
|
303
310
|
issuerName: jspb.Message.getFieldWithDefault(msg, 12, ""),
|
|
@@ -400,8 +407,17 @@ proto.fintekkers.models.security.SecurityProto.deserializeBinaryFromReader = fun
|
|
|
400
407
|
msg.setValidTo(value);
|
|
401
408
|
break;
|
|
402
409
|
case 10:
|
|
403
|
-
var value = /** @type {!proto.fintekkers.models.security.
|
|
404
|
-
msg.
|
|
410
|
+
var value = /** @type {!proto.fintekkers.models.security.ProductTypeProto} */ (reader.readEnum());
|
|
411
|
+
msg.setProductType(value);
|
|
412
|
+
break;
|
|
413
|
+
case 16:
|
|
414
|
+
var value = /** @type {!proto.fintekkers.models.security.InstrumentTypeProto} */ (reader.readEnum());
|
|
415
|
+
msg.setInstrumentType(value);
|
|
416
|
+
break;
|
|
417
|
+
case 17:
|
|
418
|
+
var value = new fintekkers_models_security_security_id_pb.SecurityIdProto;
|
|
419
|
+
reader.readMessage(value,fintekkers_models_security_security_id_pb.SecurityIdProto.deserializeBinaryFromReader);
|
|
420
|
+
msg.addLegs(value);
|
|
405
421
|
break;
|
|
406
422
|
case 15:
|
|
407
423
|
var value = new fintekkers_models_util_local_timestamp_pb.LocalTimestampProto;
|
|
@@ -629,13 +645,28 @@ proto.fintekkers.models.security.SecurityProto.serializeBinaryToWriter = functio
|
|
|
629
645
|
fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.serializeBinaryToWriter
|
|
630
646
|
);
|
|
631
647
|
}
|
|
632
|
-
f = message.
|
|
648
|
+
f = message.getProductType();
|
|
633
649
|
if (f !== 0.0) {
|
|
634
650
|
writer.writeEnum(
|
|
635
651
|
10,
|
|
636
652
|
f
|
|
637
653
|
);
|
|
638
654
|
}
|
|
655
|
+
f = message.getInstrumentType();
|
|
656
|
+
if (f !== 0.0) {
|
|
657
|
+
writer.writeEnum(
|
|
658
|
+
16,
|
|
659
|
+
f
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
f = message.getLegsList();
|
|
663
|
+
if (f.length > 0) {
|
|
664
|
+
writer.writeRepeatedMessage(
|
|
665
|
+
17,
|
|
666
|
+
f,
|
|
667
|
+
fintekkers_models_security_security_id_pb.SecurityIdProto.serializeBinaryToWriter
|
|
668
|
+
);
|
|
669
|
+
}
|
|
639
670
|
f = message.getDeletedAt();
|
|
640
671
|
if (f != null) {
|
|
641
672
|
writer.writeMessage(
|
|
@@ -1079,23 +1110,79 @@ proto.fintekkers.models.security.SecurityProto.prototype.hasValidTo = function()
|
|
|
1079
1110
|
|
|
1080
1111
|
|
|
1081
1112
|
/**
|
|
1082
|
-
* optional
|
|
1083
|
-
* @return {!proto.fintekkers.models.security.
|
|
1113
|
+
* optional ProductTypeProto product_type = 10;
|
|
1114
|
+
* @return {!proto.fintekkers.models.security.ProductTypeProto}
|
|
1084
1115
|
*/
|
|
1085
|
-
proto.fintekkers.models.security.SecurityProto.prototype.
|
|
1086
|
-
return /** @type {!proto.fintekkers.models.security.
|
|
1116
|
+
proto.fintekkers.models.security.SecurityProto.prototype.getProductType = function() {
|
|
1117
|
+
return /** @type {!proto.fintekkers.models.security.ProductTypeProto} */ (jspb.Message.getFieldWithDefault(this, 10, 0));
|
|
1087
1118
|
};
|
|
1088
1119
|
|
|
1089
1120
|
|
|
1090
1121
|
/**
|
|
1091
|
-
* @param {!proto.fintekkers.models.security.
|
|
1122
|
+
* @param {!proto.fintekkers.models.security.ProductTypeProto} value
|
|
1092
1123
|
* @return {!proto.fintekkers.models.security.SecurityProto} returns this
|
|
1093
1124
|
*/
|
|
1094
|
-
proto.fintekkers.models.security.SecurityProto.prototype.
|
|
1125
|
+
proto.fintekkers.models.security.SecurityProto.prototype.setProductType = function(value) {
|
|
1095
1126
|
return jspb.Message.setProto3EnumField(this, 10, value);
|
|
1096
1127
|
};
|
|
1097
1128
|
|
|
1098
1129
|
|
|
1130
|
+
/**
|
|
1131
|
+
* optional InstrumentTypeProto instrument_type = 16;
|
|
1132
|
+
* @return {!proto.fintekkers.models.security.InstrumentTypeProto}
|
|
1133
|
+
*/
|
|
1134
|
+
proto.fintekkers.models.security.SecurityProto.prototype.getInstrumentType = function() {
|
|
1135
|
+
return /** @type {!proto.fintekkers.models.security.InstrumentTypeProto} */ (jspb.Message.getFieldWithDefault(this, 16, 0));
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* @param {!proto.fintekkers.models.security.InstrumentTypeProto} value
|
|
1141
|
+
* @return {!proto.fintekkers.models.security.SecurityProto} returns this
|
|
1142
|
+
*/
|
|
1143
|
+
proto.fintekkers.models.security.SecurityProto.prototype.setInstrumentType = function(value) {
|
|
1144
|
+
return jspb.Message.setProto3EnumField(this, 16, value);
|
|
1145
|
+
};
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* repeated SecurityIdProto legs = 17;
|
|
1150
|
+
* @return {!Array<!proto.fintekkers.models.security.SecurityIdProto>}
|
|
1151
|
+
*/
|
|
1152
|
+
proto.fintekkers.models.security.SecurityProto.prototype.getLegsList = function() {
|
|
1153
|
+
return /** @type{!Array<!proto.fintekkers.models.security.SecurityIdProto>} */ (
|
|
1154
|
+
jspb.Message.getRepeatedWrapperField(this, fintekkers_models_security_security_id_pb.SecurityIdProto, 17));
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* @param {!Array<!proto.fintekkers.models.security.SecurityIdProto>} value
|
|
1160
|
+
* @return {!proto.fintekkers.models.security.SecurityProto} returns this
|
|
1161
|
+
*/
|
|
1162
|
+
proto.fintekkers.models.security.SecurityProto.prototype.setLegsList = function(value) {
|
|
1163
|
+
return jspb.Message.setRepeatedWrapperField(this, 17, value);
|
|
1164
|
+
};
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* @param {!proto.fintekkers.models.security.SecurityIdProto=} opt_value
|
|
1169
|
+
* @param {number=} opt_index
|
|
1170
|
+
* @return {!proto.fintekkers.models.security.SecurityIdProto}
|
|
1171
|
+
*/
|
|
1172
|
+
proto.fintekkers.models.security.SecurityProto.prototype.addLegs = function(opt_value, opt_index) {
|
|
1173
|
+
return jspb.Message.addToRepeatedWrapperField(this, 17, opt_value, proto.fintekkers.models.security.SecurityIdProto, opt_index);
|
|
1174
|
+
};
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* Clears the list making it empty but non-null.
|
|
1179
|
+
* @return {!proto.fintekkers.models.security.SecurityProto} returns this
|
|
1180
|
+
*/
|
|
1181
|
+
proto.fintekkers.models.security.SecurityProto.prototype.clearLegsList = function() {
|
|
1182
|
+
return this.setLegsList([]);
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
|
|
1099
1186
|
/**
|
|
1100
1187
|
* optional fintekkers.models.util.LocalTimestampProto deleted_at = 15;
|
|
1101
1188
|
* @return {?proto.fintekkers.models.util.LocalTimestampProto}
|
|
@@ -6,7 +6,7 @@ const local_date_pb_1 = require("../util/local_date_pb");
|
|
|
6
6
|
const coupon_frequency_pb_1 = require("./coupon_frequency_pb");
|
|
7
7
|
const coupon_type_pb_1 = require("./coupon_type_pb");
|
|
8
8
|
const security_pb_1 = require("./security_pb");
|
|
9
|
-
const
|
|
9
|
+
const product_type_pb_1 = require("./product_type_pb");
|
|
10
10
|
test('create a security proto (from sue) object and test it can be read', () => {
|
|
11
11
|
// Usage example
|
|
12
12
|
const security = new security_pb_1.SecurityProto();
|
|
@@ -19,7 +19,7 @@ test('create a security proto (from sue) object and test it can be read', () =>
|
|
|
19
19
|
security.setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2023).setMonth(1).setDay(1));
|
|
20
20
|
security.setDatedDate(new local_date_pb_1.LocalDateProto().setYear(2023).setMonth(1).setDay(1));
|
|
21
21
|
security.setMaturityDate(new local_date_pb_1.LocalDateProto().setYear(2023).setMonth(1).setDay(1));
|
|
22
|
-
security.
|
|
22
|
+
security.setProductType(product_type_pb_1.ProductTypeProto.TREASURY_NOTE);
|
|
23
23
|
security.setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED);
|
|
24
24
|
// Serialize the object to a binary representation
|
|
25
25
|
const binaryData = security.serializeBinary();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security_pb.test.js","sourceRoot":"","sources":["security_pb.test.ts"],"names":[],"mappings":";;AAAA,2CAA2C;AAC3C,+DAA6D;AAC7D,yDAAuD;AACvD,+DAA6D;AAC7D,qDAAmD;AACnD,+CAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"security_pb.test.js","sourceRoot":"","sources":["security_pb.test.ts"],"names":[],"mappings":";;AAAA,2CAA2C;AAC3C,+DAA6D;AAC7D,yDAAuD;AACvD,+DAA6D;AAC7D,qDAAmD;AACnD,+CAA8C;AAC9C,uDAAqD;AAErD,IAAI,CAAC,mEAAmE,EAAE,GAAG,EAAE;IAC7E,gBAAgB;IAChB,MAAM,QAAQ,GAAG,IAAI,2BAAa,EAAE,CAAC;IAErC,QAAQ,CAAC,cAAc,CAAC,iBAA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EAAE,CAAC,CAAC;AACvE,CAAC,CAAC,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { LocalDateProto } from '../util/local_date_pb';
|
|
|
4
4
|
import { CouponFrequencyProto } from './coupon_frequency_pb';
|
|
5
5
|
import { CouponTypeProto } from './coupon_type_pb';
|
|
6
6
|
import { SecurityProto } from './security_pb';
|
|
7
|
-
import {
|
|
7
|
+
import { ProductTypeProto } from './product_type_pb';
|
|
8
8
|
|
|
9
9
|
test('create a security proto (from sue) object and test it can be read', () => {
|
|
10
10
|
// Usage example
|
|
@@ -19,7 +19,7 @@ test('create a security proto (from sue) object and test it can be read', () =>
|
|
|
19
19
|
security.setIssueDate(new LocalDateProto().setYear(2023).setMonth(1).setDay(1));
|
|
20
20
|
security.setDatedDate(new LocalDateProto().setYear(2023).setMonth(1).setDay(1));
|
|
21
21
|
security.setMaturityDate(new LocalDateProto().setYear(2023).setMonth(1).setDay(1));
|
|
22
|
-
security.
|
|
22
|
+
security.setProductType(ProductTypeProto.TREASURY_NOTE);
|
|
23
23
|
security.setCouponType(CouponTypeProto.FIXED)
|
|
24
24
|
|
|
25
25
|
// Serialize the object to a binary representation
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PositionFilterOperator = void 0;
|
|
4
4
|
// The proto module exports the enum as `PositionFilterOperator` (no `Proto`
|
|
5
|
-
// suffix, unlike
|
|
5
|
+
// suffix, unlike ProductTypeProto / AssetClassProto / IdentifierTypeProto).
|
|
6
6
|
// Renamed on import to free the natural class name for the wrapper. Consumers
|
|
7
7
|
// who want the enum type for their own annotations can import directly from
|
|
8
8
|
// the proto module:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position_filter_operator.js","sourceRoot":"","sources":["position_filter_operator.ts"],"names":[],"mappings":";;;AAAA,4EAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"position_filter_operator.js","sourceRoot":"","sources":["position_filter_operator.ts"],"names":[],"mappings":";;;AAAA,4EAA4E;AAC5E,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,oBAAoB;AACpB,EAAE;AACF,+EAA+E;AAC/E,EAAE;AACF,oDAAoD;AACpD,EAAE;AACF,uFAAuF;AACvF,2FAA4H;AAE5H;;;;;;;;;;GAUG;AACH,MAAa,sBAAsB;IAE/B;;;;;;OAMG;IACH,MAAM,CAAC,eAAe;QAClB,OAAO,MAAM,CAAC,IAAI,CAAC,yCAA0B,CAAC,CAAC,MAAM,CACjD,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,kBAAkB,CAChC,CAAC;IACN,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAY;QACxB,MAAM,OAAO,GAAG,yCAA+D,CAAC;QAChF,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,SAAS,KAAK,SAAS,EAAE;YACzB,MAAM,IAAI,KAAK,CACX,yCAAyC,IAAI,mBAAmB,sBAAsB,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxH,CAAC;SACL;QACD,OAAO,SAAuC,CAAC;IACnD,CAAC;CACJ;AA9BD,wDA8BC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The proto module exports the enum as `PositionFilterOperator` (no `Proto`
|
|
2
|
-
// suffix, unlike
|
|
2
|
+
// suffix, unlike ProductTypeProto / AssetClassProto / IdentifierTypeProto).
|
|
3
3
|
// Renamed on import to free the natural class name for the wrapper. Consumers
|
|
4
4
|
// who want the enum type for their own annotations can import directly from
|
|
5
5
|
// the proto module:
|
|
@@ -7,7 +7,7 @@ const assert = require("assert");
|
|
|
7
7
|
const Price_1 = __importDefault(require("./Price"));
|
|
8
8
|
const security_1 = __importDefault(require("../security/security"));
|
|
9
9
|
const security_pb_1 = require("../../../fintekkers/models/security/security_pb");
|
|
10
|
-
const
|
|
10
|
+
const product_type_pb_1 = require("../../../fintekkers/models/security/product_type_pb");
|
|
11
11
|
const uuid_1 = require("../utils/uuid");
|
|
12
12
|
const datetime_1 = require("../utils/datetime");
|
|
13
13
|
const decimal_js_1 = require("decimal.js");
|
|
@@ -33,7 +33,7 @@ function createDummyCashSecurity() {
|
|
|
33
33
|
securityProto.setObjectClass('Security');
|
|
34
34
|
securityProto.setVersion('0.0.1');
|
|
35
35
|
securityProto.setUuid(uuid_1.UUID.random().toUUIDProto());
|
|
36
|
-
securityProto.
|
|
36
|
+
securityProto.setProductType(product_type_pb_1.ProductTypeProto.CURRENCY);
|
|
37
37
|
securityProto.setAsOf(datetime_1.ZonedDateTime.now().toProto());
|
|
38
38
|
securityProto.setAssetClass('Cash');
|
|
39
39
|
securityProto.setCashId('USD');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Price.cash.test.js","sourceRoot":"","sources":["Price.cash.test.ts"],"names":[],"mappings":";;;;;AAAA,iCAAkC;AAClC,oDAA4B;AAC5B,oEAA4C;AAC5C,iFAAgF;AAChF,
|
|
1
|
+
{"version":3,"file":"Price.cash.test.js","sourceRoot":"","sources":["Price.cash.test.ts"],"names":[],"mappings":";;;;;AAAA,iCAAkC;AAClC,oDAA4B;AAC5B,oEAA4C;AAC5C,iFAAgF;AAChF,yFAAuF;AACvF,wCAAqC;AACrC,gDAAkD;AAClD,2CAAqC;AAErC,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACjC,gBAAgB,EAAE,CAAC;AACvB,CAAC,CAAC,CAAC;AAEH,SAAS,gBAAgB;;IACrB,MAAM,YAAY,GAAG,uBAAuB,EAAE,CAAC;IAC/C,MAAM,IAAI,GAAG,wBAAa,CAAC,GAAG,EAAE,CAAC;IAEjC,MAAM,SAAS,GAAG,eAAK,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAEzD,uDAAuD;IACvD,MAAM,UAAU,GAAG,MAAA,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,0CAAE,0BAA0B,EAAE,CAAC;IAC5E,MAAM,YAAY,GAAG,IAAI,oBAAO,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC;IACpD,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,oBAAO,CAAC,KAAK,CAAC,CAAC,EAAE,gCAAgC,UAAU,EAAE,CAAC,CAAC;IAE9F,wBAAwB;IACxB,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,KAAK,EAAE,uBAAuB,CAAC,CAAC;IAEtF,oBAAoB;IACpB,MAAM,CAAC,CAAA,MAAA,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,0CAAE,WAAW,EAAE,MAAK,IAAI,CAAC,OAAO,EAAE,CAAC,WAAW,EAAE,EAAE,4BAA4B,CAAC,CAAC;AACpH,CAAC;AAED,SAAS,uBAAuB;IAC5B,MAAM,aAAa,GAAG,IAAI,2BAAa,EAAE,CAAC;IAC1C,aAAa,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACzC,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,aAAa,CAAC,OAAO,CAAC,WAAI,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IACnD,aAAa,CAAC,cAAc,CAAC,kCAAgB,CAAC,QAAQ,CAAC,CAAC;IACxD,aAAa,CAAC,OAAO,CAAC,wBAAa,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IACrD,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACpC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAE/B,OAAO,kBAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -2,7 +2,7 @@ import assert = require('assert');
|
|
|
2
2
|
import Price from './Price';
|
|
3
3
|
import Security from '../security/security';
|
|
4
4
|
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
5
|
-
import {
|
|
5
|
+
import { ProductTypeProto } from "../../../fintekkers/models/security/product_type_pb";
|
|
6
6
|
import { UUID } from '../utils/uuid';
|
|
7
7
|
import { ZonedDateTime } from '../utils/datetime';
|
|
8
8
|
import { Decimal } from 'decimal.js';
|
|
@@ -34,7 +34,7 @@ function createDummyCashSecurity(): Security {
|
|
|
34
34
|
securityProto.setObjectClass('Security');
|
|
35
35
|
securityProto.setVersion('0.0.1');
|
|
36
36
|
securityProto.setUuid(UUID.random().toUUIDProto());
|
|
37
|
-
securityProto.
|
|
37
|
+
securityProto.setProductType(ProductTypeProto.CURRENCY);
|
|
38
38
|
securityProto.setAsOf(ZonedDateTime.now().toProto());
|
|
39
39
|
securityProto.setAssetClass('Cash');
|
|
40
40
|
securityProto.setCashId('USD');
|
|
@@ -4,18 +4,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const security_1 = __importDefault(require("./security"));
|
|
7
|
-
const
|
|
7
|
+
const product_type_pb_1 = require("../../../fintekkers/models/security/product_type_pb");
|
|
8
8
|
const date_1 = require("../utils/date");
|
|
9
9
|
const coupon_frequency_1 = require("./coupon_frequency");
|
|
10
10
|
const coupon_type_1 = require("./coupon_type");
|
|
11
11
|
const term_1 = require("./term");
|
|
12
12
|
const tenor_type_pb_1 = require("../../../fintekkers/models/security/tenor_type_pb");
|
|
13
13
|
const decimal_js_1 = require("decimal.js");
|
|
14
|
+
const product_hierarchy_1 = require("./product_hierarchy");
|
|
14
15
|
class BondSecurity extends security_1.default {
|
|
15
16
|
constructor(proto) {
|
|
16
17
|
super(proto);
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
// Bond-shape membership uses the registry: any product_type that is
|
|
19
|
+
// a descendant of "BOND" in hierarchy.json (TBILL, TREASURY_NOTE,
|
|
20
|
+
// TREASURY_BOND, TIPS, TREASURY_FRN, STRIPS, SOVEREIGN_BOND,
|
|
21
|
+
// CORP_BOND, MUNI_BOND, plus future planned leaves under
|
|
22
|
+
// CREDIT_BOND / STRUCTURED_BOND) is accepted.
|
|
23
|
+
const ptName = Object.keys(product_type_pb_1.ProductTypeProto)
|
|
24
|
+
.find(k => product_type_pb_1.ProductTypeProto[k] === proto.getProductType());
|
|
25
|
+
if (!ptName || !(0, product_hierarchy_1.isDescendantOf)(ptName, 'BOND')) {
|
|
26
|
+
throw new Error(`BondSecurity requires a bond-shape product type (descendant of BOND in hierarchy.json), got ${ptName !== null && ptName !== void 0 ? ptName : 'unknown'}`);
|
|
19
27
|
}
|
|
20
28
|
}
|
|
21
29
|
/** Returns the tenor (term) of the bond as a Tenor object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BondSecurity.js","sourceRoot":"","sources":["BondSecurity.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAElC,
|
|
1
|
+
{"version":3,"file":"BondSecurity.js","sourceRoot":"","sources":["BondSecurity.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAElC,yFAAuF;AAEvF,wCAA0C;AAE1C,yDAAqD;AACrD,+CAA2C;AAC3C,iCAAuC;AACvC,qFAAmF;AACnF,2CAAqC;AACrC,2DAAqD;AAErD,MAAM,YAAa,SAAQ,kBAAQ;IACjC,YAAY,KAAoB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,oEAAoE;QACpE,kEAAkE;QAClE,6DAA6D;QAC7D,yDAAyD;QACzD,8CAA8C;QAC9C,MAAM,MAAM,GAAI,MAAM,CAAC,IAAI,CAAC,kCAAgB,CAA0C;aACnF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,kCAAgB,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,MAAM,IAAI,CAAC,IAAA,kCAAc,EAAC,MAAgB,EAAE,MAAM,CAAC,EAAE;YACxD,MAAM,IAAI,KAAK,CAC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;QAChC,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;SACjE;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAE7B,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE;YAC9C,OAAO,MAAM,CAAC;SACf;aAAM,IAAI,KAAK,GAAG,EAAE,EAAE;YACrB,OAAO,MAAM,CAAC;SACf;aAAM;YACL,OAAO,MAAM,CAAC;SACf;IACH,CAAC;CACF;AAED,kBAAe,YAAY,CAAC"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const assert = require("assert");
|
|
7
7
|
const BondSecurity_1 = __importDefault(require("./BondSecurity"));
|
|
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 decimal_value_pb_1 = require("../../../fintekkers/models/util/decimal_value_pb");
|
|
11
11
|
const local_date_pb_1 = require("../../../fintekkers/models/util/local_date_pb");
|
|
12
12
|
const uuid_1 = require("../utils/uuid");
|
|
@@ -26,7 +26,7 @@ function createDummyBondSecurity() {
|
|
|
26
26
|
securityProto.setObjectClass('Security');
|
|
27
27
|
securityProto.setVersion('0.0.1');
|
|
28
28
|
securityProto.setUuid(uuid_1.UUID.random().toUUIDProto());
|
|
29
|
-
securityProto.
|
|
29
|
+
securityProto.setProductType(product_type_pb_1.ProductTypeProto.TREASURY_NOTE);
|
|
30
30
|
securityProto.setAsOf(datetime_1.ZonedDateTime.now().toProto());
|
|
31
31
|
securityProto.setFaceValue(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
|
|
32
32
|
securityProto.setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(1));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BondSecurity.priceScale.test.js","sourceRoot":"","sources":["BondSecurity.priceScale.test.ts"],"names":[],"mappings":";;;;;AAAA,iCAAkC;AAClC,kEAA0C;AAC1C,iFAAgF;AAChF,
|
|
1
|
+
{"version":3,"file":"BondSecurity.priceScale.test.js","sourceRoot":"","sources":["BondSecurity.priceScale.test.ts"],"names":[],"mappings":";;;;;AAAA,iCAAkC;AAClC,kEAA0C;AAC1C,iFAAgF;AAChF,yFAAuF;AACvF,uFAAqF;AACrF,iFAA+E;AAC/E,wCAAqC;AACrC,gDAAkD;AAClD,2CAAqC;AAErC,IAAI,CAAC,uCAAuC,EAAE,GAAG,EAAE;IAC/C,uBAAuB,EAAE,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEH,SAAS,uBAAuB;IAC5B,MAAM,YAAY,GAAG,uBAAuB,EAAE,CAAC;IAC/C,MAAM,gBAAgB,GAAG,YAAY,CAAC,mBAAmB,EAAE,CAAC;IAE5D,8CAA8C;IAC9C,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,oBAAO,CAAC,MAAM,CAAC,CAAC,EAC/C,yCAAyC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,uBAAuB;IAC5B,MAAM,aAAa,GAAG,IAAI,2BAAa,EAAE,CAAC;IAC1C,aAAa,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACzC,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,aAAa,CAAC,OAAO,CAAC,WAAI,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IACnD,aAAa,CAAC,cAAc,CAAC,kCAAgB,CAAC,aAAa,CAAC,CAAC;IAC7D,aAAa,CAAC,OAAO,CAAC,wBAAa,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IACrD,aAAa,CAAC,YAAY,CAAC,IAAI,oCAAiB,EAAE,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1F,aAAa,CAAC,YAAY,CAAC,IAAI,8BAAc,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACrF,aAAa,CAAC,eAAe,CAAC,IAAI,8BAAc,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAExF,OAAO,IAAI,sBAAY,CAAC,aAAa,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert = require('assert');
|
|
2
2
|
import BondSecurity from './BondSecurity';
|
|
3
3
|
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
4
|
-
import {
|
|
4
|
+
import { ProductTypeProto } from "../../../fintekkers/models/security/product_type_pb";
|
|
5
5
|
import { DecimalValueProto } from '../../../fintekkers/models/util/decimal_value_pb';
|
|
6
6
|
import { LocalDateProto } from '../../../fintekkers/models/util/local_date_pb';
|
|
7
7
|
import { UUID } from '../utils/uuid';
|
|
@@ -26,7 +26,7 @@ function createDummyBondSecurity(): BondSecurity {
|
|
|
26
26
|
securityProto.setObjectClass('Security');
|
|
27
27
|
securityProto.setVersion('0.0.1');
|
|
28
28
|
securityProto.setUuid(UUID.random().toUUIDProto());
|
|
29
|
-
securityProto.
|
|
29
|
+
securityProto.setProductType(ProductTypeProto.TREASURY_NOTE);
|
|
30
30
|
securityProto.setAsOf(ZonedDateTime.now().toProto());
|
|
31
31
|
securityProto.setFaceValue(new DecimalValueProto().setArbitraryPrecisionValue('1000.00'));
|
|
32
32
|
securityProto.setIssueDate(new LocalDateProto().setYear(2021).setMonth(1).setDay(1));
|
|
@@ -7,7 +7,7 @@ const assert = require("assert");
|
|
|
7
7
|
const security_1 = __importDefault(require("./security"));
|
|
8
8
|
const BondSecurity_1 = __importDefault(require("./BondSecurity"));
|
|
9
9
|
const security_pb_1 = require("../../../fintekkers/models/security/security_pb");
|
|
10
|
-
const
|
|
10
|
+
const product_type_pb_1 = require("../../../fintekkers/models/security/product_type_pb");
|
|
11
11
|
const coupon_type_pb_1 = require("../../../fintekkers/models/security/coupon_type_pb");
|
|
12
12
|
const coupon_frequency_pb_1 = require("../../../fintekkers/models/security/coupon_frequency_pb");
|
|
13
13
|
const local_date_pb_1 = require("../../../fintekkers/models/util/local_date_pb");
|
|
@@ -29,7 +29,7 @@ function testBondSecurityCreation() {
|
|
|
29
29
|
securityProto.setObjectClass('Security');
|
|
30
30
|
securityProto.setVersion('0.0.1');
|
|
31
31
|
securityProto.setUuid(uuid_1.UUID.random().toUUIDProto());
|
|
32
|
-
securityProto.
|
|
32
|
+
securityProto.setProductType(product_type_pb_1.ProductTypeProto.TREASURY_NOTE);
|
|
33
33
|
securityProto.setAssetClass('FixedIncome');
|
|
34
34
|
securityProto.setIssuerName('Test Issuer');
|
|
35
35
|
securityProto.setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED);
|
|
@@ -57,7 +57,7 @@ function testBondSecurityTenor() {
|
|
|
57
57
|
securityProto.setObjectClass('Security');
|
|
58
58
|
securityProto.setVersion('0.0.1');
|
|
59
59
|
securityProto.setUuid(uuid_1.UUID.random().toUUIDProto());
|
|
60
|
-
securityProto.
|
|
60
|
+
securityProto.setProductType(product_type_pb_1.ProductTypeProto.TREASURY_NOTE);
|
|
61
61
|
securityProto.setAssetClass('FixedIncome');
|
|
62
62
|
securityProto.setIssuerName('Test Issuer');
|
|
63
63
|
securityProto.setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED);
|
|
@@ -95,7 +95,7 @@ function testBondSecurityTenor() {
|
|
|
95
95
|
securityProto2.setObjectClass('Security');
|
|
96
96
|
securityProto2.setVersion('0.0.1');
|
|
97
97
|
securityProto2.setUuid(uuid_1.UUID.random().toUUIDProto());
|
|
98
|
-
securityProto2.
|
|
98
|
+
securityProto2.setProductType(product_type_pb_1.ProductTypeProto.TREASURY_NOTE);
|
|
99
99
|
securityProto2.setAssetClass('FixedIncome');
|
|
100
100
|
securityProto2.setIssuerName('Test Issuer');
|
|
101
101
|
securityProto2.setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED);
|
|
@@ -122,7 +122,7 @@ function testBondSecurityTenor() {
|
|
|
122
122
|
function testBondSecurityTenorWithAsOfDate() {
|
|
123
123
|
// Create a SecurityProto with BOND_SECURITY type and dates for a 10-year bond
|
|
124
124
|
const securityProto = new security_pb_1.SecurityProto();
|
|
125
|
-
securityProto.
|
|
125
|
+
securityProto.setProductType(product_type_pb_1.ProductTypeProto.TREASURY_NOTE);
|
|
126
126
|
securityProto.setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(1));
|
|
127
127
|
// Set maturity date: January 1, 2031 (exactly 10 years later)
|
|
128
128
|
securityProto.setMaturityDate(new local_date_pb_1.LocalDateProto().setYear(2031).setMonth(1).setDay(1));
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"BondSecurity.test.js","sourceRoot":"","sources":["BondSecurity.test.ts"],"names":[],"mappings":";;;;;AAAA,iCAAkC;AAClC,0DAAkC;AAClC,kEAA0C;AAC1C,iFAAgF;AAChF,yFAAuF;AACvF,uFAAqF;AACrF,iGAA+F;AAC/F,iFAA+E;AAC/E,uFAAqF;AACrF,wCAAqC;AAErC,qFAAmF;AAEnF,IAAI,CAAC,kFAAkF,EAAE,GAAG,EAAE;IAC1F,wBAAwB,EAAE,CAAC;AAC/B,CAAC,CAAC,CAAC;AA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AC,gBAAgB,KAAK,IAAI,EAAE,yCAAyC,gBAAgB,GAAG,CAAC,CAAC;IAEhG,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IACrC,MAAM,CAAC,WAAW,KAAK,UAAU,EAAE,6BAA6B,WAAW,GAAG,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -2,7 +2,7 @@ import assert = require('assert');
|
|
|
2
2
|
import Security from './security';
|
|
3
3
|
import BondSecurity from './BondSecurity';
|
|
4
4
|
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
5
|
-
import {
|
|
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';
|
|
8
8
|
import { LocalDateProto } from '../../../fintekkers/models/util/local_date_pb';
|
|
@@ -29,7 +29,7 @@ function testBondSecurityCreation(): void {
|
|
|
29
29
|
securityProto.setObjectClass('Security');
|
|
30
30
|
securityProto.setVersion('0.0.1');
|
|
31
31
|
securityProto.setUuid(UUID.random().toUUIDProto());
|
|
32
|
-
securityProto.
|
|
32
|
+
securityProto.setProductType(ProductTypeProto.TREASURY_NOTE);
|
|
33
33
|
securityProto.setAssetClass('FixedIncome');
|
|
34
34
|
securityProto.setIssuerName('Test Issuer');
|
|
35
35
|
securityProto.setCouponType(CouponTypeProto.FIXED);
|
|
@@ -62,7 +62,7 @@ function testBondSecurityTenor(): void {
|
|
|
62
62
|
securityProto.setObjectClass('Security');
|
|
63
63
|
securityProto.setVersion('0.0.1');
|
|
64
64
|
securityProto.setUuid(UUID.random().toUUIDProto());
|
|
65
|
-
securityProto.
|
|
65
|
+
securityProto.setProductType(ProductTypeProto.TREASURY_NOTE);
|
|
66
66
|
securityProto.setAssetClass('FixedIncome');
|
|
67
67
|
securityProto.setIssuerName('Test Issuer');
|
|
68
68
|
securityProto.setCouponType(CouponTypeProto.FIXED);
|
|
@@ -107,7 +107,7 @@ function testBondSecurityTenor(): void {
|
|
|
107
107
|
securityProto2.setObjectClass('Security');
|
|
108
108
|
securityProto2.setVersion('0.0.1');
|
|
109
109
|
securityProto2.setUuid(UUID.random().toUUIDProto());
|
|
110
|
-
securityProto2.
|
|
110
|
+
securityProto2.setProductType(ProductTypeProto.TREASURY_NOTE);
|
|
111
111
|
securityProto2.setAssetClass('FixedIncome');
|
|
112
112
|
securityProto2.setIssuerName('Test Issuer');
|
|
113
113
|
securityProto2.setCouponType(CouponTypeProto.FIXED);
|
|
@@ -140,7 +140,7 @@ function testBondSecurityTenorWithAsOfDate(): void {
|
|
|
140
140
|
// Create a SecurityProto with BOND_SECURITY type and dates for a 10-year bond
|
|
141
141
|
const securityProto = new SecurityProto();
|
|
142
142
|
|
|
143
|
-
securityProto.
|
|
143
|
+
securityProto.setProductType(ProductTypeProto.TREASURY_NOTE);
|
|
144
144
|
securityProto.setIssueDate(new LocalDateProto().setYear(2021).setMonth(1).setDay(1));
|
|
145
145
|
// Set maturity date: January 1, 2031 (exactly 10 years later)
|
|
146
146
|
securityProto.setMaturityDate(new LocalDateProto().setYear(2031).setMonth(1).setDay(1));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Security from './security';
|
|
2
2
|
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
3
|
-
import {
|
|
3
|
+
import { ProductTypeProto } from "../../../fintekkers/models/security/product_type_pb";
|
|
4
4
|
import { DecimalValueProto } from '../../../fintekkers/models/util/decimal_value_pb';
|
|
5
5
|
import { LocalDate } from '../utils/date';
|
|
6
6
|
import { IssuanceProto } from '../../../fintekkers/models/security/bond/issuance_pb';
|
|
@@ -9,13 +9,21 @@ import { CouponType } from './coupon_type';
|
|
|
9
9
|
import { Tenor, Period } from './term';
|
|
10
10
|
import { TenorTypeProto } from '../../../fintekkers/models/security/tenor_type_pb';
|
|
11
11
|
import { Decimal } from 'decimal.js';
|
|
12
|
+
import { isDescendantOf } from './product_hierarchy';
|
|
12
13
|
|
|
13
14
|
class BondSecurity extends Security {
|
|
14
15
|
constructor(proto: SecurityProto) {
|
|
15
16
|
super(proto);
|
|
16
|
-
|
|
17
|
+
// Bond-shape membership uses the registry: any product_type that is
|
|
18
|
+
// a descendant of "BOND" in hierarchy.json (TBILL, TREASURY_NOTE,
|
|
19
|
+
// TREASURY_BOND, TIPS, TREASURY_FRN, STRIPS, SOVEREIGN_BOND,
|
|
20
|
+
// CORP_BOND, MUNI_BOND, plus future planned leaves under
|
|
21
|
+
// CREDIT_BOND / STRUCTURED_BOND) is accepted.
|
|
22
|
+
const ptName = (Object.keys(ProductTypeProto) as Array<keyof typeof ProductTypeProto>)
|
|
23
|
+
.find(k => ProductTypeProto[k] === proto.getProductType());
|
|
24
|
+
if (!ptName || !isDescendantOf(ptName as string, 'BOND')) {
|
|
17
25
|
throw new Error(
|
|
18
|
-
`BondSecurity requires
|
|
26
|
+
`BondSecurity requires a bond-shape product type (descendant of BOND in hierarchy.json), got ${ptName ?? 'unknown'}`
|
|
19
27
|
);
|
|
20
28
|
}
|
|
21
29
|
}
|
|
@@ -39,12 +39,14 @@ describe('AssetClass.getAllTypeNames', () => {
|
|
|
39
39
|
// proto3 package-wide uniqueness)
|
|
40
40
|
// INDEX = 4;
|
|
41
41
|
// VOLATILITY = 5; (added in #236 for VIX support)
|
|
42
|
+
// CRYPTO = 6; (added in #237 for BTC support)
|
|
42
43
|
expect(asset_class_1.AssetClass.getAllTypeNames()).toEqual([
|
|
43
44
|
'FIXED_INCOME',
|
|
44
45
|
'EQUITY',
|
|
45
46
|
'CASH_ASSET_CLASS',
|
|
46
47
|
'INDEX',
|
|
47
48
|
'VOLATILITY',
|
|
49
|
+
'CRYPTO',
|
|
48
50
|
]);
|
|
49
51
|
});
|
|
50
52
|
test('excludes the UNKNOWN_ASSET_CLASS sentinel', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset_class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;QAC/C,MAAM,CAAC,GAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,uEAAuE;QACvE,iDAAiD;QACjD,MAAM,CAAC,wBAAU,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CACnD,gCAAe,CAAC,mBAAmB,CACtC,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IACxC,IAAI,CAAC,wEAAwE,EAAE,GAAG,EAAE;QAChF,6CAA6C;QAC7C,4CAA4C;QAC5C,sBAAsB;QACtB,gBAAgB;QAChB,mEAAmE;QACnE,oEAAoE;QACpE,kEAAkE;QAClE,eAAe;QACf,iEAAiE;QACjE,iEAAiE;QACjE,MAAM,CAAC,wBAAU,CAAC,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC;YACzC,cAAc;YACd,QAAQ;YACR,kBAAkB;YAClB,OAAO;YACP,YAAY;YACZ,QAAQ;SACX,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,wBAAU,CAAC,eAAe,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -45,12 +45,14 @@ describe('AssetClass.getAllTypeNames', () => {
|
|
|
45
45
|
// proto3 package-wide uniqueness)
|
|
46
46
|
// INDEX = 4;
|
|
47
47
|
// VOLATILITY = 5; (added in #236 for VIX support)
|
|
48
|
+
// CRYPTO = 6; (added in #237 for BTC support)
|
|
48
49
|
expect(AssetClass.getAllTypeNames()).toEqual([
|
|
49
50
|
'FIXED_INCOME',
|
|
50
51
|
'EQUITY',
|
|
51
52
|
'CASH_ASSET_CLASS',
|
|
52
53
|
'INDEX',
|
|
53
54
|
'VOLATILITY',
|
|
55
|
+
'CRYPTO',
|
|
54
56
|
]);
|
|
55
57
|
});
|
|
56
58
|
|