@fintekkers/ledger-models 0.1.62 → 0.1.63
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/.env +3 -0
- package/node/fintekkers/models/position/field_pb.d.ts +1 -0
- package/node/fintekkers/models/position/field_pb.js +1 -0
- package/node/fintekkers/models/security/bond/auction_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/bond/auction_type_pb.d.ts +12 -0
- package/node/fintekkers/models/security/bond/auction_type_pb.js +33 -0
- package/node/fintekkers/models/security/bond/issuance_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/bond/issuance_pb.d.ts +85 -0
- package/node/fintekkers/models/security/bond/issuance_pb.js +652 -0
- package/node/fintekkers/models/security/security_pb.d.ts +6 -0
- package/node/fintekkers/models/security/security_pb.js +64 -2
- package/node/wrappers/models/portfolio/portfolio.js +41 -0
- package/node/wrappers/models/portfolio/portfolio.js.map +1 -0
- package/node/wrappers/models/portfolio/portfolio.ts +49 -0
- package/node/wrappers/models/position/position.test.ts +1 -1
- package/node/wrappers/models/position/positionfilter.js +35 -0
- package/node/wrappers/models/position/positionfilter.js.map +1 -0
- package/node/wrappers/models/position/positionfilter.ts +38 -0
- package/node/wrappers/models/security/security.test.js +33 -0
- package/node/wrappers/models/security/security.test.js.map +1 -0
- package/node/wrappers/models/security/security.test.ts +41 -0
- package/node/wrappers/models/transaction/transaction.js +4 -3
- package/node/wrappers/models/transaction/transaction.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.test.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.test.ts +1 -5
- package/node/wrappers/models/transaction/transaction.ts +29 -29
- package/node/wrappers/models/utils/datetime.js +9 -0
- package/node/wrappers/models/utils/datetime.js.map +1 -1
- package/node/wrappers/models/utils/datetime.ts +16 -4
- package/node/wrappers/models/utils/serialization.js +8 -0
- package/node/wrappers/models/utils/serialization.js.map +1 -1
- package/node/wrappers/models/utils/serialization.ts +48 -40
- package/node/wrappers/models/utils/serialization.util.js +49 -17
- package/node/wrappers/models/utils/serialization.util.js.map +1 -1
- package/node/wrappers/models/utils/serialization.util.test.js +12 -0
- package/node/wrappers/models/utils/serialization.util.test.js.map +1 -1
- package/node/wrappers/models/utils/serialization.util.test.ts +18 -0
- package/node/wrappers/models/utils/serialization.util.ts +62 -26
- package/node/wrappers/services/portfolio-service/PortfolioService.js +5 -13
- package/node/wrappers/services/portfolio-service/PortfolioService.js.map +1 -1
- package/node/wrappers/services/portfolio-service/PortfolioService.ts +11 -23
- package/node/wrappers/services/portfolio-service/portfolio.test.js +30 -34
- package/node/wrappers/services/portfolio-service/portfolio.test.js.map +1 -1
- package/node/wrappers/services/portfolio-service/portfolio.test.ts +8 -12
- package/node/wrappers/services/position-service/position.test.js +9 -3
- package/node/wrappers/services/position-service/position.test.js.map +1 -1
- package/node/wrappers/services/position-service/position.test.ts +52 -49
- package/node/wrappers/services/security-service/SecurityService.js +14 -12
- package/node/wrappers/services/security-service/SecurityService.js.map +1 -1
- package/node/wrappers/services/security-service/SecurityService.ts +13 -16
- package/node/wrappers/services/security-service/security.maturityLadder.test.js +59 -0
- package/node/wrappers/services/security-service/security.maturityLadder.test.js.map +1 -0
- package/node/wrappers/services/security-service/security.maturityLadder.test.ts +39 -0
- package/node/wrappers/services/security-service/security.test.js +6 -2
- package/node/wrappers/services/security-service/security.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.test.ts +7 -3
- package/node/wrappers/services/transaction-service/TransactionService.js +2 -9
- package/node/wrappers/services/transaction-service/TransactionService.js.map +1 -1
- package/node/wrappers/services/transaction-service/TransactionService.ts +8 -18
- package/node/wrappers/services/transaction-service/transaction.test.js +21 -5
- package/node/wrappers/services/transaction-service/transaction.test.js.map +1 -1
- package/node/wrappers/services/transaction-service/transaction.test.ts +32 -15
- package/package.json +1 -1
- package/web/fintekkers/models/position/field_pb.d.ts +1 -0
- package/web/fintekkers/models/position/field_pb.js +1 -0
- package/web/fintekkers/models/security/bond/auction_type_pb.d.ts +8 -0
- package/web/fintekkers/models/security/bond/auction_type_pb.js +27 -0
- package/web/fintekkers/models/security/bond/issuance_pb.d.ts +82 -0
- package/web/fintekkers/models/security/bond/issuance_pb.js +646 -0
- package/web/fintekkers/models/security/security_pb.d.ts +7 -0
- package/web/fintekkers/models/security/security_pb.js +64 -2
|
@@ -37,7 +37,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.testPortfolio = void 0;
|
|
41
40
|
// Model Utils
|
|
42
41
|
var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
43
42
|
var uuid = require("../../models/utils/uuid");
|
|
@@ -45,38 +44,35 @@ var dt = require("../../models/utils/datetime");
|
|
|
45
44
|
//Requests & Services
|
|
46
45
|
var PortfolioService_1 = require("./PortfolioService");
|
|
47
46
|
var portfolio_pb_1 = require("../../../fintekkers/models/portfolio/portfolio_pb");
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
});
|
|
47
|
+
var positionfilter_1 = require("../../models/position/positionfilter");
|
|
48
|
+
test('test creating a portfolio against the api.fintekkers.org portfolio service', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
+
var id_proto, now, portfolioService, portfolio, validationSummary, createPortfolioResponse, searchResults;
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
id_proto = uuid.UUID.random().toUUIDProto();
|
|
54
|
+
now = dt.ZonedDateTime.now();
|
|
55
|
+
portfolioService = new PortfolioService_1.PortfolioService();
|
|
56
|
+
portfolio = new portfolio_pb_1.PortfolioProto();
|
|
57
|
+
portfolio.setObjectClass('Portfolio');
|
|
58
|
+
portfolio.setVersion('0.0.1');
|
|
59
|
+
portfolio.setUuid(id_proto);
|
|
60
|
+
portfolio.setPortfolioName('TEST PORTFOLIO');
|
|
61
|
+
portfolio.setAsOf(now.toProto());
|
|
62
|
+
return [4 /*yield*/, portfolioService.validateCreatePortfolio(portfolio)];
|
|
63
|
+
case 1:
|
|
64
|
+
validationSummary = _a.sent();
|
|
65
|
+
expect(validationSummary.getErrorsList().length).toBe(0);
|
|
66
|
+
return [4 /*yield*/, portfolioService.createPortfolio(portfolio)];
|
|
67
|
+
case 2:
|
|
68
|
+
createPortfolioResponse = _a.sent();
|
|
69
|
+
expect(createPortfolioResponse.getPortfolioResponseList().length).toBe(1);
|
|
70
|
+
return [4 /*yield*/, portfolioService.searchPortfolio(now.toProto(), new positionfilter_1.PositionFilter().addFilter(field_pb_1.FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings'))];
|
|
71
|
+
case 3:
|
|
72
|
+
searchResults = _a.sent();
|
|
73
|
+
expect(searchResults.length > 0).toBe(true);
|
|
74
|
+
return [2 /*return*/];
|
|
75
|
+
}
|
|
79
76
|
});
|
|
80
|
-
}
|
|
81
|
-
exports.testPortfolio = testPortfolio;
|
|
77
|
+
}); }, 30000);
|
|
82
78
|
//# sourceMappingURL=portfolio.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portfolio.test.js","sourceRoot":"","sources":["portfolio.test.ts"],"names":[],"mappings":";AAAA,SAAS
|
|
1
|
+
{"version":3,"file":"portfolio.test.js","sourceRoot":"","sources":["portfolio.test.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;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,CAAC,CAAC,EAAA;;gBAAjK,aAAa,GAAG,SAAiJ;gBACrK,MAAM,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;;KAC7C,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -9,14 +9,10 @@ import * as dt from '../../models/utils/datetime';
|
|
|
9
9
|
import { PortfolioService } from './PortfolioService';
|
|
10
10
|
import { PortfolioProto } from '../../../fintekkers/models/portfolio/portfolio_pb';
|
|
11
11
|
import { CreatePortfolioResponseProto } from '../../../fintekkers/requests/portfolio/create_portfolio_response_pb';
|
|
12
|
+
import { PositionFilter } from '../../models/position/positionfilter';
|
|
12
13
|
|
|
13
14
|
|
|
14
|
-
test('test creating a portfolio against the api.fintekkers.org portfolio service', () => {
|
|
15
|
-
const isTrue = testPortfolio();
|
|
16
|
-
expect(isTrue).resolves.toBe(true);
|
|
17
|
-
}, 30000);
|
|
18
|
-
|
|
19
|
-
export async function testPortfolio(): Promise<boolean> {
|
|
15
|
+
test('test creating a portfolio against the api.fintekkers.org portfolio service', async () => {
|
|
20
16
|
const id_proto = uuid.UUID.random().toUUIDProto();
|
|
21
17
|
const now = dt.ZonedDateTime.now();
|
|
22
18
|
|
|
@@ -30,11 +26,11 @@ export async function testPortfolio(): Promise<boolean> {
|
|
|
30
26
|
portfolio.setAsOf(now.toProto());
|
|
31
27
|
|
|
32
28
|
var validationSummary = await portfolioService.validateCreatePortfolio(portfolio);
|
|
29
|
+
expect(validationSummary.getErrorsList().length).toBe(0);
|
|
33
30
|
|
|
34
|
-
var createPortfolioResponse:CreatePortfolioResponseProto = await portfolioService.createPortfolio(portfolio);
|
|
35
|
-
|
|
36
|
-
var searchResults = await portfolioService.searchPortfolio(now.toProto(), FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings');
|
|
37
|
-
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
31
|
+
var createPortfolioResponse: CreatePortfolioResponseProto = await portfolioService.createPortfolio(portfolio);
|
|
32
|
+
expect(createPortfolioResponse.getPortfolioResponseList().length).toBe(1);
|
|
40
33
|
|
|
34
|
+
var searchResults = await portfolioService.searchPortfolio(now.toProto(), new PositionFilter().addFilter(FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings'));
|
|
35
|
+
expect(searchResults.length > 0).toBe(true);
|
|
36
|
+
}, 30000);
|
|
@@ -51,6 +51,7 @@ var any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
|
|
|
51
51
|
var PortfolioService_1 = require("../../services/portfolio-service/PortfolioService");
|
|
52
52
|
var PositionService_1 = require("../../services/position-service/PositionService");
|
|
53
53
|
var query_position_request_pb_1 = require("../../../fintekkers/requests/position/query_position_request_pb");
|
|
54
|
+
var positionfilter_1 = require("../../models/position/positionfilter");
|
|
54
55
|
test('test getting a position against the api.fintekkers.org position service', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
56
|
var isTrue;
|
|
56
57
|
return __generator(this, function (_a) {
|
|
@@ -120,14 +121,19 @@ function testPosition() {
|
|
|
120
121
|
case 0:
|
|
121
122
|
now = datetime_1.ZonedDateTime.now();
|
|
122
123
|
portfolioService = new PortfolioService_1.PortfolioService();
|
|
123
|
-
return [4 /*yield*/, portfolioService.searchPortfolio(now.toProto(), field_pb_1.FieldProto.PORTFOLIO_NAME,
|
|
124
|
+
return [4 /*yield*/, portfolioService.searchPortfolio(now.toProto(), new positionfilter_1.PositionFilter().addFilter(field_pb_1.FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings'))];
|
|
124
125
|
case 1:
|
|
125
126
|
portfolios = _a.sent();
|
|
126
127
|
fedReservePortfolio = portfolios[0];
|
|
127
|
-
return [4 /*yield*/, get_position(null, fedReservePortfolio, [measure_pb_1.MeasureProto.DIRECTED_QUANTITY], position_pb_1.PositionTypeProto.TRANSACTION, [field_pb_1.FieldProto.PORTFOLIO_NAME, field_pb_1.FieldProto.SECURITY_ID], [], now)];
|
|
128
|
+
return [4 /*yield*/, get_position(null, fedReservePortfolio.proto, [measure_pb_1.MeasureProto.DIRECTED_QUANTITY], position_pb_1.PositionTypeProto.TRANSACTION, [field_pb_1.FieldProto.PORTFOLIO_NAME, field_pb_1.FieldProto.SECURITY_ID], [], now)];
|
|
128
129
|
case 2:
|
|
129
130
|
positions = _a.sent();
|
|
130
|
-
|
|
131
|
+
if (positions) {
|
|
132
|
+
console.log(positions.length + " positions returned");
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
console.log("No positions found");
|
|
136
|
+
}
|
|
131
137
|
return [2 /*return*/, true];
|
|
132
138
|
}
|
|
133
139
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.test.js","sourceRoot":"","sources":["position.test.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAET,8FAA+F;AAC/F,+EAAuG;AAEvG,6EAA8E;AAG9E,cAAc;AACd,yEAA0E;AAC1E,yFAAqF;AACrF,6FAA6F;AAC7F,wDAA4D;AAE5D,4EAA6D;AAC7D,iEAA6D;AAE7D,qBAAqB;AACrB,sFAAqF;AACrF,mFAAkF;AAClF,6GAA4G;
|
|
1
|
+
{"version":3,"file":"position.test.js","sourceRoot":"","sources":["position.test.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAET,8FAA+F;AAC/F,+EAAuG;AAEvG,6EAA8E;AAG9E,cAAc;AACd,yEAA0E;AAC1E,yFAAqF;AACrF,6FAA6F;AAC7F,wDAA4D;AAE5D,4EAA6D;AAC7D,iEAA6D;AAE7D,qBAAqB;AACrB,sFAAqF;AACrF,mFAAkF;AAClF,6GAA4G;AAC5G,uEAAsE;AAEtE,IAAI,CAAC,yEAAyE,EAAE;;;;oBAC/D,qBAAM,YAAY,EAAE,EAAA;;gBAA7B,MAAM,GAAG,SAAoB;gBACnC,MAAM,CAAC,MA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SAE4E;oBACvF,mBAAmB,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;oBAE1B,qBAAM,YAAY,CAAC,IAAI,EAAE,mBAAmB,CAAC,KAAK,EAChE,CAAC,yBAAY,CAAC,iBAAiB,CAAC,EAChC,+BAAiB,CAAC,WAAW,EAC7B,CAAC,qBAAU,CAAC,cAAc,EAAE,qBAAU,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,EAAA;;oBAH3D,SAAS,GAAG,SAG+C;oBAG/D,IAAI,SAAS,EAAE;wBACb,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,qBAAqB,CAAC,CAAA;qBACtD;yBAAM;wBACL,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;qBACnC;oBACD,sBAAO,IAAI,EAAC;;;;CACb"}
|
|
@@ -19,65 +19,66 @@ import { Any } from 'google-protobuf/google/protobuf/any_pb';
|
|
|
19
19
|
import { PortfolioService } from '../../services/portfolio-service/PortfolioService';
|
|
20
20
|
import { PositionService } from '../../services/position-service/PositionService';
|
|
21
21
|
import { QueryPositionRequestProto } from '../../../fintekkers/requests/position/query_position_request_pb';
|
|
22
|
+
import { PositionFilter } from '../../models/position/positionfilter';
|
|
22
23
|
|
|
23
24
|
test('test getting a position against the api.fintekkers.org position service', async () => {
|
|
24
25
|
const isTrue = await testPosition();
|
|
25
26
|
expect(isTrue).toBe(true);
|
|
26
27
|
}, 30000);
|
|
27
28
|
|
|
28
|
-
async function get_position(security:SecurityProto,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
async function get_position(security: SecurityProto,
|
|
30
|
+
portfolio: PortfolioProto,
|
|
31
|
+
measures: MeasureProto[],
|
|
32
|
+
position_type: PositionTypeProto,
|
|
33
|
+
fields = [FieldProto.PORTFOLIO, FieldProto.SECURITY],
|
|
34
|
+
additional_filters = [], as_of = ZonedDateTime.now()) {
|
|
35
|
+
const filters = [];
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
if (security !== null && security !== undefined) {
|
|
38
|
+
const id_proto = new IdentifierProto();
|
|
39
|
+
id_proto.setIdentifierValue(security.getIdentifier().getIdentifierValue());
|
|
40
|
+
id_proto.setIdentifierType(security.getIdentifier().getIdentifierType());
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const security_id_packed = new Any();
|
|
43
|
+
security_id_packed.pack(id_proto);
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const fieldMapEntry = new FieldMapEntry();
|
|
46
|
+
fieldMapEntry.setField(FieldProto.IDENTIFIER);
|
|
47
|
+
fieldMapEntry.setFieldValuePacked(security_id_packed);
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
filters.push(fieldMapEntry);
|
|
50
|
+
}
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
if (portfolio !== null && portfolio !== undefined) {
|
|
53
|
+
const fieldMapEntry = new FieldMapEntry();
|
|
54
|
+
fieldMapEntry.setField(FieldProto.PORTFOLIO_NAME);
|
|
55
|
+
fieldMapEntry.setFieldValuePacked(pack(portfolio.getPortfolioName()));
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
filters.push(fieldMapEntry);
|
|
58
|
+
}
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
if (additional_filters !== null && additional_filters.length > 0) {
|
|
61
|
+
filters.push(...additional_filters);
|
|
62
|
+
}
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
const filter_fields = new PositionFilterProto();
|
|
65
|
+
filter_fields.setFiltersList(filters);
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
const as_of_proto = as_of.toProto();
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
const request = new QueryPositionRequestProto();
|
|
70
|
+
request.setPositionType(position_type);
|
|
71
|
+
request.setPositionView(PositionViewProto.DEFAULT_VIEW);
|
|
72
|
+
request.setFieldsList(fields);
|
|
73
|
+
request.setMeasuresList(measures);
|
|
74
|
+
request.setFilterFields(filter_fields);
|
|
75
|
+
request.setAsOf(as_of_proto);
|
|
75
76
|
|
|
76
|
-
|
|
77
|
+
let position_service = new PositionService();
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
const positions = await position_service.search(request);
|
|
80
|
+
|
|
81
|
+
return positions;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
async function testPosition(): Promise<boolean> {
|
|
@@ -85,21 +86,23 @@ async function testPosition(): Promise<boolean> {
|
|
|
85
86
|
const now = ZonedDateTime.now();
|
|
86
87
|
|
|
87
88
|
const portfolioService = new PortfolioService();
|
|
88
|
-
|
|
89
|
+
|
|
89
90
|
let portfolios = await portfolioService.searchPortfolio(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"Federal Reserve SOMA Holdings");
|
|
91
|
+
now.toProto(),
|
|
92
|
+
new PositionFilter().addFilter(FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings'));
|
|
93
93
|
const fedReservePortfolio = portfolios[0];
|
|
94
94
|
|
|
95
|
-
let positions = await get_position(null, fedReservePortfolio,
|
|
96
|
-
[MeasureProto.DIRECTED_QUANTITY],
|
|
95
|
+
let positions = await get_position(null, fedReservePortfolio.proto,
|
|
96
|
+
[MeasureProto.DIRECTED_QUANTITY],
|
|
97
97
|
PositionTypeProto.TRANSACTION,
|
|
98
98
|
[FieldProto.PORTFOLIO_NAME, FieldProto.SECURITY_ID], [], now);
|
|
99
99
|
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
if (positions) {
|
|
102
|
+
console.log(positions.length + " positions returned")
|
|
103
|
+
} else {
|
|
104
|
+
console.log("No positions found");
|
|
105
|
+
}
|
|
103
106
|
return true;
|
|
104
107
|
}
|
|
105
108
|
|
|
@@ -38,14 +38,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.SecurityService = void 0;
|
|
40
40
|
var util_1 = require("util");
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
var position_filter_pb_1 = require("../../../fintekkers/models/position/position_filter_pb");
|
|
41
|
+
var security_1 = require("../../models/security/security");
|
|
42
|
+
var dt = require("../../models/utils/datetime");
|
|
44
43
|
// Requests & Services
|
|
45
44
|
var security_service_grpc_pb_1 = require("../../../fintekkers/services/security-service/security_service_grpc_pb");
|
|
46
45
|
var query_security_request_pb_1 = require("../../../fintekkers/requests/security/query_security_request_pb");
|
|
47
46
|
var create_security_request_pb_1 = require("../../../fintekkers/requests/security/create_security_request_pb");
|
|
48
|
-
var security_1 = require("../../models/security/security");
|
|
49
47
|
var requestcontext_1 = require("../../models/utils/requestcontext");
|
|
50
48
|
var SecurityService = /** @class */ (function () {
|
|
51
49
|
function SecurityService() {
|
|
@@ -89,7 +87,16 @@ var SecurityService = /** @class */ (function () {
|
|
|
89
87
|
});
|
|
90
88
|
});
|
|
91
89
|
};
|
|
92
|
-
SecurityService.prototype.
|
|
90
|
+
SecurityService.prototype.searchSecurityAsOfNow = function (positionFilter) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var now;
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
now = dt.ZonedDateTime.now().toProto();
|
|
95
|
+
return [2 /*return*/, this.searchSecurity(now, positionFilter)];
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
SecurityService.prototype.searchSecurity = function (asOf, positionFilter) {
|
|
93
100
|
return __awaiter(this, void 0, void 0, function () {
|
|
94
101
|
function processStreamSynchronously() {
|
|
95
102
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -113,7 +120,7 @@ var SecurityService = /** @class */ (function () {
|
|
|
113
120
|
});
|
|
114
121
|
});
|
|
115
122
|
}
|
|
116
|
-
var searchRequest,
|
|
123
|
+
var searchRequest, tmpClient, listSecurities;
|
|
117
124
|
return __generator(this, function (_a) {
|
|
118
125
|
switch (_a.label) {
|
|
119
126
|
case 0:
|
|
@@ -121,12 +128,7 @@ var SecurityService = /** @class */ (function () {
|
|
|
121
128
|
searchRequest.setObjectClass('SecurityRequest');
|
|
122
129
|
searchRequest.setVersion('0.0.1');
|
|
123
130
|
searchRequest.setAsOf(asOf);
|
|
124
|
-
positionFilter
|
|
125
|
-
positionFilter.setObjectClass('PositionFilter');
|
|
126
|
-
positionFilter.setVersion('0.0.1');
|
|
127
|
-
fieldMapEntry = (0, serialization_util_1.createFieldMapEntry)(fieldProto, fieldValue);
|
|
128
|
-
positionFilter.setFiltersList([fieldMapEntry]);
|
|
129
|
-
searchRequest.setSearchSecurityInput(positionFilter);
|
|
131
|
+
searchRequest.setSearchSecurityInput(positionFilter.toProto());
|
|
130
132
|
tmpClient = this.client;
|
|
131
133
|
listSecurities = [];
|
|
132
134
|
return [4 /*yield*/, processStreamSynchronously()];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecurityService.js","sourceRoot":"","sources":["SecurityService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"SecurityService.js","sourceRoot":"","sources":["SecurityService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAAiC;AAMjC,2DAAsD;AAItD,gDAAkD;AAElD,sBAAsB;AACtB,mHAAwG;AACxG,6GAA4G;AAE5G,+GAA8G;AAG9G,oEAA0D;AAE1D;IAGE;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,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ED,IAqEC;AAEQ,0CAAe"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import * as grpc from '@grpc/grpc-js';
|
|
2
1
|
import { promisify } from 'util';
|
|
3
2
|
|
|
4
3
|
// Models
|
|
5
4
|
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
6
|
-
import { createFieldMapEntry } from '../../models/utils/serialization.util';
|
|
7
5
|
import { LocalTimestampProto } from '../../../fintekkers/models/util/local_timestamp_pb';
|
|
8
6
|
import { SummaryProto } from '../../../fintekkers/requests/util/errors/summary_pb';
|
|
7
|
+
import Security from '../../models/security/security';
|
|
9
8
|
|
|
10
9
|
// Model Utils
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
10
|
+
import { PositionFilter } from '../../models/position/positionfilter';
|
|
11
|
+
import * as dt from '../../models/utils/datetime';
|
|
13
12
|
|
|
14
13
|
// Requests & Services
|
|
15
14
|
import { SecurityClient } from '../../../fintekkers/services/security-service/security_service_grpc_pb';
|
|
@@ -17,7 +16,7 @@ import { QuerySecurityRequestProto } from '../../../fintekkers/requests/security
|
|
|
17
16
|
import { QuerySecurityResponseProto } from '../../../fintekkers/requests/security/query_security_response_pb';
|
|
18
17
|
import { CreateSecurityRequestProto } from '../../../fintekkers/requests/security/create_security_request_pb';
|
|
19
18
|
import { CreateSecurityResponseProto } from '../../../fintekkers/requests/security/create_security_response_pb';
|
|
20
|
-
|
|
19
|
+
|
|
21
20
|
import EnvConfig from '../../models/utils/requestcontext';
|
|
22
21
|
|
|
23
22
|
class SecurityService {
|
|
@@ -49,20 +48,18 @@ class SecurityService {
|
|
|
49
48
|
return response;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
async
|
|
51
|
+
async searchSecurityAsOfNow(positionFilter: PositionFilter): Promise<Security[]> {
|
|
52
|
+
const now = dt.ZonedDateTime.now().toProto();
|
|
53
|
+
return this.searchSecurity(now, positionFilter);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async searchSecurity(asOf: LocalTimestampProto, positionFilter: PositionFilter): Promise<Security[]> {
|
|
53
57
|
const searchRequest = new QuerySecurityRequestProto();
|
|
54
58
|
searchRequest.setObjectClass('SecurityRequest');
|
|
55
59
|
searchRequest.setVersion('0.0.1');
|
|
56
60
|
searchRequest.setAsOf(asOf);
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
positionFilter.setObjectClass('PositionFilter');
|
|
60
|
-
positionFilter.setVersion('0.0.1');
|
|
61
|
-
|
|
62
|
-
const fieldMapEntry = createFieldMapEntry(fieldProto, fieldValue);
|
|
63
|
-
positionFilter.setFiltersList([fieldMapEntry]);
|
|
64
|
-
|
|
65
|
-
searchRequest.setSearchSecurityInput(positionFilter);
|
|
62
|
+
searchRequest.setSearchSecurityInput(positionFilter.toProto());
|
|
66
63
|
|
|
67
64
|
const tmpClient = this.client;
|
|
68
65
|
|
|
@@ -72,7 +69,7 @@ class SecurityService {
|
|
|
72
69
|
const stream2 = tmpClient.search(searchRequest);
|
|
73
70
|
|
|
74
71
|
return new Promise<Security[]>((resolve, reject) => {
|
|
75
|
-
stream2.on('data', (response:QuerySecurityResponseProto) => {
|
|
72
|
+
stream2.on('data', (response: QuerySecurityResponseProto) => {
|
|
76
73
|
response.getSecurityResponseList().forEach((security) => {
|
|
77
74
|
listSecurities.push(new Security(security));
|
|
78
75
|
});
|
|
@@ -84,7 +81,7 @@ class SecurityService {
|
|
|
84
81
|
|
|
85
82
|
stream2.on('error', (err) => {
|
|
86
83
|
console.error('Error in the stream:', err);
|
|
87
|
-
reject(err);
|
|
84
|
+
reject(err);
|
|
88
85
|
});
|
|
89
86
|
});
|
|
90
87
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
// Model Utils
|
|
40
|
+
var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
41
|
+
var SecurityService_1 = require("./SecurityService");
|
|
42
|
+
var positionfilter_1 = require("../../models/position/positionfilter");
|
|
43
|
+
test('test the api.fintekkers.org security service by creating a maturity ladder for the US government', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
+
var securityService, positionFilter, securities;
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
switch (_a.label) {
|
|
47
|
+
case 0:
|
|
48
|
+
securityService = new SecurityService_1.SecurityService();
|
|
49
|
+
positionFilter = new positionfilter_1.PositionFilter();
|
|
50
|
+
positionFilter.addFilter(field_pb_1.FieldProto.SECURITY_ISSUER_NAME, "US Government");
|
|
51
|
+
return [4 /*yield*/, securityService.searchSecurityAsOfNow(positionFilter)];
|
|
52
|
+
case 1:
|
|
53
|
+
securities = _a.sent();
|
|
54
|
+
console.log(securities.length);
|
|
55
|
+
return [2 /*return*/];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}); }, 30000);
|
|
59
|
+
//# sourceMappingURL=security.maturityLadder.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.maturityLadder.test.js","sourceRoot":"","sources":["security.maturityLadder.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,cAAc;AACd,yEAA0E;AAM1E,qDAAoD;AACpD,uEAAsE;AAEtE,IAAI,CAAC,kGAAkG,EAAE;;;;;gBAG/F,eAAe,GAAG,IAAI,iCAAe,EAAE,CAAC;gBAExC,cAAc,GAAG,IAAI,+BAAc,EAAE,CAAC;gBAC5C,cAAc,CAAC,SAAS,CAAC,qBAAU,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC;gBACxD,qBAAM,eAAe,CAAC,qBAAqB,CAAC,cAAc,CAAC,EAAA;;gBAAxE,UAAU,GAAG,SAA2D;gBAG9E,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;;;;KASlC,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Models
|
|
2
|
+
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
3
|
+
import { CouponFrequencyProto } from '../../../fintekkers/models/security/coupon_frequency_pb';
|
|
4
|
+
import { DecimalValueProto } from '../../../fintekkers/models/util/decimal_value_pb';
|
|
5
|
+
import { CouponTypeProto } from '../../../fintekkers/models/security/coupon_type_pb';
|
|
6
|
+
import { SecurityTypeProto } from '../../../fintekkers/models/security/security_type_pb';
|
|
7
|
+
import { LocalDateProto } from '../../../fintekkers/models/util/local_date_pb';
|
|
8
|
+
|
|
9
|
+
// Model Utils
|
|
10
|
+
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
11
|
+
|
|
12
|
+
import * as uuid from '../../models/utils/uuid';
|
|
13
|
+
import * as dt from '../../models/utils/datetime';
|
|
14
|
+
|
|
15
|
+
import { CreateSecurityResponseProto } from '../../../fintekkers/requests/security/create_security_response_pb';
|
|
16
|
+
import { SecurityService } from './SecurityService';
|
|
17
|
+
import { PositionFilter } from '../../models/position/positionfilter';
|
|
18
|
+
|
|
19
|
+
test('test the api.fintekkers.org security service by creating a maturity ladder for the US government', async () => {
|
|
20
|
+
//TODO: Get list of all securities from the US government, with a maturity data beyond today's date
|
|
21
|
+
|
|
22
|
+
const securityService = new SecurityService();
|
|
23
|
+
|
|
24
|
+
const positionFilter = new PositionFilter();
|
|
25
|
+
positionFilter.addFilter(FieldProto.SECURITY_ISSUER_NAME, "US Government");
|
|
26
|
+
const securities = await securityService.searchSecurityAsOfNow(positionFilter);
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
console.log(securities.length);
|
|
30
|
+
//TODO: Get oustanding amount of bond
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
//TODO: Map results into Map -> Date, Amount
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
//TODO: Loose end. Asset Class is a string. Maybe should be an 'extendible' enum
|
|
37
|
+
//TODO: Loose end. Security coupon rate, need to add validation logic so that coupon rate is a sensible number
|
|
38
|
+
}, 30000);
|
|
39
|
+
|
|
@@ -48,6 +48,7 @@ var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
|
48
48
|
var uuid = require("../../models/utils/uuid");
|
|
49
49
|
var dt = require("../../models/utils/datetime");
|
|
50
50
|
var SecurityService_1 = require("./SecurityService");
|
|
51
|
+
var positionfilter_1 = require("../../models/position/positionfilter");
|
|
51
52
|
test('test creating a security against the api.fintekkers.org security service', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
53
|
var isTrue;
|
|
53
54
|
return __generator(this, function (_a) {
|
|
@@ -70,7 +71,7 @@ function testSecurity() {
|
|
|
70
71
|
now = dt.ZonedDateTime.now();
|
|
71
72
|
securityService = new SecurityService_1.SecurityService();
|
|
72
73
|
return [4 /*yield*/, securityService
|
|
73
|
-
.searchSecurity(now.toProto(), field_pb_1.FieldProto.ASSET_CLASS, 'Cash')
|
|
74
|
+
.searchSecurity(now.toProto(), new positionfilter_1.PositionFilter().addFilter(field_pb_1.FieldProto.ASSET_CLASS, 'Cash'))
|
|
74
75
|
.then(function (securities) {
|
|
75
76
|
return securities[0];
|
|
76
77
|
})];
|
|
@@ -108,12 +109,15 @@ function testSecurity() {
|
|
|
108
109
|
return [4 /*yield*/, securityService.validateCreateSecurity(security)];
|
|
109
110
|
case 2:
|
|
110
111
|
validationSummary = _a.sent();
|
|
112
|
+
expect(validationSummary.getErrorsList().length).toBe(0);
|
|
111
113
|
return [4 /*yield*/, securityService.createSecurity(security)];
|
|
112
114
|
case 3:
|
|
113
115
|
createSecurityResponse = _a.sent();
|
|
114
|
-
|
|
116
|
+
expect(createSecurityResponse.getSecurityResponse()).toBeTruthy();
|
|
117
|
+
return [4 /*yield*/, securityService.searchSecurity(now.toProto(), new positionfilter_1.PositionFilter().addFilter(field_pb_1.FieldProto.ASSET_CLASS, 'Fixed Income'))];
|
|
115
118
|
case 4:
|
|
116
119
|
searchResults = _a.sent();
|
|
120
|
+
expect(searchResults.length).toBeGreaterThan(0);
|
|
117
121
|
return [2 /*return*/, true];
|
|
118
122
|
}
|
|
119
123
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.test.js","sourceRoot":"","sources":["security.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT,+EAAgF;AAChF,+FAA+F;AAC/F,qFAAqF;AACrF,qFAAqF;AACrF,yFAAyF;AACzF,+EAA+E;AAE/E,cAAc;AACd,yEAA0E;AAE1E,8CAAgD;AAChD,gDAAkD;AAGlD,qDAAoD;
|
|
1
|
+
{"version":3,"file":"security.test.js","sourceRoot":"","sources":["security.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT,+EAAgF;AAChF,+FAA+F;AAC/F,qFAAqF;AACrF,qFAAqF;AACrF,yFAAyF;AACzF,+EAA+E;AAE/E,cAAc;AACd,yEAA0E;AAE1E,8CAAgD;AAChD,gDAAkD;AAGlD,qDAAoD;AACpD,uEAAsE;AAEtE,IAAI,CAAC,0EAA0E,EAAE;;;;oBAChE,qBAAM,YAAY,EAAE,EAAA;;gBAA7B,MAAM,GAAG,SAAoB;gBACnC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,C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