@fintekkers/ledger-models 0.1.62 → 0.1.64

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 (71) hide show
  1. package/.env +3 -0
  2. package/node/fintekkers/models/position/field_pb.d.ts +1 -0
  3. package/node/fintekkers/models/position/field_pb.js +1 -0
  4. package/node/fintekkers/models/security/bond/auction_type_grpc_pb.js +1 -0
  5. package/node/fintekkers/models/security/bond/auction_type_pb.d.ts +12 -0
  6. package/node/fintekkers/models/security/bond/auction_type_pb.js +33 -0
  7. package/node/fintekkers/models/security/bond/issuance_grpc_pb.js +1 -0
  8. package/node/fintekkers/models/security/bond/issuance_pb.d.ts +85 -0
  9. package/node/fintekkers/models/security/bond/issuance_pb.js +652 -0
  10. package/node/fintekkers/models/security/security_pb.d.ts +6 -0
  11. package/node/fintekkers/models/security/security_pb.js +64 -2
  12. package/node/wrappers/models/portfolio/portfolio.js +41 -0
  13. package/node/wrappers/models/portfolio/portfolio.js.map +1 -0
  14. package/node/wrappers/models/portfolio/portfolio.ts +49 -0
  15. package/node/wrappers/models/position/position.test.ts +1 -1
  16. package/node/wrappers/models/position/positionfilter.js +35 -0
  17. package/node/wrappers/models/position/positionfilter.js.map +1 -0
  18. package/node/wrappers/models/position/positionfilter.ts +38 -0
  19. package/node/wrappers/models/security/security.test.js +33 -0
  20. package/node/wrappers/models/security/security.test.js.map +1 -0
  21. package/node/wrappers/models/security/security.test.ts +41 -0
  22. package/node/wrappers/models/transaction/transaction.js +4 -3
  23. package/node/wrappers/models/transaction/transaction.js.map +1 -1
  24. package/node/wrappers/models/transaction/transaction.test.js.map +1 -1
  25. package/node/wrappers/models/transaction/transaction.test.ts +1 -5
  26. package/node/wrappers/models/transaction/transaction.ts +29 -29
  27. package/node/wrappers/models/utils/datetime.js +9 -0
  28. package/node/wrappers/models/utils/datetime.js.map +1 -1
  29. package/node/wrappers/models/utils/datetime.ts +16 -4
  30. package/node/wrappers/models/utils/serialization.js +8 -0
  31. package/node/wrappers/models/utils/serialization.js.map +1 -1
  32. package/node/wrappers/models/utils/serialization.ts +48 -40
  33. package/node/wrappers/models/utils/serialization.util.js +49 -17
  34. package/node/wrappers/models/utils/serialization.util.js.map +1 -1
  35. package/node/wrappers/models/utils/serialization.util.test.js +12 -0
  36. package/node/wrappers/models/utils/serialization.util.test.js.map +1 -1
  37. package/node/wrappers/models/utils/serialization.util.test.ts +18 -0
  38. package/node/wrappers/models/utils/serialization.util.ts +62 -26
  39. package/node/wrappers/services/portfolio-service/PortfolioService.js +5 -13
  40. package/node/wrappers/services/portfolio-service/PortfolioService.js.map +1 -1
  41. package/node/wrappers/services/portfolio-service/PortfolioService.ts +11 -23
  42. package/node/wrappers/services/portfolio-service/portfolio.test.js +30 -34
  43. package/node/wrappers/services/portfolio-service/portfolio.test.js.map +1 -1
  44. package/node/wrappers/services/portfolio-service/portfolio.test.ts +8 -12
  45. package/node/wrappers/services/position-service/position.test.js +9 -3
  46. package/node/wrappers/services/position-service/position.test.js.map +1 -1
  47. package/node/wrappers/services/position-service/position.test.ts +52 -49
  48. package/node/wrappers/services/security-service/SecurityService.js +14 -12
  49. package/node/wrappers/services/security-service/SecurityService.js.map +1 -1
  50. package/node/wrappers/services/security-service/SecurityService.ts +13 -16
  51. package/node/wrappers/services/security-service/security.maturityLadder.test.js +59 -0
  52. package/node/wrappers/services/security-service/security.maturityLadder.test.js.map +1 -0
  53. package/node/wrappers/services/security-service/security.maturityLadder.test.ts +39 -0
  54. package/node/wrappers/services/security-service/security.test.js +6 -2
  55. package/node/wrappers/services/security-service/security.test.js.map +1 -1
  56. package/node/wrappers/services/security-service/security.test.ts +7 -3
  57. package/node/wrappers/services/transaction-service/TransactionService.js +2 -9
  58. package/node/wrappers/services/transaction-service/TransactionService.js.map +1 -1
  59. package/node/wrappers/services/transaction-service/TransactionService.ts +8 -18
  60. package/node/wrappers/services/transaction-service/transaction.test.js +21 -5
  61. package/node/wrappers/services/transaction-service/transaction.test.js.map +1 -1
  62. package/node/wrappers/services/transaction-service/transaction.test.ts +32 -15
  63. package/package.json +1 -1
  64. package/web/fintekkers/models/position/field_pb.d.ts +1 -0
  65. package/web/fintekkers/models/position/field_pb.js +1 -0
  66. package/web/fintekkers/models/security/bond/auction_type_pb.d.ts +8 -0
  67. package/web/fintekkers/models/security/bond/auction_type_pb.js +27 -0
  68. package/web/fintekkers/models/security/bond/issuance_pb.d.ts +82 -0
  69. package/web/fintekkers/models/security/bond/issuance_pb.js +646 -0
  70. package/web/fintekkers/models/security/security_pb.d.ts +7 -0
  71. package/web/fintekkers/models/security/security_pb.js +64 -2
@@ -31,6 +31,8 @@ var fintekkers_models_util_uuid_pb = require('../../../fintekkers/models/util/uu
31
31
  goog.object.extend(proto, fintekkers_models_util_uuid_pb);
32
32
  var fintekkers_models_security_identifier_identifier_pb = require('../../../fintekkers/models/security/identifier/identifier_pb.js');
33
33
  goog.object.extend(proto, fintekkers_models_security_identifier_identifier_pb);
34
+ var fintekkers_models_security_bond_issuance_pb = require('../../../fintekkers/models/security/bond/issuance_pb.js');
35
+ goog.object.extend(proto, fintekkers_models_security_bond_issuance_pb);
34
36
  var fintekkers_models_security_security_type_pb = require('../../../fintekkers/models/security/security_type_pb.js');
35
37
  goog.object.extend(proto, fintekkers_models_security_security_type_pb);
36
38
  var fintekkers_models_security_security_quantity_type_pb = require('../../../fintekkers/models/security/security_quantity_type_pb.js');
@@ -51,7 +53,7 @@ goog.exportSymbol('proto.fintekkers.models.security.SecurityProto', null, global
51
53
  * @constructor
52
54
  */
53
55
  proto.fintekkers.models.security.SecurityProto = function(opt_data) {
54
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
56
+ jspb.Message.initialize(this, opt_data, 0, -1, proto.fintekkers.models.security.SecurityProto.repeatedFields_, null);
55
57
  };
56
58
  goog.inherits(proto.fintekkers.models.security.SecurityProto, jspb.Message);
57
59
  if (goog.DEBUG && !COMPILED) {
@@ -62,6 +64,13 @@ if (goog.DEBUG && !COMPILED) {
62
64
  proto.fintekkers.models.security.SecurityProto.displayName = 'proto.fintekkers.models.security.SecurityProto';
63
65
  }
64
66
 
67
+ /**
68
+ * List of repeated fields within this message type.
69
+ * @private {!Array<number>}
70
+ * @const
71
+ */
72
+ proto.fintekkers.models.security.SecurityProto.repeatedFields_ = [67];
73
+
65
74
 
66
75
 
67
76
  if (jspb.Message.GENERATE_TO_OBJECT) {
@@ -114,7 +123,9 @@ proto.fintekkers.models.security.SecurityProto.toObject = function(includeInstan
114
123
  datedDate: (f = msg.getDatedDate()) && fintekkers_models_util_local_date_pb.LocalDateProto.toObject(includeInstance, f),
115
124
  faceValue: (f = msg.getFaceValue()) && fintekkers_models_util_decimal_value_pb.DecimalValueProto.toObject(includeInstance, f),
116
125
  issueDate: (f = msg.getIssueDate()) && fintekkers_models_util_local_date_pb.LocalDateProto.toObject(includeInstance, f),
117
- maturityDate: (f = msg.getMaturityDate()) && fintekkers_models_util_local_date_pb.LocalDateProto.toObject(includeInstance, f)
126
+ maturityDate: (f = msg.getMaturityDate()) && fintekkers_models_util_local_date_pb.LocalDateProto.toObject(includeInstance, f),
127
+ issuanceInfoList: jspb.Message.toObjectList(msg.getIssuanceInfoList(),
128
+ fintekkers_models_security_bond_issuance_pb.IssuanceProto.toObject, includeInstance)
118
129
  };
119
130
 
120
131
  if (includeInstance) {
@@ -250,6 +261,11 @@ proto.fintekkers.models.security.SecurityProto.deserializeBinaryFromReader = fun
250
261
  reader.readMessage(value,fintekkers_models_util_local_date_pb.LocalDateProto.deserializeBinaryFromReader);
251
262
  msg.setMaturityDate(value);
252
263
  break;
264
+ case 67:
265
+ var value = new fintekkers_models_security_bond_issuance_pb.IssuanceProto;
266
+ reader.readMessage(value,fintekkers_models_security_bond_issuance_pb.IssuanceProto.deserializeBinaryFromReader);
267
+ msg.addIssuanceInfo(value);
268
+ break;
253
269
  default:
254
270
  reader.skipField();
255
271
  break;
@@ -444,6 +460,14 @@ proto.fintekkers.models.security.SecurityProto.serializeBinaryToWriter = functio
444
460
  fintekkers_models_util_local_date_pb.LocalDateProto.serializeBinaryToWriter
445
461
  );
446
462
  }
463
+ f = message.getIssuanceInfoList();
464
+ if (f.length > 0) {
465
+ writer.writeRepeatedMessage(
466
+ 67,
467
+ f,
468
+ fintekkers_models_security_bond_issuance_pb.IssuanceProto.serializeBinaryToWriter
469
+ );
470
+ }
447
471
  };
448
472
 
449
473
 
@@ -1052,4 +1076,42 @@ proto.fintekkers.models.security.SecurityProto.prototype.hasMaturityDate = funct
1052
1076
  };
1053
1077
 
1054
1078
 
1079
+ /**
1080
+ * repeated bond.IssuanceProto issuance_info = 67;
1081
+ * @return {!Array<!proto.fintekkers.models.security.bond.IssuanceProto>}
1082
+ */
1083
+ proto.fintekkers.models.security.SecurityProto.prototype.getIssuanceInfoList = function() {
1084
+ return /** @type{!Array<!proto.fintekkers.models.security.bond.IssuanceProto>} */ (
1085
+ jspb.Message.getRepeatedWrapperField(this, fintekkers_models_security_bond_issuance_pb.IssuanceProto, 67));
1086
+ };
1087
+
1088
+
1089
+ /**
1090
+ * @param {!Array<!proto.fintekkers.models.security.bond.IssuanceProto>} value
1091
+ * @return {!proto.fintekkers.models.security.SecurityProto} returns this
1092
+ */
1093
+ proto.fintekkers.models.security.SecurityProto.prototype.setIssuanceInfoList = function(value) {
1094
+ return jspb.Message.setRepeatedWrapperField(this, 67, value);
1095
+ };
1096
+
1097
+
1098
+ /**
1099
+ * @param {!proto.fintekkers.models.security.bond.IssuanceProto=} opt_value
1100
+ * @param {number=} opt_index
1101
+ * @return {!proto.fintekkers.models.security.bond.IssuanceProto}
1102
+ */
1103
+ proto.fintekkers.models.security.SecurityProto.prototype.addIssuanceInfo = function(opt_value, opt_index) {
1104
+ return jspb.Message.addToRepeatedWrapperField(this, 67, opt_value, proto.fintekkers.models.security.bond.IssuanceProto, opt_index);
1105
+ };
1106
+
1107
+
1108
+ /**
1109
+ * Clears the list making it empty but non-null.
1110
+ * @return {!proto.fintekkers.models.security.SecurityProto} returns this
1111
+ */
1112
+ proto.fintekkers.models.security.SecurityProto.prototype.clearIssuanceInfoList = function() {
1113
+ return this.setIssuanceInfoList([]);
1114
+ };
1115
+
1116
+
1055
1117
  goog.object.extend(exports, proto.fintekkers.models.security);
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
4
+ var datetime_1 = require("../utils/datetime");
5
+ var uuid_1 = require("../utils/uuid");
6
+ var Portfolio = /** @class */ (function () {
7
+ function Portfolio(proto) {
8
+ this.proto = proto;
9
+ }
10
+ // getProto(): PortfolioProto {
11
+ // return this.proto;
12
+ // }
13
+ Portfolio.prototype.getID = function () {
14
+ return uuid_1.UUID.fromU8Array(this.proto.getUuid().getRawUuid_asU8());
15
+ };
16
+ Portfolio.prototype.getAsOf = function () {
17
+ return new datetime_1.ZonedDateTime(this.proto.getAsOf());
18
+ };
19
+ Portfolio.prototype.getPortfolioName = function () {
20
+ return this.proto.getPortfolioName();
21
+ };
22
+ Portfolio.prototype.getFields = function () {
23
+ return [field_pb_1.FieldProto.ID, field_pb_1.FieldProto.PORTFOLIO, field_pb_1.FieldProto.PORTFOLIO_ID, field_pb_1.FieldProto.PORTFOLIO_NAME];
24
+ };
25
+ Portfolio.prototype.getField = function (field) {
26
+ switch (field) {
27
+ case field_pb_1.FieldProto.ID:
28
+ case field_pb_1.FieldProto.PORTFOLIO_ID:
29
+ return this.getID();
30
+ case field_pb_1.FieldProto.AS_OF:
31
+ return this.getAsOf();
32
+ case field_pb_1.FieldProto.PORTFOLIO_NAME:
33
+ return this.getPortfolioName();
34
+ default:
35
+ throw new Error("Field not mapped in Portfolio wrapper: ".concat(field));
36
+ }
37
+ };
38
+ return Portfolio;
39
+ }());
40
+ exports.default = Portfolio;
41
+ //# sourceMappingURL=portfolio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portfolio.js","sourceRoot":"","sources":["portfolio.ts"],"names":[],"mappings":";;AACA,yEAA0E;AAC1E,8CAAkD;AAClD,sCAAqC;AAErC;IAGI,mBAAY,KAAqB;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,+BAA+B;IAC/B,yBAAyB;IACzB,IAAI;IAEJ,yBAAK,GAAL;QACI,OAAO,WAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,eAAe,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,2BAAO,GAAP;QACI,OAAO,IAAI,wBAAa,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,oCAAgB,GAAhB;QACI,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;IACzC,CAAC;IAED,6BAAS,GAAT;QACI,OAAO,CAAC,qBAAU,CAAC,EAAE,EAAE,qBAAU,CAAC,SAAS,EAAE,qBAAU,CAAC,YAAY,EAAE,qBAAU,CAAC,cAAc,CAAC,CAAC;IACrG,CAAC;IAED,4BAAQ,GAAR,UAAS,KAAiB;QACtB,QAAQ,KAAK,EAAE;YACX,KAAK,qBAAU,CAAC,EAAE,CAAC;YACnB,KAAK,qBAAU,CAAC,YAAY;gBACxB,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;YACxB,KAAK,qBAAU,CAAC,KAAK;gBACjB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;YAC1B,KAAK,qBAAU,CAAC,cAAc;gBAC1B,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACnC;gBACI,MAAM,IAAI,KAAK,CAAC,iDAA0C,KAAK,CAAE,CAAC,CAAC;SAC1E;IACL,CAAC;IACL,gBAAC;AAAD,CAAC,AAxCD,IAwCC;AAGD,kBAAe,SAAS,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { PortfolioProto } from "../../../fintekkers/models/portfolio/portfolio_pb";
2
+ import { FieldProto } from "../../../fintekkers/models/position/field_pb";
3
+ import { ZonedDateTime } from "../utils/datetime";
4
+ import { UUID } from "../utils/uuid";
5
+
6
+ class Portfolio {
7
+ proto: PortfolioProto;
8
+
9
+ constructor(proto: PortfolioProto) {
10
+ this.proto = proto;
11
+ }
12
+
13
+ // getProto(): PortfolioProto {
14
+ // return this.proto;
15
+ // }
16
+
17
+ getID(): UUID {
18
+ return UUID.fromU8Array(this.proto.getUuid().getRawUuid_asU8());
19
+ }
20
+
21
+ getAsOf(): ZonedDateTime {
22
+ return new ZonedDateTime(this.proto.getAsOf());
23
+ }
24
+
25
+ getPortfolioName(): string {
26
+ return this.proto.getPortfolioName();
27
+ }
28
+
29
+ getFields(): FieldProto[] {
30
+ return [FieldProto.ID, FieldProto.PORTFOLIO, FieldProto.PORTFOLIO_ID, FieldProto.PORTFOLIO_NAME];
31
+ }
32
+
33
+ getField(field: FieldProto): any {
34
+ switch (field) {
35
+ case FieldProto.ID:
36
+ case FieldProto.PORTFOLIO_ID:
37
+ return this.getID();
38
+ case FieldProto.AS_OF:
39
+ return this.getAsOf();
40
+ case FieldProto.PORTFOLIO_NAME:
41
+ return this.getPortfolioName();
42
+ default:
43
+ throw new Error(`Field not mapped in Portfolio wrapper: ${field}`);
44
+ }
45
+ }
46
+ }
47
+
48
+
49
+ export default Portfolio;
@@ -9,7 +9,7 @@ import { TransactionProto } from '../../../fintekkers/models/transaction/transac
9
9
  import { TransactionTypeProto } from '../../../fintekkers/models/transaction/transaction_type_pb';
10
10
  import { LocalTimestampProto } from '../../../fintekkers/models/util/local_timestamp_pb';
11
11
 
12
- import { Timestamp } from '@grpc/grpc-js/build/src/generated/google/protobuf/Timestamp';
12
+ import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
13
13
  import { DecimalValueProto } from '../../../fintekkers/models/util/decimal_value_pb';
14
14
  import { PriceProto } from '../../../fintekkers/models/price/price_pb';
15
15
  import { PositionProto } from '../../../fintekkers/models/position/position_pb';
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PositionFilter = void 0;
4
+ var position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
5
+ var serialization_util_1 = require("../utils/serialization.util");
6
+ var position_filter_pb_1 = require("../../../fintekkers/models/position/position_filter_pb");
7
+ var PositionFilter = /** @class */ (function () {
8
+ function PositionFilter() {
9
+ this.filters = [];
10
+ }
11
+ /**
12
+ * @param {*} field FieldProto.ASSET_CLASS, as an example
13
+ * @param {*} fieldValue The appropriate value for the FieldProto, e.g. FieldProto.ASSET_CLASS would have a string fieldValue
14
+ */
15
+ PositionFilter.prototype.addFilter = function (field, fieldValue) {
16
+ var fieldMapEntry = new position_util_pb_1.FieldMapEntry();
17
+ fieldMapEntry.setField(field); //FieldProto.ASSET_CLASS);
18
+ fieldMapEntry.setFieldValuePacked((0, serialization_util_1.pack)(fieldValue));
19
+ this.filters.push(fieldMapEntry);
20
+ return this;
21
+ };
22
+ PositionFilter.prototype.getFilters = function () {
23
+ return this.filters;
24
+ };
25
+ PositionFilter.prototype.toProto = function () {
26
+ var positionFilterProto = new position_filter_pb_1.PositionFilterProto();
27
+ positionFilterProto.setObjectClass('PositionFilter');
28
+ positionFilterProto.setVersion('0.0.1');
29
+ positionFilterProto.setFiltersList(this.filters);
30
+ return positionFilterProto;
31
+ };
32
+ return PositionFilter;
33
+ }());
34
+ exports.PositionFilter = PositionFilter;
35
+ //# sourceMappingURL=positionfilter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positionfilter.js","sourceRoot":"","sources":["positionfilter.ts"],"names":[],"mappings":";;;AAAA,yFAAqF;AAErF,kEAAmD;AACnD,6FAA6F;AAE7F;IAGI;QACI,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,kCAAS,GAAT,UAAU,KAAiB,EAAE,UAAe;QACxC,IAAM,aAAa,GAAG,IAAI,gCAAa,EAAE,CAAC;QAC1C,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,0BAA0B;QACzD,aAAa,CAAC,mBAAmB,CAAC,IAAA,yBAAI,EAAC,UAAU,CAAC,CAAC,CAAC;QAEpD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,mCAAU,GAAV;QACI,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,gCAAO,GAAP;QACI,IAAM,mBAAmB,GAAG,IAAI,wCAAmB,EAAE,CAAC;QACtD,mBAAmB,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;QACrD,mBAAmB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACxC,mBAAmB,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEjD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IACL,qBAAC;AAAD,CAAC,AAhCD,IAgCC;AAhCY,wCAAc"}
@@ -0,0 +1,38 @@
1
+ import { FieldMapEntry } from '../../../fintekkers/models/position/position_util_pb';
2
+ import { FieldProto } from '../../../fintekkers/models/position/field_pb';
3
+ import { pack } from '../utils/serialization.util';
4
+ import { PositionFilterProto } from '../../../fintekkers/models/position/position_filter_pb';
5
+
6
+ export class PositionFilter {
7
+ filters: FieldMapEntry[];
8
+
9
+ constructor() {
10
+ this.filters = [];
11
+ }
12
+
13
+ /**
14
+ * @param {*} field FieldProto.ASSET_CLASS, as an example
15
+ * @param {*} fieldValue The appropriate value for the FieldProto, e.g. FieldProto.ASSET_CLASS would have a string fieldValue
16
+ */
17
+ addFilter(field: FieldProto, fieldValue: any): PositionFilter {
18
+ const fieldMapEntry = new FieldMapEntry();
19
+ fieldMapEntry.setField(field); //FieldProto.ASSET_CLASS);
20
+ fieldMapEntry.setFieldValuePacked(pack(fieldValue));
21
+
22
+ this.filters.push(fieldMapEntry);
23
+ return this;
24
+ }
25
+
26
+ getFilters(): Array<FieldMapEntry> {
27
+ return this.filters;
28
+ }
29
+
30
+ toProto(): PositionFilterProto {
31
+ const positionFilterProto = new PositionFilterProto();
32
+ positionFilterProto.setObjectClass('PositionFilter');
33
+ positionFilterProto.setVersion('0.0.1');
34
+ positionFilterProto.setFiltersList(this.filters);
35
+
36
+ return positionFilterProto;
37
+ }
38
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var local_date_pb_1 = require("../../../fintekkers/models/util/local_date_pb");
4
+ var uuid_1 = require("../utils/uuid");
5
+ var assert = require("assert");
6
+ var security_1 = require("./security");
7
+ var decimal_value_pb_1 = require("../../../fintekkers/models/util/decimal_value_pb");
8
+ var security_pb_1 = require("../../../fintekkers/models/security/security_pb");
9
+ var coupon_frequency_pb_1 = require("../../../fintekkers/models/security/coupon_frequency_pb");
10
+ var coupon_type_pb_1 = require("../../../fintekkers/models/security/coupon_type_pb");
11
+ var security_quantity_type_pb_1 = require("../../../fintekkers/models/security/security_quantity_type_pb");
12
+ test('test the security wrapper', function () {
13
+ testSerialization();
14
+ });
15
+ function testSerialization() {
16
+ var security = dummySecurity();
17
+ assert(security.getMaturityDate().getFullYear() == 2026);
18
+ }
19
+ function dummySecurity() {
20
+ return new security_1.default(new security_pb_1.SecurityProto()
21
+ .setObjectClass('Transaction').setVersion('0.0.1').setUuid(uuid_1.UUID.random().toUUIDProto())
22
+ .setFaceValue(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('1000.00'))
23
+ .setQuantityType(security_quantity_type_pb_1.SecurityQuantityTypeProto.ORIGINAL_FACE_VALUE)
24
+ .setAssetClass("Bond")
25
+ .setIssuerName("Dummy issuer")
26
+ .setCouponRate(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('0.05'))
27
+ .setCouponFrequency(coupon_frequency_pb_1.CouponFrequencyProto.SEMIANNUALLY)
28
+ .setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED)
29
+ .setMaturityDate(new local_date_pb_1.LocalDateProto().setYear(2026).setMonth(1).setDay(1))
30
+ .setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(1))
31
+ .setDescription("Dummy security"));
32
+ }
33
+ //# sourceMappingURL=security.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.test.js","sourceRoot":"","sources":["security.test.ts"],"names":[],"mappings":";;AAAA,+EAA+E;AAC/E,sCAAqC;AAErC,+BAAkC;AAClC,uCAAkC;AAElC,qFAAqF;AACrF,+EAAgF;AAChF,+FAA+F;AAC/F,qFAAqF;AACrF,2GAA0G;AAG1G,IAAI,CAAC,2BAA2B,EAAE;IAC9B,iBAAiB,EAAE,CAAC;AACxB,CAAC,CAAC,CAAC;AAEH,SAAS,iBAAiB;IACtB,IAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IAEjC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,aAAa;IAClB,OAAO,IAAI,kBAAQ,CAAC,IAAI,2BAAa,EAAE;SAClC,cAAc,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,WAAI,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;SACtF,YAAY,CAAC,IAAI,oCAAiB,EAAE,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC;SAC3E,eAAe,CAAC,qDAAyB,CAAC,mBAAmB,CAAC;SAC9D,aAAa,CAAC,MAAM,CAAC;SACrB,aAAa,CAAC,cAAc,CAAC;SAE7B,aAAa,CAAC,IAAI,oCAAiB,EAAE,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;SACzE,kBAAkB,CAAC,0CAAoB,CAAC,YAAY,CAAC;SACrD,aAAa,CAAC,gCAAe,CAAC,KAAK,CAAC;SAEpC,eAAe,CAAC,IAAI,8BAAc,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACzE,YAAY,CAAC,IAAI,8BAAc,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACtE,cAAc,CAAC,gBAAgB,CAAC,CACpC,CAAC;AACN,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { LocalDateProto } from '../../../fintekkers/models/util/local_date_pb';
2
+ import { UUID } from '../utils/uuid';
3
+
4
+ import assert = require('assert');
5
+ import Security from './security';
6
+
7
+ import { DecimalValueProto } from '../../../fintekkers/models/util/decimal_value_pb';
8
+ import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
9
+ import { CouponFrequencyProto } from '../../../fintekkers/models/security/coupon_frequency_pb';
10
+ import { CouponTypeProto } from '../../../fintekkers/models/security/coupon_type_pb';
11
+ import { SecurityQuantityTypeProto } from '../../../fintekkers/models/security/security_quantity_type_pb';
12
+
13
+
14
+ test('test the security wrapper', () => {
15
+ testSerialization();
16
+ });
17
+
18
+ function testSerialization(): void {
19
+ const security = dummySecurity();
20
+
21
+ assert(security.getMaturityDate().getFullYear() == 2026);
22
+ }
23
+
24
+ function dummySecurity() {
25
+ return new Security(new SecurityProto()
26
+ .setObjectClass('Transaction').setVersion('0.0.1').setUuid(UUID.random().toUUIDProto())
27
+ .setFaceValue(new DecimalValueProto().setArbitraryPrecisionValue('1000.00'))
28
+ .setQuantityType(SecurityQuantityTypeProto.ORIGINAL_FACE_VALUE)
29
+ .setAssetClass("Bond")
30
+ .setIssuerName("Dummy issuer")
31
+
32
+ .setCouponRate(new DecimalValueProto().setArbitraryPrecisionValue('0.05'))
33
+ .setCouponFrequency(CouponFrequencyProto.SEMIANNUALLY)
34
+ .setCouponType(CouponTypeProto.FIXED)
35
+
36
+ .setMaturityDate(new LocalDateProto().setYear(2026).setMonth(1).setDay(1))
37
+ .setIssueDate(new LocalDateProto().setYear(2021).setMonth(1).setDay(1))
38
+ .setDescription("Dummy security")
39
+ );
40
+ }
41
+
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
4
3
  var transaction_type_1 = require("./transaction_type");
4
+ var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
5
5
  var security_1 = require("../security/security");
6
+ var portfolio_1 = require("../portfolio/portfolio");
7
+ //Model Utils
6
8
  var datetime_1 = require("../utils/datetime");
7
9
  var uuid_1 = require("../utils/uuid");
8
10
  var date_1 = require("../utils/date");
@@ -57,9 +59,8 @@ var Transaction = /** @class */ (function () {
57
59
  Transaction.prototype.getAsOf = function () {
58
60
  return new datetime_1.ZonedDateTime(this.proto.getAsOf());
59
61
  };
60
- //TODO: Create Portfolio wrapper
61
62
  Transaction.prototype.getPortfolio = function () {
62
- return this.proto.getPortfolio();
63
+ return new portfolio_1.default(this.proto.getPortfolio());
63
64
  };
64
65
  Transaction.prototype.getSecurity = function () {
65
66
  return new security_1.default(this.proto.getSecurity());
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["transaction.ts"],"names":[],"mappings":";;AACA,yEAA0E;AAI1E,uDAAqD;AAKrD,iDAA4C;AAC5C,8CAAkD;AAClD,sCAAqC;AACrC,sCAA0C;AAC1C,yCAAqC;AAErC;IAGE,qBAAY,KAAuB;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,8BAAQ,GAAR;QACE,IAAI;YACA,IAAM,OAAO,GACb,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;YAEjF,OAAO,UAAG,4BAA4B,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe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AC5C,WAAW,CAAC,IAAI,oCAAiB,EAAE,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC;SAC1E,iBAAiB,CAAC,IAAI,8BAAc,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC"}
@@ -1,17 +1,13 @@
1
1
  import { LocalDateProto } from '../../../fintekkers/models/util/local_date_pb';
2
- import { UUIDProto } from '../../../fintekkers/models/util/uuid_pb';
3
- import { ProtoSerializationUtil } from '../utils/serialization';
4
2
  import { UUID } from '../utils/uuid';
5
3
 
6
4
  import assert = require('assert');
7
5
  import Transaction from './transaction';
8
6
  import { TransactionProto } from '../../../fintekkers/models/transaction/transaction_pb';
9
7
  import { TransactionTypeProto } from '../../../fintekkers/models/transaction/transaction_type_pb';
10
- import { LocalTimestampProto } from '../../../fintekkers/models/util/local_timestamp_pb';
11
8
 
12
- import { Timestamp } from '@grpc/grpc-js/build/src/generated/google/protobuf/Timestamp';
13
9
  import { DecimalValueProto } from '../../../fintekkers/models/util/decimal_value_pb';
14
- import { PriceProto } from '../../../fintekkers/models/price/price_pb';
10
+
15
11
 
16
12
  test('test the transaction wrapper', () => {
17
13
  testSerialization();
@@ -1,14 +1,15 @@
1
- import { PortfolioProto } from "../../../fintekkers/models/portfolio/portfolio_pb";
2
- import { FieldProto } from "../../../fintekkers/models/position/field_pb";
3
- import { PositionStatusProto } from "../../../fintekkers/models/position/position_status_pb";
1
+ //Models
4
2
  import { PriceProto } from "../../../fintekkers/models/price/price_pb";
5
- import { IdentifierProto } from "../../../fintekkers/models/security/identifier/identifier_pb";
6
3
  import { TransactionType } from "./transaction_type";
7
4
  import { StrategyAllocationProto } from "../../../fintekkers/models/strategy/strategy_allocation_pb";
8
5
  import { TransactionProto } from "../../../fintekkers/models/transaction/transaction_pb";
9
- import { TransactionTypeProto } from "../../../fintekkers/models/transaction/transaction_type_pb";
10
- import { LocalDateProto } from "../../../fintekkers/models/util/local_date_pb";
6
+ import { FieldProto } from "../../../fintekkers/models/position/field_pb";
7
+ import { PositionStatusProto } from "../../../fintekkers/models/position/position_status_pb";
8
+
11
9
  import Security from "../security/security";
10
+ import Portfolio from "../portfolio/portfolio";
11
+
12
+ //Model Utils
12
13
  import { ZonedDateTime } from "../utils/datetime";
13
14
  import { UUID } from "../utils/uuid";
14
15
  import { LocalDate } from "../utils/date";
@@ -23,17 +24,17 @@ class Transaction {
23
24
 
24
25
  toString(): string {
25
26
  try {
26
- const validTo: string =
27
+ const validTo: string =
27
28
  this.proto.getValidFrom() !== null ? this.proto.getValidTo().toString() : "NULL";
28
-
29
- return `${/*this.proto.isCancelled()*/ false ? "INVALIDATED: " : ""}TXN[${this.getID().toString()}], ` +
29
+
30
+ return `${/*this.proto.isCancelled()*/ false ? "INVALIDATED: " : ""}TXN[${this.getID().toString()}], ` +
30
31
  `TradeDate[${this.getTradeDate().toString()}], TxnType[${this.getTransactionType()}], Price[${this.getPrice()}], Quantity[${this.getQuantity()}], ` +
31
32
  `AsOf[${this.getAsOf().toString()}], Portfolio[${this.getPortfolio().getPortfolioName()}], Issuer[${this.getSecurity().getIssuerName()}], ` +
32
33
  `ValidFrom[${this.proto.getValidFrom().toString()}], ValidTo[${validTo}], Strategy[${this.getStrategyAllocation().toString()}]`;
33
34
  } catch (e) {
34
- console.error(e);
35
- return "WHOOPS";
36
- }
35
+ console.error(e);
36
+ return "WHOOPS";
37
+ }
37
38
  }
38
39
 
39
40
  getFields(): FieldProto[] {
@@ -73,9 +74,8 @@ class Transaction {
73
74
  return new ZonedDateTime(this.proto.getAsOf());
74
75
  }
75
76
 
76
- //TODO: Create Portfolio wrapper
77
- getPortfolio(): PortfolioProto {
78
- return this.proto.getPortfolio();
77
+ getPortfolio(): Portfolio {
78
+ return new Portfolio(this.proto.getPortfolio());
79
79
  }
80
80
 
81
81
  getSecurity(): Security {
@@ -100,31 +100,31 @@ class Transaction {
100
100
 
101
101
  getDirectedQuantity(): Decimal {
102
102
  return this.getQuantity().mul(this.getTransactionType().getDirectionMultiplier());
103
- }
103
+ }
104
104
 
105
105
  getTradeDate(): LocalDate {
106
106
  return new LocalDate(this.proto.getTradeDate());
107
107
  }
108
108
 
109
- getSettlementDate() : LocalDate {
109
+ getSettlementDate(): LocalDate {
110
110
  return new LocalDate(this.proto.getSettlementDate());
111
111
  }
112
112
 
113
- getTransactionType() : TransactionType {
114
- return new TransactionType(this.proto.getTransactionType());
115
- }
113
+ getTransactionType(): TransactionType {
114
+ return new TransactionType(this.proto.getTransactionType());
115
+ }
116
116
 
117
- getTradeName(): string {
118
- return this.proto.getTradeName();
119
- }
117
+ getTradeName(): string {
118
+ return this.proto.getTradeName();
119
+ }
120
120
 
121
- getPositionStatus(): PositionStatusProto {
122
- return this.proto.getPositionStatus();
123
- }
121
+ getPositionStatus(): PositionStatusProto {
122
+ return this.proto.getPositionStatus();
123
+ }
124
124
 
125
- getChildrenTransactions(): TransactionProto[] {
126
- return this.proto.getChildtransactionsList();
127
- }
125
+ getChildrenTransactions(): TransactionProto[] {
126
+ return this.proto.getChildtransactionsList();
127
+ }
128
128
 
129
129
 
130
130
  equals(other: Transaction): boolean {
@@ -9,6 +9,15 @@ var ZonedDateTime = /** @class */ (function () {
9
9
  function ZonedDateTime(proto) {
10
10
  this.proto = proto;
11
11
  }
12
+ ZonedDateTime.prototype.getTimezone = function () {
13
+ return this.proto.getTimeZone();
14
+ };
15
+ ZonedDateTime.prototype.getSeconds = function () {
16
+ return this.proto.getTimestamp().getSeconds();
17
+ };
18
+ ZonedDateTime.prototype.getNanoSeconds = function () {
19
+ return this.proto.getTimestamp().getNanos();
20
+ };
12
21
  ZonedDateTime.prototype.toDateTime = function () {
13
22
  // Creating a DateTime object with the current date and time in a specific time zone (e.g., 'America/New_York')
14
23
  var unixTimestampSeconds = this.proto.getTimestamp().getSeconds();
@@ -1 +1 @@
1
- {"version":3,"file":"datetime.js","sourceRoot":"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,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAEvC,OAAO,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;IACH,oBAAC;AAAD,CAAC,AA1DD,IA0DC;AA0BQ,sCAAa;AAxBtB,6DAA6D;AAC7D,mFAAmF;AACnF,0CAA0C;AAE1C,uDAAuD;AACvD,0DAA0D;AAC1D,uFAAuF;AAEvF,2DAA2D;AAC3D,uCAAuC;AACvC,mCAAmC;AACnC,+BAA+B;AAE/B,sDAAsD;AACtD,oDAAoD;AACpD,4CAA4C;AAE5C,8CAA8C;AAC9C,IAAI;AAEJ,sDAAsD;AACtD,IAAM,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,CAAC;AAChC,IAAA,gBAAM,EAAC,GAAG,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,KAAK,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC"}
@@ -10,6 +10,18 @@ class ZonedDateTime {
10
10
  this.proto = proto;
11
11
  }
12
12
 
13
+ getTimezone(): string {
14
+ return this.proto.getTimeZone();
15
+ }
16
+
17
+ getSeconds(): number {
18
+ return this.proto.getTimestamp().getSeconds();
19
+ }
20
+
21
+ getNanoSeconds(): number {
22
+ return this.proto.getTimestamp().getNanos();
23
+ }
24
+
13
25
  toDateTime(): DateTime {
14
26
  // Creating a DateTime object with the current date and time in a specific time zone (e.g., 'America/New_York')
15
27
  const unixTimestampSeconds = this.proto.getTimestamp().getSeconds();
@@ -33,20 +45,20 @@ class ZonedDateTime {
33
45
  static now(): ZonedDateTime {
34
46
  // Get the current time in milliseconds since January 1, 1970 (Unix timestamp)
35
47
  const currentTimeMillis = Date.now();
36
-
48
+
37
49
  // Convert milliseconds to seconds and nanoseconds
38
50
  const seconds = Math.floor(currentTimeMillis / 1000);
39
51
  const nanos = (currentTimeMillis % 1000) * 1e6; // 1 millisecond = 1e6 nanoseconds
40
-
52
+
41
53
  // Create a new Timestamp object with the current time
42
54
  const timestamp = new Timestamp();
43
55
  timestamp.setSeconds(seconds);
44
56
  timestamp.setNanos(nanos);
45
-
57
+
46
58
  const localTimestamp = new LocalTimestampProto();
47
59
  localTimestamp.setTimeZone('America/New_York');
48
60
  localTimestamp.setTimestamp(timestamp);
49
-
61
+
50
62
  return new ZonedDateTime(localTimestamp);
51
63
  }
52
64
  }