@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
|
@@ -14,6 +14,7 @@ import * as dt from '../../models/utils/datetime';
|
|
|
14
14
|
|
|
15
15
|
import { CreateSecurityResponseProto } from '../../../fintekkers/requests/security/create_security_response_pb';
|
|
16
16
|
import { SecurityService } from './SecurityService';
|
|
17
|
+
import { PositionFilter } from '../../models/position/positionfilter';
|
|
17
18
|
|
|
18
19
|
test('test creating a security against the api.fintekkers.org security service', async () => {
|
|
19
20
|
const isTrue = await testSecurity();
|
|
@@ -27,7 +28,7 @@ async function testSecurity(): Promise<boolean> {
|
|
|
27
28
|
const securityService = new SecurityService();
|
|
28
29
|
|
|
29
30
|
let usd_security = await securityService
|
|
30
|
-
.searchSecurity(now.toProto(), FieldProto.ASSET_CLASS, 'Cash')
|
|
31
|
+
.searchSecurity(now.toProto(), new PositionFilter().addFilter(FieldProto.ASSET_CLASS, 'Cash'))
|
|
31
32
|
.then((securities) => {
|
|
32
33
|
return securities[0];
|
|
33
34
|
});
|
|
@@ -68,10 +69,13 @@ async function testSecurity(): Promise<boolean> {
|
|
|
68
69
|
security.setDescription('Dummy US Treasury 10Y Bond');
|
|
69
70
|
|
|
70
71
|
var validationSummary = await securityService.validateCreateSecurity(security);
|
|
72
|
+
expect(validationSummary.getErrorsList().length).toBe(0);
|
|
71
73
|
|
|
72
|
-
var createSecurityResponse:CreateSecurityResponseProto = await securityService.createSecurity(security);
|
|
74
|
+
var createSecurityResponse: CreateSecurityResponseProto = await securityService.createSecurity(security);
|
|
75
|
+
expect(createSecurityResponse.getSecurityResponse()).toBeTruthy();
|
|
73
76
|
|
|
74
|
-
var searchResults = await securityService.searchSecurity(now.toProto(), FieldProto.ASSET_CLASS, 'Fixed Income');
|
|
77
|
+
var searchResults = await securityService.searchSecurity(now.toProto(), new PositionFilter().addFilter(FieldProto.ASSET_CLASS, 'Fixed Income'));
|
|
78
|
+
expect(searchResults.length).toBeGreaterThan(0);
|
|
75
79
|
|
|
76
80
|
return true;
|
|
77
81
|
}
|
|
@@ -40,9 +40,7 @@ exports.TransactionService = void 0;
|
|
|
40
40
|
var util_1 = require("util");
|
|
41
41
|
// Models
|
|
42
42
|
var transaction_1 = require("../../models/transaction/transaction");
|
|
43
|
-
var serialization_util_1 = require("../../models/utils/serialization.util");
|
|
44
43
|
// Model Utils
|
|
45
|
-
var position_filter_pb_1 = require("../../../fintekkers/models/position/position_filter_pb");
|
|
46
44
|
// Requests & Services
|
|
47
45
|
var transaction_service_grpc_pb_1 = require("../../../fintekkers/services/transaction-service/transaction_service_grpc_pb");
|
|
48
46
|
var create_transaction_request_pb_1 = require("../../../fintekkers/requests/transaction/create_transaction_request_pb");
|
|
@@ -90,18 +88,13 @@ var TransactionService = /** @class */ (function () {
|
|
|
90
88
|
});
|
|
91
89
|
});
|
|
92
90
|
};
|
|
93
|
-
TransactionService.prototype.searchTransaction = function (asOf,
|
|
91
|
+
TransactionService.prototype.searchTransaction = function (asOf, positionFilter, maxResults) {
|
|
94
92
|
if (maxResults === void 0) { maxResults = 100; }
|
|
95
93
|
var searchRequest = new query_transaction_request_pb_1.QueryTransactionRequestProto();
|
|
96
94
|
searchRequest.setObjectClass('SecurityRequest');
|
|
97
95
|
searchRequest.setVersion('0.0.1');
|
|
98
96
|
searchRequest.setAsOf(asOf);
|
|
99
|
-
|
|
100
|
-
positionFilter.setObjectClass('PositionFilter');
|
|
101
|
-
positionFilter.setVersion('0.0.1');
|
|
102
|
-
var fieldMapEntry = (0, serialization_util_1.createFieldMapEntry)(fieldProto, fieldValue);
|
|
103
|
-
positionFilter.setFiltersList([fieldMapEntry]);
|
|
104
|
-
searchRequest.setSearchTransactionInput(positionFilter);
|
|
97
|
+
searchRequest.setSearchTransactionInput(positionFilter.toProto());
|
|
105
98
|
searchRequest.setLimit(maxResults);
|
|
106
99
|
var tmpClient = this.client;
|
|
107
100
|
function processStreamSynchronously() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionService.js","sourceRoot":"","sources":["TransactionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TransactionService.js","sourceRoot":"","sources":["TransactionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAAiC;AAEjC,SAAS;AACT,oEAA+D;AAK/D,cAAc;AAEd,sBAAsB;AACtB,4HAAiH;AACjH,wHAAuH;AAEvH,sHAAqH;AAErH,oEAA0D;AAG1D;IAGE;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,+CAAiB,CAAC,wBAAS,CAAC,MAAM,EAAE,wBAAS,CAAC,cAAc,CAAC,CAAC;IAClF,CAAC;IAEK,sDAAyB,GAA/B,UAAgC,WAAwB;;;;;;wBAChD,aAAa,GAAG,IAAI,6DAA6B,EAAE,CAAC;wBAC1D,aAAa,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;wBACnD,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;wBAClC,aAAa,CAAC,yBAAyB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;wBAErD,2BAA2B,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;wBACnF,qBAAM,2BAA2B,CAAC,aAAa,CAAC,EAAA;;wBAA3D,QAAQ,GAAG,SAAgD;wBACjE,sBAAO,QAAQ,EAAC;;;;KACjB;IAEK,8CAAiB,GAAvB,UAAwB,WAAwB;;;;;;wBACxC,aAAa,GAAG,IAAI,6DAA6B,EAAE,CAAC;wBAC1D,aAAa,CAAC,cAAc,CAAC,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CAAC,CAAC;gCACpB,CAAC,CAAC,CAAA;4BACJ,CAAC,CAAC,CAAC;4BAEH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;gCAChB,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;gCAClD,OAAO,CAAC,OAAO,CAAC,CAAC;4BACnB,CAAC,CAAC,CAAC;4BAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,GAAG;gCACtB,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;gCAC3C,MAAM,CAAC,GAAG,CAAC,CAAC;4BACd,CAAC,CAAC,CAAC;wBACL,CAAC,CAAC,EAAC;;;SACJ;QAED,OAAO,0BAA0B,EAAE,CAAC;IACtC,CAAC;IACH,yBAAC;AAAD,CAAC,AAnED,IAmEC;AAEQ,gDAAkB"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import * as grpc from '@grpc/grpc-js';
|
|
2
1
|
import { promisify } from 'util';
|
|
3
2
|
|
|
4
3
|
// Models
|
|
5
4
|
import Transaction from '../../models/transaction/transaction';
|
|
6
|
-
import {
|
|
5
|
+
import { PositionFilter } from '../../models/position/positionfilter';
|
|
7
6
|
import { LocalTimestampProto } from '../../../fintekkers/models/util/local_timestamp_pb';
|
|
8
7
|
import { SummaryProto } from '../../../fintekkers/requests/util/errors/summary_pb';
|
|
9
8
|
|
|
10
9
|
// Model Utils
|
|
11
|
-
import { PositionFilterProto } from '../../../fintekkers/models/position/position_filter_pb';
|
|
12
|
-
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
13
10
|
|
|
14
11
|
// Requests & Services
|
|
15
12
|
import { TransactionClient } from '../../../fintekkers/services/transaction-service/transaction_service_grpc_pb';
|
|
@@ -49,33 +46,26 @@ class TransactionService {
|
|
|
49
46
|
return response;
|
|
50
47
|
}
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
searchTransaction(asOf: LocalTimestampProto, positionFilter: PositionFilter, maxResults: number = 100):
|
|
50
|
+
Promise<Transaction[]> {
|
|
54
51
|
const searchRequest = new QueryTransactionRequestProto();
|
|
55
52
|
searchRequest.setObjectClass('SecurityRequest');
|
|
56
53
|
searchRequest.setVersion('0.0.1');
|
|
57
54
|
searchRequest.setAsOf(asOf);
|
|
58
55
|
|
|
59
|
-
|
|
60
|
-
positionFilter.setObjectClass('PositionFilter');
|
|
61
|
-
positionFilter.setVersion('0.0.1');
|
|
62
|
-
|
|
63
|
-
const fieldMapEntry = createFieldMapEntry(fieldProto, fieldValue);
|
|
64
|
-
positionFilter.setFiltersList([fieldMapEntry]);
|
|
65
|
-
|
|
66
|
-
searchRequest.setSearchTransactionInput(positionFilter);
|
|
56
|
+
searchRequest.setSearchTransactionInput(positionFilter.toProto());
|
|
67
57
|
searchRequest.setLimit(maxResults);
|
|
68
58
|
|
|
69
59
|
const tmpClient = this.client;
|
|
70
60
|
|
|
71
61
|
async function processStreamSynchronously(): Promise<Transaction[]> {
|
|
72
62
|
const stream2 = tmpClient.search(searchRequest);
|
|
73
|
-
var results:Transaction[] = [];
|
|
63
|
+
var results: Transaction[] = [];
|
|
74
64
|
|
|
75
65
|
return new Promise<Transaction[]>((resolve, reject) => {
|
|
76
|
-
stream2.on('data', (response:QueryTransactionResponseProto) => {
|
|
66
|
+
stream2.on('data', (response: QueryTransactionResponseProto) => {
|
|
77
67
|
response.getTransactionResponseList().forEach((transaction) => {
|
|
78
|
-
const txn:Transaction = new Transaction(transaction);
|
|
68
|
+
const txn: Transaction = new Transaction(transaction);
|
|
79
69
|
results.push(txn);
|
|
80
70
|
})
|
|
81
71
|
});
|
|
@@ -87,7 +77,7 @@ class TransactionService {
|
|
|
87
77
|
|
|
88
78
|
stream2.on('error', (err) => {
|
|
89
79
|
console.error('Error in the stream:', err);
|
|
90
|
-
reject(err);
|
|
80
|
+
reject(err);
|
|
91
81
|
});
|
|
92
82
|
});
|
|
93
83
|
}
|
|
@@ -51,6 +51,7 @@ var PortfolioService_1 = require("../portfolio-service/PortfolioService");
|
|
|
51
51
|
var TransactionService_1 = require("./TransactionService");
|
|
52
52
|
var transaction_1 = require("../../models/transaction/transaction");
|
|
53
53
|
var assert = require("assert");
|
|
54
|
+
var positionfilter_1 = require("../../models/position/positionfilter");
|
|
54
55
|
test('test creating a transaction against the portfolio service', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
56
|
var isTrue;
|
|
56
57
|
return __generator(this, function (_a) {
|
|
@@ -65,7 +66,7 @@ test('test creating a transaction against the portfolio service', function () {
|
|
|
65
66
|
}); }, 30000);
|
|
66
67
|
function testTransaction() {
|
|
67
68
|
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
-
var id_proto, now, today, securityService, portfolioService, transactionService, fixedIncomeSecurities, security, portfolios, portfolio, transaction, createTransactionResponse, transactionResponse, transactions;
|
|
69
|
+
var id_proto, now, today, securityService, portfolioService, transactionService, positionFilter, fixedIncomeSecurities, security, portfolios, portfolio, transaction, createTransactionResponse, transactionResponse, transactionID, transactions;
|
|
69
70
|
return __generator(this, function (_a) {
|
|
70
71
|
switch (_a.label) {
|
|
71
72
|
case 0:
|
|
@@ -75,17 +76,23 @@ function testTransaction() {
|
|
|
75
76
|
securityService = new SecurityService_1.SecurityService();
|
|
76
77
|
portfolioService = new PortfolioService_1.PortfolioService();
|
|
77
78
|
transactionService = new TransactionService_1.TransactionService();
|
|
79
|
+
positionFilter = new positionfilter_1.PositionFilter();
|
|
80
|
+
positionFilter.addFilter(field_pb_1.FieldProto.ASSET_CLASS, 'Fixed Income');
|
|
81
|
+
console.time("searchSecurity");
|
|
78
82
|
return [4 /*yield*/, securityService
|
|
79
|
-
.searchSecurity(now.toProto(),
|
|
83
|
+
.searchSecurity(now.toProto(), positionFilter)
|
|
80
84
|
.then(function (fixedIncomeSecurities) {
|
|
81
85
|
return fixedIncomeSecurities;
|
|
82
86
|
})];
|
|
83
87
|
case 1:
|
|
84
88
|
fixedIncomeSecurities = _a.sent();
|
|
89
|
+
console.timeEnd("searchSecurity");
|
|
85
90
|
security = fixedIncomeSecurities[0];
|
|
86
|
-
|
|
91
|
+
console.time("searchPortfolio");
|
|
92
|
+
return [4 /*yield*/, portfolioService.searchPortfolio(now.toProto(), new positionfilter_1.PositionFilter().addFilter(field_pb_1.FieldProto.PORTFOLIO_NAME, 'TEST PORTFOLIO'))];
|
|
87
93
|
case 2:
|
|
88
94
|
portfolios = _a.sent();
|
|
95
|
+
console.timeEnd("searchPortfolio");
|
|
89
96
|
if (portfolios === undefined) {
|
|
90
97
|
throw new Error('No portfolios found');
|
|
91
98
|
}
|
|
@@ -109,16 +116,25 @@ function testTransaction() {
|
|
|
109
116
|
.setUuid(uuid.UUID.random().toUUIDProto())
|
|
110
117
|
.setPrice(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('100.00')));
|
|
111
118
|
transaction.setQuantity(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('10000.00'));
|
|
112
|
-
transaction.setPortfolio(portfolio);
|
|
119
|
+
transaction.setPortfolio(portfolio.proto);
|
|
113
120
|
transaction.setSecurity(security.proto);
|
|
121
|
+
// var validationSummary = await transactionService.validateCreateTransaction(new Transaction(transaction));
|
|
122
|
+
// assert(validationSummary.getErrorsList().length == 0, "Validation errors found");
|
|
123
|
+
console.time("createTransaction");
|
|
114
124
|
return [4 /*yield*/, transactionService.createTransaction(new transaction_1.default(transaction))];
|
|
115
125
|
case 3:
|
|
116
126
|
createTransactionResponse = _a.sent();
|
|
117
127
|
transactionResponse = createTransactionResponse.getTransactionResponse();
|
|
118
128
|
assert(transactionResponse, "No transaction response found");
|
|
119
|
-
|
|
129
|
+
console.timeEnd("createTransaction");
|
|
130
|
+
console.log("Searching transaction");
|
|
131
|
+
console.time("searchTransaction");
|
|
132
|
+
transactionID = uuid.UUID.fromU8Array(transactionResponse.getUuid().getRawUuid_asU8());
|
|
133
|
+
positionFilter.addFilter(field_pb_1.FieldProto.ID, transactionID);
|
|
134
|
+
return [4 /*yield*/, transactionService.searchTransaction(now.toProto(), positionFilter)];
|
|
120
135
|
case 4:
|
|
121
136
|
transactions = _a.sent();
|
|
137
|
+
console.timeEnd("searchTransaction");
|
|
122
138
|
if (transactions === undefined) {
|
|
123
139
|
console.log('No transactions found');
|
|
124
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.test.js","sourceRoot":"","sources":["transaction.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT,qFAAqF;AACrF,+EAA+E;AAE/E,cAAc;AACd,yEAA0E;AAE1E,8CAAgD;AAChD,gDAAkD;AAElD,uEAAsE;AACtE,kGAAkG;AAClG,wFAAyF;AACzF,sEAAuE;AACvE,0EAAyE;AACzE,2DAA0D;AAC1D,oEAA+D;AAG/D,+BAAkC;
|
|
1
|
+
{"version":3,"file":"transaction.test.js","sourceRoot":"","sources":["transaction.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT,qFAAqF;AACrF,+EAA+E;AAE/E,cAAc;AACd,yEAA0E;AAE1E,8CAAgD;AAChD,gDAAkD;AAElD,uEAAsE;AACtE,kGAAkG;AAClG,wFAAyF;AACzF,sEAAuE;AACvE,0EAAyE;AACzE,2DAA0D;AAC1D,oEAA+D;AAG/D,+BAAkC;AAClC,uEAAsE;AAEtE,IAAI,CAAC,2DAA2D,EAAE;;;;oBACjD,qBAAM,eAAe,EAAE,EAAA;;gBAAhC,MAAM,GAAG,SAAuB;gBACtC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;;KAC3B,EAAE,KAAK,CAAC,CAAC;AAEV,SAAe,eAAe;;;;;;oBACtB,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;oBAC5C,GAAG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C,KAAK,CAAC,CAAC;oBAExC,4GAA4G;oBAC5G,oFAAoF;oBAGpF,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;oBAC8B,qBAAM,kBAAkB,CAAC,iBAAiB,CAAC,IAAI,qBAAW,CAAC,WAAW,CAAC,CAAC,EAAA;;oBAApI,yBAAyB,GAAmC,SAAwE;oBAClI,mBAAmB,GAAG,yBAAyB,CAAC,sBAAsB,EAAE,CAAC;oBAC/E,MAAM,CAAC,mBAAmB,EAAE,+BAA+B,CAAC,CAAC;oBAE7D,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;oBAErC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;oBAErC,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;oBAE5B,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC,eAAe,EAAE,CAAC,CAAC;oBAC7F,cAAc,CAAC,SAAS,CAAC,qBAAU,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;oBAClC,qBAAM,kBAAkB,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,EAAA;;oBAAxF,YAAY,GAAG,SAAyE;oBAC9F,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;oBAErC,IAAI,YAAY,KAAK,SAAS,EAAE;wBAC9B,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;qBACtC;yBAAM;wBACL,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;qBAClC;oBAED,sBAAO,IAAI,EAAC;;;;CACb"}
|
|
@@ -18,9 +18,10 @@ import Transaction from '../../models/transaction/transaction';
|
|
|
18
18
|
import { CreateTransactionResponseProto } from '../../../fintekkers/requests/transaction/create_transaction_response_pb';
|
|
19
19
|
|
|
20
20
|
import assert = require("assert");
|
|
21
|
+
import { PositionFilter } from '../../models/position/positionfilter';
|
|
21
22
|
|
|
22
23
|
test('test creating a transaction against the portfolio service', async () => {
|
|
23
|
-
const isTrue =
|
|
24
|
+
const isTrue = await testTransaction();
|
|
24
25
|
expect(isTrue).toBe(true);
|
|
25
26
|
}, 30000);
|
|
26
27
|
|
|
@@ -33,26 +34,32 @@ async function testTransaction(): Promise<boolean> {
|
|
|
33
34
|
const portfolioService = new PortfolioService();
|
|
34
35
|
const transactionService = new TransactionService();
|
|
35
36
|
|
|
37
|
+
const positionFilter = new PositionFilter();
|
|
38
|
+
positionFilter.addFilter(FieldProto.ASSET_CLASS, 'Fixed Income');
|
|
39
|
+
|
|
40
|
+
console.time("searchSecurity");
|
|
36
41
|
let fixedIncomeSecurities = await securityService
|
|
37
|
-
.searchSecurity(now.toProto(),
|
|
42
|
+
.searchSecurity(now.toProto(), positionFilter)
|
|
38
43
|
.then((fixedIncomeSecurities) => {
|
|
39
44
|
return fixedIncomeSecurities;
|
|
40
45
|
});
|
|
46
|
+
console.timeEnd("searchSecurity");
|
|
41
47
|
|
|
42
48
|
let security = fixedIncomeSecurities[0];
|
|
43
49
|
|
|
50
|
+
console.time("searchPortfolio");
|
|
44
51
|
let portfolios = await portfolioService.searchPortfolio(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if(portfolios === undefined) {
|
|
52
|
+
now.toProto(),
|
|
53
|
+
new PositionFilter().addFilter(FieldProto.PORTFOLIO_NAME, 'TEST PORTFOLIO'));
|
|
54
|
+
console.timeEnd("searchPortfolio");
|
|
55
|
+
|
|
56
|
+
if (portfolios === undefined) {
|
|
50
57
|
throw new Error('No portfolios found');
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
const portfolio = portfolios[0];
|
|
54
61
|
|
|
55
|
-
if(portfolio.getPortfolioName().includes('Federal')){
|
|
62
|
+
if (portfolio.getPortfolioName().includes('Federal')) {
|
|
56
63
|
throw new Error('Portfolio is not a test portfolio! Abandoning test');
|
|
57
64
|
}
|
|
58
65
|
|
|
@@ -73,21 +80,31 @@ async function testTransaction(): Promise<boolean> {
|
|
|
73
80
|
.setUuid(uuid.UUID.random().toUUIDProto())
|
|
74
81
|
.setPrice(new DecimalValueProto().setArbitraryPrecisionValue('100.00'))
|
|
75
82
|
);
|
|
76
|
-
transaction.setQuantity(new DecimalValueProto().setArbitraryPrecisionValue('10000.00'));
|
|
77
|
-
transaction.setPortfolio(portfolio);
|
|
83
|
+
transaction.setQuantity(new DecimalValueProto().setArbitraryPrecisionValue('10000.00'));
|
|
84
|
+
transaction.setPortfolio(portfolio.proto);
|
|
78
85
|
transaction.setSecurity(security.proto);
|
|
79
86
|
|
|
80
87
|
// var validationSummary = await transactionService.validateCreateTransaction(new Transaction(transaction));
|
|
81
88
|
// assert(validationSummary.getErrorsList().length == 0, "Validation errors found");
|
|
82
89
|
|
|
83
|
-
|
|
90
|
+
|
|
91
|
+
console.time("createTransaction");
|
|
92
|
+
var createTransactionResponse: CreateTransactionResponseProto = await transactionService.createTransaction(new Transaction(transaction));
|
|
84
93
|
const transactionResponse = createTransactionResponse.getTransactionResponse();
|
|
85
94
|
assert(transactionResponse, "No transaction response found");
|
|
86
95
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
console.timeEnd("createTransaction");
|
|
97
|
+
|
|
98
|
+
console.log("Searching transaction");
|
|
99
|
+
|
|
100
|
+
console.time("searchTransaction");
|
|
101
|
+
|
|
102
|
+
const transactionID = uuid.UUID.fromU8Array(transactionResponse.getUuid().getRawUuid_asU8());
|
|
103
|
+
positionFilter.addFilter(FieldProto.ID, transactionID);
|
|
104
|
+
const transactions = await transactionService.searchTransaction(now.toProto(), positionFilter);
|
|
105
|
+
console.timeEnd("searchTransaction");
|
|
106
|
+
|
|
107
|
+
if (transactions === undefined) {
|
|
91
108
|
console.log('No transactions found');
|
|
92
109
|
} else {
|
|
93
110
|
console.log(transactions.length);
|
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// source: fintekkers/models/security/bond/auction_type.proto
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview
|
|
4
|
+
* @enhanceable
|
|
5
|
+
* @suppress {missingRequire} reports error on implicit type usages.
|
|
6
|
+
* @suppress {messageConventions} JS Compiler reports an error if a variable or
|
|
7
|
+
* field starts with 'MSG_' and isn't a translatable message.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
// GENERATED CODE -- DO NOT EDIT!
|
|
11
|
+
/* eslint-disable */
|
|
12
|
+
// @ts-nocheck
|
|
13
|
+
|
|
14
|
+
var jspb = require('google-protobuf');
|
|
15
|
+
var goog = jspb;
|
|
16
|
+
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);
|
|
17
|
+
|
|
18
|
+
goog.exportSymbol('proto.fintekkers.models.security.bond.AuctionTypeProto', null, global);
|
|
19
|
+
/**
|
|
20
|
+
* @enum {number}
|
|
21
|
+
*/
|
|
22
|
+
proto.fintekkers.models.security.bond.AuctionTypeProto = {
|
|
23
|
+
UNKNOWN_AUCTION_TYPE: 0,
|
|
24
|
+
SINGLE_PRICE: 1
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
goog.object.extend(exports, proto.fintekkers.models.security.bond);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as jspb from 'google-protobuf'
|
|
2
|
+
|
|
3
|
+
import * as fintekkers_models_security_bond_auction_type_pb from '../../../../fintekkers/models/security/bond/auction_type_pb';
|
|
4
|
+
import * as fintekkers_models_util_decimal_value_pb from '../../../../fintekkers/models/util/decimal_value_pb';
|
|
5
|
+
import * as fintekkers_models_util_local_date_pb from '../../../../fintekkers/models/util/local_date_pb';
|
|
6
|
+
import * as fintekkers_models_util_local_timestamp_pb from '../../../../fintekkers/models/util/local_timestamp_pb';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export class IssuanceProto extends jspb.Message {
|
|
10
|
+
getObjectClass(): string;
|
|
11
|
+
setObjectClass(value: string): IssuanceProto;
|
|
12
|
+
|
|
13
|
+
getVersion(): string;
|
|
14
|
+
setVersion(value: string): IssuanceProto;
|
|
15
|
+
|
|
16
|
+
getAsOf(): fintekkers_models_util_local_timestamp_pb.LocalTimestampProto | undefined;
|
|
17
|
+
setAsOf(value?: fintekkers_models_util_local_timestamp_pb.LocalTimestampProto): IssuanceProto;
|
|
18
|
+
hasAsOf(): boolean;
|
|
19
|
+
clearAsOf(): IssuanceProto;
|
|
20
|
+
|
|
21
|
+
getValidFrom(): fintekkers_models_util_local_timestamp_pb.LocalTimestampProto | undefined;
|
|
22
|
+
setValidFrom(value?: fintekkers_models_util_local_timestamp_pb.LocalTimestampProto): IssuanceProto;
|
|
23
|
+
hasValidFrom(): boolean;
|
|
24
|
+
clearValidFrom(): IssuanceProto;
|
|
25
|
+
|
|
26
|
+
getValidTo(): fintekkers_models_util_local_timestamp_pb.LocalTimestampProto | undefined;
|
|
27
|
+
setValidTo(value?: fintekkers_models_util_local_timestamp_pb.LocalTimestampProto): IssuanceProto;
|
|
28
|
+
hasValidTo(): boolean;
|
|
29
|
+
clearValidTo(): IssuanceProto;
|
|
30
|
+
|
|
31
|
+
getAuctionAnnouncementDate(): fintekkers_models_util_local_date_pb.LocalDateProto | undefined;
|
|
32
|
+
setAuctionAnnouncementDate(value?: fintekkers_models_util_local_date_pb.LocalDateProto): IssuanceProto;
|
|
33
|
+
hasAuctionAnnouncementDate(): boolean;
|
|
34
|
+
clearAuctionAnnouncementDate(): IssuanceProto;
|
|
35
|
+
|
|
36
|
+
getAuctionIssueDate(): fintekkers_models_util_local_date_pb.LocalDateProto | undefined;
|
|
37
|
+
setAuctionIssueDate(value?: fintekkers_models_util_local_date_pb.LocalDateProto): IssuanceProto;
|
|
38
|
+
hasAuctionIssueDate(): boolean;
|
|
39
|
+
clearAuctionIssueDate(): IssuanceProto;
|
|
40
|
+
|
|
41
|
+
getPreauctionOutstandingQuantity(): fintekkers_models_util_decimal_value_pb.DecimalValueProto | undefined;
|
|
42
|
+
setPreauctionOutstandingQuantity(value?: fintekkers_models_util_decimal_value_pb.DecimalValueProto): IssuanceProto;
|
|
43
|
+
hasPreauctionOutstandingQuantity(): boolean;
|
|
44
|
+
clearPreauctionOutstandingQuantity(): IssuanceProto;
|
|
45
|
+
|
|
46
|
+
getAuctionOfferingAmount(): fintekkers_models_util_decimal_value_pb.DecimalValueProto | undefined;
|
|
47
|
+
setAuctionOfferingAmount(value?: fintekkers_models_util_decimal_value_pb.DecimalValueProto): IssuanceProto;
|
|
48
|
+
hasAuctionOfferingAmount(): boolean;
|
|
49
|
+
clearAuctionOfferingAmount(): IssuanceProto;
|
|
50
|
+
|
|
51
|
+
getAuctionType(): fintekkers_models_security_bond_auction_type_pb.AuctionTypeProto;
|
|
52
|
+
setAuctionType(value: fintekkers_models_security_bond_auction_type_pb.AuctionTypeProto): IssuanceProto;
|
|
53
|
+
|
|
54
|
+
getPriceForSinglePriceAuction(): fintekkers_models_util_decimal_value_pb.DecimalValueProto | undefined;
|
|
55
|
+
setPriceForSinglePriceAuction(value?: fintekkers_models_util_decimal_value_pb.DecimalValueProto): IssuanceProto;
|
|
56
|
+
hasPriceForSinglePriceAuction(): boolean;
|
|
57
|
+
clearPriceForSinglePriceAuction(): IssuanceProto;
|
|
58
|
+
|
|
59
|
+
serializeBinary(): Uint8Array;
|
|
60
|
+
toObject(includeInstance?: boolean): IssuanceProto.AsObject;
|
|
61
|
+
static toObject(includeInstance: boolean, msg: IssuanceProto): IssuanceProto.AsObject;
|
|
62
|
+
static serializeBinaryToWriter(message: IssuanceProto, writer: jspb.BinaryWriter): void;
|
|
63
|
+
static deserializeBinary(bytes: Uint8Array): IssuanceProto;
|
|
64
|
+
static deserializeBinaryFromReader(message: IssuanceProto, reader: jspb.BinaryReader): IssuanceProto;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export namespace IssuanceProto {
|
|
68
|
+
export type AsObject = {
|
|
69
|
+
objectClass: string,
|
|
70
|
+
version: string,
|
|
71
|
+
asOf?: fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.AsObject,
|
|
72
|
+
validFrom?: fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.AsObject,
|
|
73
|
+
validTo?: fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.AsObject,
|
|
74
|
+
auctionAnnouncementDate?: fintekkers_models_util_local_date_pb.LocalDateProto.AsObject,
|
|
75
|
+
auctionIssueDate?: fintekkers_models_util_local_date_pb.LocalDateProto.AsObject,
|
|
76
|
+
preauctionOutstandingQuantity?: fintekkers_models_util_decimal_value_pb.DecimalValueProto.AsObject,
|
|
77
|
+
auctionOfferingAmount?: fintekkers_models_util_decimal_value_pb.DecimalValueProto.AsObject,
|
|
78
|
+
auctionType: fintekkers_models_security_bond_auction_type_pb.AuctionTypeProto,
|
|
79
|
+
priceForSinglePriceAuction?: fintekkers_models_util_decimal_value_pb.DecimalValueProto.AsObject,
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|