@fintekkers/ledger-models 0.1.60 → 0.1.62
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/babel.config.js +3 -1
- package/index.js +1 -15
- package/index.js.map +1 -1
- package/index.ts +1 -19
- package/jest.config.js +4 -0
- package/node/fintekkers/models/security/security_pb.test.js +29 -30
- package/node/fintekkers/models/security/security_pb.test.js.map +1 -0
- package/node/fintekkers/models/security/security_pb.test.ts +33 -0
- package/node/fintekkers/requests/transaction/query_transaction_request_pb.d.ts +3 -0
- package/node/fintekkers/requests/transaction/query_transaction_request_pb.js +31 -1
- package/node/fintekkers/requests/transaction/query_transaction_response_pb.d.ts +7 -0
- package/node/fintekkers/requests/transaction/query_transaction_response_pb.js +54 -1
- package/node/wrappers/models/position/position.js +14 -9
- package/node/wrappers/models/position/position.js.map +1 -1
- package/node/wrappers/models/position/position.test.js +43 -0
- package/node/wrappers/models/position/position.test.js.map +1 -0
- package/node/wrappers/models/position/position.test.ts +70 -0
- package/node/wrappers/models/position/position.ts +17 -10
- package/node/wrappers/models/security/security.js +1 -1
- package/node/wrappers/models/security/security.js.map +1 -1
- package/node/wrappers/models/security/security.ts +1 -1
- package/node/wrappers/models/transaction/transaction.js +12 -10
- package/node/wrappers/models/transaction/transaction.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.test.js +26 -0
- package/node/wrappers/models/transaction/transaction.test.js.map +1 -0
- package/node/wrappers/models/transaction/transaction.test.ts +36 -0
- package/node/wrappers/models/transaction/transaction.ts +15 -13
- package/node/wrappers/models/transaction/transaction_type.js +44 -0
- package/node/wrappers/models/transaction/transaction_type.js.map +1 -0
- package/node/wrappers/models/transaction/transaction_type.ts +47 -0
- package/node/wrappers/models/utils/date.js +25 -0
- package/node/wrappers/models/utils/date.js.map +1 -0
- package/node/wrappers/models/utils/date.ts +31 -0
- package/node/wrappers/models/utils/datetime.js +4 -4
- package/node/wrappers/models/utils/datetime.js.map +1 -1
- package/node/wrappers/models/utils/datetime.ts +4 -4
- package/node/wrappers/models/utils/requestcontext.js +55 -0
- package/node/wrappers/models/utils/requestcontext.js.map +1 -0
- package/node/wrappers/models/utils/requestcontext.ts +44 -0
- package/node/wrappers/models/utils/requestcontext_d.js +1 -0
- package/node/wrappers/models/utils/requestcontext_d.js.map +1 -0
- package/node/wrappers/models/utils/requestcontext_d.ts +7 -0
- package/node/wrappers/models/utils/serialization.js +6 -4
- package/node/wrappers/models/utils/serialization.js.map +1 -1
- package/node/wrappers/models/utils/serialization.test.js +13 -54
- package/node/wrappers/models/utils/serialization.test.js.map +1 -1
- package/node/wrappers/models/utils/serialization.test.ts +12 -10
- package/node/wrappers/models/utils/serialization.ts +8 -8
- package/node/wrappers/models/utils/serialization.util.js +76 -0
- package/node/wrappers/models/utils/serialization.util.js.map +1 -0
- package/node/wrappers/models/utils/serialization.util.test.js +24 -0
- package/node/wrappers/models/utils/serialization.util.test.js.map +1 -0
- package/node/wrappers/models/utils/serialization.util.test.ts +29 -0
- package/node/wrappers/models/utils/serialization.util.ts +85 -0
- package/node/wrappers/services/portfolio-service/PortfolioService.js +5 -8
- package/node/wrappers/services/portfolio-service/PortfolioService.js.map +1 -1
- package/node/wrappers/services/portfolio-service/PortfolioService.ts +5 -6
- package/node/wrappers/{portfolio.test.js → services/portfolio-service/portfolio.test.js} +12 -11
- package/node/wrappers/services/portfolio-service/portfolio.test.js.map +1 -0
- package/node/wrappers/services/portfolio-service/portfolio.test.ts +40 -0
- package/node/wrappers/services/position-service/PositionService.js +4 -6
- package/node/wrappers/services/position-service/PositionService.js.map +1 -1
- package/node/wrappers/services/position-service/PositionService.ts +4 -22
- package/node/wrappers/{position.test.js → services/position-service/position.test.js} +28 -22
- package/node/wrappers/services/position-service/position.test.js.map +1 -0
- package/node/wrappers/{position.test.ts → services/position-service/position.test.ts} +25 -29
- package/node/wrappers/services/security-service/SecurityService.js +4 -8
- package/node/wrappers/services/security-service/SecurityService.js.map +1 -1
- package/node/wrappers/services/security-service/SecurityService.ts +3 -6
- package/node/wrappers/{security.test.js → services/security-service/security.test.js} +26 -19
- package/node/wrappers/services/security-service/security.test.js.map +1 -0
- package/node/wrappers/{security.test.ts → services/security-service/security.test.ts} +22 -20
- package/node/wrappers/services/transaction-service/TransactionService.js +40 -50
- package/node/wrappers/services/transaction-service/TransactionService.js.map +1 -1
- package/node/wrappers/services/transaction-service/TransactionService.ts +13 -15
- package/node/wrappers/{transaction.test.js → services/transaction-service/transaction.test.js} +41 -25
- package/node/wrappers/services/transaction-service/transaction.test.js.map +1 -0
- package/node/wrappers/services/transaction-service/transaction.test.ts +97 -0
- package/package.json +4 -2
- package/web/fintekkers/requests/transaction/query_transaction_request_pb.d.ts +4 -0
- package/web/fintekkers/requests/transaction/query_transaction_request_pb.js +31 -1
- package/web/fintekkers/requests/transaction/query_transaction_response_pb.d.ts +7 -0
- package/web/fintekkers/requests/transaction/query_transaction_response_pb.js +54 -1
- package/node/wrappers/models/utils/util.js +0 -28
- package/node/wrappers/models/utils/util.js.map +0 -1
- package/node/wrappers/models/utils/util.ts +0 -28
- package/node/wrappers/portfolio.test.js.map +0 -1
- package/node/wrappers/portfolio.test.ts +0 -36
- package/node/wrappers/position.test.js.map +0 -1
- package/node/wrappers/security.test.js.map +0 -1
- package/node/wrappers/transaction.test.js.map +0 -1
- package/node/wrappers/transaction.test.ts +0 -90
|
@@ -3,7 +3,7 @@ import { promisify } from 'util';
|
|
|
3
3
|
|
|
4
4
|
// Models
|
|
5
5
|
import Transaction from '../../models/transaction/transaction';
|
|
6
|
-
import { createFieldMapEntry } from '../../models/utils/util';
|
|
6
|
+
import { createFieldMapEntry } from '../../models/utils/serialization.util';
|
|
7
7
|
import { LocalTimestampProto } from '../../../fintekkers/models/util/local_timestamp_pb';
|
|
8
8
|
import { SummaryProto } from '../../../fintekkers/requests/util/errors/summary_pb';
|
|
9
9
|
|
|
@@ -17,14 +17,14 @@ import { CreateTransactionRequestProto } from '../../../fintekkers/requests/tran
|
|
|
17
17
|
import { CreateTransactionResponseProto } from '../../../fintekkers/requests/transaction/create_transaction_response_pb';
|
|
18
18
|
import { QueryTransactionRequestProto } from '../../../fintekkers/requests/transaction/query_transaction_request_pb';
|
|
19
19
|
import { QueryTransactionResponseProto } from '../../../fintekkers/requests/transaction/query_transaction_response_pb';
|
|
20
|
+
import EnvConfig from '../../models/utils/requestcontext';
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class TransactionService {
|
|
23
24
|
private client: TransactionClient;
|
|
24
25
|
|
|
25
26
|
constructor() {
|
|
26
|
-
|
|
27
|
-
this.client = new TransactionClient('localhost:8082', grpc.credentials.createInsecure());
|
|
27
|
+
this.client = new TransactionClient(EnvConfig.apiURL, EnvConfig.apiCredentials);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
async validateCreateTransaction(transaction: Transaction): Promise<SummaryProto> {
|
|
@@ -49,7 +49,8 @@ class TransactionService {
|
|
|
49
49
|
return response;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
searchTransaction(asOf: LocalTimestampProto, fieldProto: FieldProto, fieldValue: string, maxResults: number=100):
|
|
53
|
+
Promise<Transaction[]> {
|
|
53
54
|
const searchRequest = new QueryTransactionRequestProto();
|
|
54
55
|
searchRequest.setObjectClass('SecurityRequest');
|
|
55
56
|
searchRequest.setVersion('0.0.1');
|
|
@@ -63,28 +64,25 @@ class TransactionService {
|
|
|
63
64
|
positionFilter.setFiltersList([fieldMapEntry]);
|
|
64
65
|
|
|
65
66
|
searchRequest.setSearchTransactionInput(positionFilter);
|
|
67
|
+
searchRequest.setLimit(maxResults);
|
|
66
68
|
|
|
67
69
|
const tmpClient = this.client;
|
|
68
70
|
|
|
69
|
-
const listTransactions: Transaction[] = [];
|
|
70
|
-
|
|
71
71
|
async function processStreamSynchronously(): Promise<Transaction[]> {
|
|
72
72
|
const stream2 = tmpClient.search(searchRequest);
|
|
73
|
+
var results:Transaction[] = [];
|
|
73
74
|
|
|
74
75
|
return new Promise<Transaction[]>((resolve, reject) => {
|
|
75
76
|
stream2.on('data', (response:QueryTransactionResponseProto) => {
|
|
76
|
-
console.log('Result of the transaction search call');
|
|
77
|
-
console.log('Response:', response);
|
|
78
77
|
response.getTransactionResponseList().forEach((transaction) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
console.log('Size of transactions:', listTransactions.length );
|
|
78
|
+
const txn:Transaction = new Transaction(transaction);
|
|
79
|
+
results.push(txn);
|
|
80
|
+
})
|
|
83
81
|
});
|
|
84
82
|
|
|
85
83
|
stream2.on('end', () => {
|
|
86
|
-
console.log(
|
|
87
|
-
resolve(
|
|
84
|
+
console.log("Stream ended with ", results.length);
|
|
85
|
+
resolve(results);
|
|
88
86
|
});
|
|
89
87
|
|
|
90
88
|
stream2.on('error', (err) => {
|
|
@@ -94,7 +92,7 @@ class TransactionService {
|
|
|
94
92
|
});
|
|
95
93
|
}
|
|
96
94
|
|
|
97
|
-
return
|
|
95
|
+
return processStreamSynchronously();
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
98
|
|
package/node/wrappers/{transaction.test.js → services/transaction-service/transaction.test.js}
RENAMED
|
@@ -36,24 +36,36 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.testTransaction = void 0;
|
|
40
39
|
// Models
|
|
41
|
-
var decimal_value_pb_1 = require("
|
|
42
|
-
var local_date_pb_1 = require("
|
|
40
|
+
var decimal_value_pb_1 = require("../../../fintekkers/models/util/decimal_value_pb");
|
|
41
|
+
var local_date_pb_1 = require("../../../fintekkers/models/util/local_date_pb");
|
|
43
42
|
// Model Utils
|
|
44
|
-
var field_pb_1 = require("
|
|
45
|
-
var uuid = require("
|
|
46
|
-
var dt = require("
|
|
47
|
-
var SecurityService_1 = require("
|
|
48
|
-
var transaction_type_pb_1 = require("
|
|
49
|
-
var transaction_pb_1 = require("
|
|
50
|
-
var price_pb_1 = require("
|
|
51
|
-
var PortfolioService_1 = require("
|
|
52
|
-
var TransactionService_1 = require("./
|
|
53
|
-
var transaction_1 = require("
|
|
43
|
+
var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
44
|
+
var uuid = require("../../models/utils/uuid");
|
|
45
|
+
var dt = require("../../models/utils/datetime");
|
|
46
|
+
var SecurityService_1 = require("../security-service/SecurityService");
|
|
47
|
+
var transaction_type_pb_1 = require("../../../fintekkers/models/transaction/transaction_type_pb");
|
|
48
|
+
var transaction_pb_1 = require("../../../fintekkers/models/transaction/transaction_pb");
|
|
49
|
+
var price_pb_1 = require("../../../fintekkers/models/price/price_pb");
|
|
50
|
+
var PortfolioService_1 = require("../portfolio-service/PortfolioService");
|
|
51
|
+
var TransactionService_1 = require("./TransactionService");
|
|
52
|
+
var transaction_1 = require("../../models/transaction/transaction");
|
|
53
|
+
var assert = require("assert");
|
|
54
|
+
test('test creating a transaction against the portfolio service', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
+
var isTrue;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0: return [4 /*yield*/, testTransaction()];
|
|
59
|
+
case 1:
|
|
60
|
+
isTrue = _a.sent();
|
|
61
|
+
expect(isTrue).toBe(true);
|
|
62
|
+
return [2 /*return*/];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}); }, 30000);
|
|
54
66
|
function testTransaction() {
|
|
55
67
|
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
-
var id_proto, now, today, securityService, portfolioService, transactionService, fixedIncomeSecurities, security, portfolios, portfolio, transaction, createTransactionResponse,
|
|
68
|
+
var id_proto, now, today, securityService, portfolioService, transactionService, fixedIncomeSecurities, security, portfolios, portfolio, transaction, createTransactionResponse, transactionResponse, transactions;
|
|
57
69
|
return __generator(this, function (_a) {
|
|
58
70
|
switch (_a.label) {
|
|
59
71
|
case 0:
|
|
@@ -64,20 +76,19 @@ function testTransaction() {
|
|
|
64
76
|
portfolioService = new PortfolioService_1.PortfolioService();
|
|
65
77
|
transactionService = new TransactionService_1.TransactionService();
|
|
66
78
|
return [4 /*yield*/, securityService
|
|
67
|
-
.searchSecurity(now.
|
|
79
|
+
.searchSecurity(now.toProto(), field_pb_1.FieldProto.ASSET_CLASS, 'Fixed Income')
|
|
68
80
|
.then(function (fixedIncomeSecurities) {
|
|
69
81
|
return fixedIncomeSecurities;
|
|
70
82
|
})];
|
|
71
83
|
case 1:
|
|
72
84
|
fixedIncomeSecurities = _a.sent();
|
|
73
85
|
security = fixedIncomeSecurities[0];
|
|
74
|
-
return [4 /*yield*/, portfolioService.searchPortfolio(now.
|
|
86
|
+
return [4 /*yield*/, portfolioService.searchPortfolio(now.toProto(), field_pb_1.FieldProto.PORTFOLIO_NAME, 'TEST PORTFOLIO')];
|
|
75
87
|
case 2:
|
|
76
88
|
portfolios = _a.sent();
|
|
77
89
|
if (portfolios === undefined) {
|
|
78
90
|
throw new Error('No portfolios found');
|
|
79
91
|
}
|
|
80
|
-
console.log('There are %d portfolios in this response', portfolios.length);
|
|
81
92
|
portfolio = portfolios[0];
|
|
82
93
|
if (portfolio.getPortfolioName().includes('Federal')) {
|
|
83
94
|
throw new Error('Portfolio is not a test portfolio! Abandoning test');
|
|
@@ -86,13 +97,13 @@ function testTransaction() {
|
|
|
86
97
|
transaction.setObjectClass('Transaction');
|
|
87
98
|
transaction.setVersion('0.0.1');
|
|
88
99
|
transaction.setUuid(uuid.UUID.random().toUUIDProto());
|
|
89
|
-
transaction.setAsOf(now.
|
|
100
|
+
transaction.setAsOf(now.toProto());
|
|
90
101
|
transaction.setTradeDate(today);
|
|
91
102
|
transaction.setSettlementDate(today); //Same day settlement
|
|
92
103
|
transaction.setTransactionType(transaction_type_pb_1.TransactionTypeProto.BUY);
|
|
93
104
|
transaction.setPrice(new price_pb_1.PriceProto()
|
|
94
105
|
.setObjectClass('Price')
|
|
95
|
-
.setAsOf(now.
|
|
106
|
+
.setAsOf(now.toProto())
|
|
96
107
|
.setVersion('0.0.1')
|
|
97
108
|
.setSecurity(security.proto)
|
|
98
109
|
.setUuid(uuid.UUID.random().toUUIDProto())
|
|
@@ -103,15 +114,20 @@ function testTransaction() {
|
|
|
103
114
|
return [4 /*yield*/, transactionService.createTransaction(new transaction_1.default(transaction))];
|
|
104
115
|
case 3:
|
|
105
116
|
createTransactionResponse = _a.sent();
|
|
106
|
-
|
|
107
|
-
|
|
117
|
+
transactionResponse = createTransactionResponse.getTransactionResponse();
|
|
118
|
+
assert(transactionResponse, "No transaction response found");
|
|
119
|
+
return [4 /*yield*/, transactionService.searchTransaction(now.toProto(), field_pb_1.FieldProto.ASSET_CLASS, 'Fixed Income')];
|
|
108
120
|
case 4:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
transactions = _a.sent();
|
|
122
|
+
if (transactions === undefined) {
|
|
123
|
+
console.log('No transactions found');
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
console.log(transactions.length);
|
|
127
|
+
}
|
|
128
|
+
return [2 /*return*/, true];
|
|
112
129
|
}
|
|
113
130
|
});
|
|
114
131
|
});
|
|
115
132
|
}
|
|
116
|
-
exports.testTransaction = testTransaction;
|
|
117
133
|
//# sourceMappingURL=transaction.test.js.map
|
|
@@ -0,0 +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;AAElC,IAAI,CAAC,2DAA2D,EAAE;;;;oBAChD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W,CAAC,CAAC,EAAA;;oBAAnI,yBAAyB,GAAkC,SAAwE;oBACjI,mBAAmB,GAAG,yBAAyB,CAAC,sBAAsB,EAAE,CAAC;oBAC/E,MAAM,CAAC,mBAAmB,EAAE,+BAA+B,CAAC,CAAC;oBAGxC,qBAAM,kBAAkB,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,qBAAU,CAAC,WAAW,EAAE,cAAc,CAAC,EAAA;;oBAAhH,YAAY,GAAG,SAAiG;oBAEtH,IAAG,YAAY,KAAK,SAAS,EAAE;wBAC7B,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"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Models
|
|
2
|
+
import { DecimalValueProto } from '../../../fintekkers/models/util/decimal_value_pb';
|
|
3
|
+
import { LocalDateProto } from '../../../fintekkers/models/util/local_date_pb';
|
|
4
|
+
|
|
5
|
+
// Model Utils
|
|
6
|
+
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
7
|
+
|
|
8
|
+
import * as uuid from '../../models/utils/uuid';
|
|
9
|
+
import * as dt from '../../models/utils/datetime';
|
|
10
|
+
|
|
11
|
+
import { SecurityService } from '../security-service/SecurityService';
|
|
12
|
+
import { TransactionTypeProto } from '../../../fintekkers/models/transaction/transaction_type_pb';
|
|
13
|
+
import { TransactionProto } from '../../../fintekkers/models/transaction/transaction_pb';
|
|
14
|
+
import { PriceProto } from '../../../fintekkers/models/price/price_pb';
|
|
15
|
+
import { PortfolioService } from '../portfolio-service/PortfolioService';
|
|
16
|
+
import { TransactionService } from './TransactionService';
|
|
17
|
+
import Transaction from '../../models/transaction/transaction';
|
|
18
|
+
import { CreateTransactionResponseProto } from '../../../fintekkers/requests/transaction/create_transaction_response_pb';
|
|
19
|
+
|
|
20
|
+
import assert = require("assert");
|
|
21
|
+
|
|
22
|
+
test('test creating a transaction against the portfolio service', async () => {
|
|
23
|
+
const isTrue = await testTransaction();
|
|
24
|
+
expect(isTrue).toBe(true);
|
|
25
|
+
}, 30000);
|
|
26
|
+
|
|
27
|
+
async function testTransaction(): Promise<boolean> {
|
|
28
|
+
const id_proto = uuid.UUID.random().toUUIDProto();
|
|
29
|
+
const now = dt.ZonedDateTime.now();
|
|
30
|
+
const today = new LocalDateProto().setDay(1).setMonth(1).setYear(2021);
|
|
31
|
+
|
|
32
|
+
const securityService = new SecurityService();
|
|
33
|
+
const portfolioService = new PortfolioService();
|
|
34
|
+
const transactionService = new TransactionService();
|
|
35
|
+
|
|
36
|
+
let fixedIncomeSecurities = await securityService
|
|
37
|
+
.searchSecurity(now.toProto(), FieldProto.ASSET_CLASS, 'Fixed Income')
|
|
38
|
+
.then((fixedIncomeSecurities) => {
|
|
39
|
+
return fixedIncomeSecurities;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
let security = fixedIncomeSecurities[0];
|
|
43
|
+
|
|
44
|
+
let portfolios = await portfolioService.searchPortfolio(
|
|
45
|
+
now.toProto(),
|
|
46
|
+
FieldProto.PORTFOLIO_NAME,
|
|
47
|
+
'TEST PORTFOLIO');
|
|
48
|
+
|
|
49
|
+
if(portfolios === undefined) {
|
|
50
|
+
throw new Error('No portfolios found');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const portfolio = portfolios[0];
|
|
54
|
+
|
|
55
|
+
if(portfolio.getPortfolioName().includes('Federal')){
|
|
56
|
+
throw new Error('Portfolio is not a test portfolio! Abandoning test');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const transaction = new TransactionProto();
|
|
60
|
+
transaction.setObjectClass('Transaction');
|
|
61
|
+
transaction.setVersion('0.0.1');
|
|
62
|
+
transaction.setUuid(uuid.UUID.random().toUUIDProto());
|
|
63
|
+
transaction.setAsOf(now.toProto());
|
|
64
|
+
transaction.setTradeDate(today);
|
|
65
|
+
transaction.setSettlementDate(today); //Same day settlement
|
|
66
|
+
transaction.setTransactionType(TransactionTypeProto.BUY);
|
|
67
|
+
transaction.setPrice(
|
|
68
|
+
new PriceProto()
|
|
69
|
+
.setObjectClass('Price')
|
|
70
|
+
.setAsOf(now.toProto())
|
|
71
|
+
.setVersion('0.0.1')
|
|
72
|
+
.setSecurity(security.proto)
|
|
73
|
+
.setUuid(uuid.UUID.random().toUUIDProto())
|
|
74
|
+
.setPrice(new DecimalValueProto().setArbitraryPrecisionValue('100.00'))
|
|
75
|
+
);
|
|
76
|
+
transaction.setQuantity(new DecimalValueProto().setArbitraryPrecisionValue('10000.00'));
|
|
77
|
+
transaction.setPortfolio(portfolio);
|
|
78
|
+
transaction.setSecurity(security.proto);
|
|
79
|
+
|
|
80
|
+
// var validationSummary = await transactionService.validateCreateTransaction(new Transaction(transaction));
|
|
81
|
+
// assert(validationSummary.getErrorsList().length == 0, "Validation errors found");
|
|
82
|
+
|
|
83
|
+
var createTransactionResponse:CreateTransactionResponseProto = await transactionService.createTransaction(new Transaction(transaction));
|
|
84
|
+
const transactionResponse = createTransactionResponse.getTransactionResponse();
|
|
85
|
+
assert(transactionResponse, "No transaction response found");
|
|
86
|
+
|
|
87
|
+
// transactionService.addListener(transactionListener);
|
|
88
|
+
const transactions = await transactionService.searchTransaction(now.toProto(), FieldProto.ASSET_CLASS, 'Fixed Income');
|
|
89
|
+
|
|
90
|
+
if(transactions === undefined) {
|
|
91
|
+
console.log('No transactions found');
|
|
92
|
+
} else {
|
|
93
|
+
console.log(transactions.length);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return true;
|
|
97
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fintekkers/ledger-models",
|
|
3
3
|
"todo": "Replace the version with build script version number",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.62",
|
|
5
5
|
"description": "ledger model protos ",
|
|
6
6
|
"authors": [
|
|
7
7
|
"David Doherty",
|
|
@@ -28,12 +28,14 @@
|
|
|
28
28
|
"@types/jest": "^29.5.3",
|
|
29
29
|
"grpc_tools_node_protoc_ts": "^5.3.3",
|
|
30
30
|
"jest": "^29.6.1",
|
|
31
|
-
"jsdom": "^22.1.0"
|
|
31
|
+
"jsdom": "^22.1.0",
|
|
32
|
+
"ts-jest": "^29.1.1"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"@grpc/grpc-js": "^1.8.18",
|
|
35
36
|
"bytebuffer": "^5.0.1",
|
|
36
37
|
"decimal.js": "^10.4.3",
|
|
38
|
+
"dotenv": "^16.3.1",
|
|
37
39
|
"luxon": "^3.3.0",
|
|
38
40
|
"uuid": "^9.0.0"
|
|
39
41
|
}
|
|
@@ -27,6 +27,9 @@ export class QueryTransactionRequestProto extends jspb.Message {
|
|
|
27
27
|
hasAsOf(): boolean;
|
|
28
28
|
clearAsOf(): QueryTransactionRequestProto;
|
|
29
29
|
|
|
30
|
+
getLimit(): number;
|
|
31
|
+
setLimit(value: number): QueryTransactionRequestProto;
|
|
32
|
+
|
|
30
33
|
serializeBinary(): Uint8Array;
|
|
31
34
|
toObject(includeInstance?: boolean): QueryTransactionRequestProto.AsObject;
|
|
32
35
|
static toObject(includeInstance: boolean, msg: QueryTransactionRequestProto): QueryTransactionRequestProto.AsObject;
|
|
@@ -42,6 +45,7 @@ export namespace QueryTransactionRequestProto {
|
|
|
42
45
|
uuidsList: Array<fintekkers_models_util_uuid_pb.UUIDProto.AsObject>,
|
|
43
46
|
searchTransactionInput?: fintekkers_models_position_position_filter_pb.PositionFilterProto.AsObject,
|
|
44
47
|
asOf?: fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.AsObject,
|
|
48
|
+
limit: number,
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
|
|
@@ -87,7 +87,8 @@ proto.fintekkers.requests.transaction.QueryTransactionRequestProto.toObject = fu
|
|
|
87
87
|
uuidsList: jspb.Message.toObjectList(msg.getUuidsList(),
|
|
88
88
|
fintekkers_models_util_uuid_pb.UUIDProto.toObject, includeInstance),
|
|
89
89
|
searchTransactionInput: (f = msg.getSearchTransactionInput()) && fintekkers_models_position_position_filter_pb.PositionFilterProto.toObject(includeInstance, f),
|
|
90
|
-
asOf: (f = msg.getAsOf()) && fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.toObject(includeInstance, f)
|
|
90
|
+
asOf: (f = msg.getAsOf()) && fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.toObject(includeInstance, f),
|
|
91
|
+
limit: jspb.Message.getFieldWithDefault(msg, 24, 0)
|
|
91
92
|
};
|
|
92
93
|
|
|
93
94
|
if (includeInstance) {
|
|
@@ -147,6 +148,10 @@ proto.fintekkers.requests.transaction.QueryTransactionRequestProto.deserializeBi
|
|
|
147
148
|
reader.readMessage(value,fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.deserializeBinaryFromReader);
|
|
148
149
|
msg.setAsOf(value);
|
|
149
150
|
break;
|
|
151
|
+
case 24:
|
|
152
|
+
var value = /** @type {number} */ (reader.readInt32());
|
|
153
|
+
msg.setLimit(value);
|
|
154
|
+
break;
|
|
150
155
|
default:
|
|
151
156
|
reader.skipField();
|
|
152
157
|
break;
|
|
@@ -214,6 +219,13 @@ proto.fintekkers.requests.transaction.QueryTransactionRequestProto.serializeBina
|
|
|
214
219
|
fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.serializeBinaryToWriter
|
|
215
220
|
);
|
|
216
221
|
}
|
|
222
|
+
f = message.getLimit();
|
|
223
|
+
if (f !== 0) {
|
|
224
|
+
writer.writeInt32(
|
|
225
|
+
24,
|
|
226
|
+
f
|
|
227
|
+
);
|
|
228
|
+
}
|
|
217
229
|
};
|
|
218
230
|
|
|
219
231
|
|
|
@@ -365,4 +377,22 @@ proto.fintekkers.requests.transaction.QueryTransactionRequestProto.prototype.has
|
|
|
365
377
|
};
|
|
366
378
|
|
|
367
379
|
|
|
380
|
+
/**
|
|
381
|
+
* optional int32 limit = 24;
|
|
382
|
+
* @return {number}
|
|
383
|
+
*/
|
|
384
|
+
proto.fintekkers.requests.transaction.QueryTransactionRequestProto.prototype.getLimit = function() {
|
|
385
|
+
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 24, 0));
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* @param {number} value
|
|
391
|
+
* @return {!proto.fintekkers.requests.transaction.QueryTransactionRequestProto} returns this
|
|
392
|
+
*/
|
|
393
|
+
proto.fintekkers.requests.transaction.QueryTransactionRequestProto.prototype.setLimit = function(value) {
|
|
394
|
+
return jspb.Message.setProto3IntField(this, 24, value);
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
|
|
368
398
|
goog.object.extend(exports, proto.fintekkers.requests.transaction);
|
|
@@ -2,6 +2,7 @@ import * as jspb from 'google-protobuf'
|
|
|
2
2
|
|
|
3
3
|
import * as fintekkers_models_transaction_transaction_pb from '../../../fintekkers/models/transaction/transaction_pb';
|
|
4
4
|
import * as fintekkers_requests_transaction_query_transaction_request_pb from '../../../fintekkers/requests/transaction/query_transaction_request_pb';
|
|
5
|
+
import * as fintekkers_requests_util_errors_summary_pb from '../../../fintekkers/requests/util/errors/summary_pb';
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
export class QueryTransactionResponseProto extends jspb.Message {
|
|
@@ -21,6 +22,11 @@ export class QueryTransactionResponseProto extends jspb.Message {
|
|
|
21
22
|
clearTransactionResponseList(): QueryTransactionResponseProto;
|
|
22
23
|
addTransactionResponse(value?: fintekkers_models_transaction_transaction_pb.TransactionProto, index?: number): fintekkers_models_transaction_transaction_pb.TransactionProto;
|
|
23
24
|
|
|
25
|
+
getErrorsOrWarnings(): fintekkers_requests_util_errors_summary_pb.SummaryProto | undefined;
|
|
26
|
+
setErrorsOrWarnings(value?: fintekkers_requests_util_errors_summary_pb.SummaryProto): QueryTransactionResponseProto;
|
|
27
|
+
hasErrorsOrWarnings(): boolean;
|
|
28
|
+
clearErrorsOrWarnings(): QueryTransactionResponseProto;
|
|
29
|
+
|
|
24
30
|
serializeBinary(): Uint8Array;
|
|
25
31
|
toObject(includeInstance?: boolean): QueryTransactionResponseProto.AsObject;
|
|
26
32
|
static toObject(includeInstance: boolean, msg: QueryTransactionResponseProto): QueryTransactionResponseProto.AsObject;
|
|
@@ -35,6 +41,7 @@ export namespace QueryTransactionResponseProto {
|
|
|
35
41
|
version: string,
|
|
36
42
|
createTransactionRequest?: fintekkers_requests_transaction_query_transaction_request_pb.QueryTransactionRequestProto.AsObject,
|
|
37
43
|
transactionResponseList: Array<fintekkers_models_transaction_transaction_pb.TransactionProto.AsObject>,
|
|
44
|
+
errorsOrWarnings?: fintekkers_requests_util_errors_summary_pb.SummaryProto.AsObject,
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
47
|
|
|
@@ -19,6 +19,8 @@ var fintekkers_models_transaction_transaction_pb = require('../../../fintekkers/
|
|
|
19
19
|
goog.object.extend(proto, fintekkers_models_transaction_transaction_pb);
|
|
20
20
|
var fintekkers_requests_transaction_query_transaction_request_pb = require('../../../fintekkers/requests/transaction/query_transaction_request_pb.js');
|
|
21
21
|
goog.object.extend(proto, fintekkers_requests_transaction_query_transaction_request_pb);
|
|
22
|
+
var fintekkers_requests_util_errors_summary_pb = require('../../../fintekkers/requests/util/errors/summary_pb.js');
|
|
23
|
+
goog.object.extend(proto, fintekkers_requests_util_errors_summary_pb);
|
|
22
24
|
goog.exportSymbol('proto.fintekkers.requests.transaction.QueryTransactionResponseProto', null, global);
|
|
23
25
|
/**
|
|
24
26
|
* Generated by JsPbCodeGenerator.
|
|
@@ -84,7 +86,8 @@ proto.fintekkers.requests.transaction.QueryTransactionResponseProto.toObject = f
|
|
|
84
86
|
version: jspb.Message.getFieldWithDefault(msg, 2, ""),
|
|
85
87
|
createTransactionRequest: (f = msg.getCreateTransactionRequest()) && fintekkers_requests_transaction_query_transaction_request_pb.QueryTransactionRequestProto.toObject(includeInstance, f),
|
|
86
88
|
transactionResponseList: jspb.Message.toObjectList(msg.getTransactionResponseList(),
|
|
87
|
-
fintekkers_models_transaction_transaction_pb.TransactionProto.toObject, includeInstance)
|
|
89
|
+
fintekkers_models_transaction_transaction_pb.TransactionProto.toObject, includeInstance),
|
|
90
|
+
errorsOrWarnings: (f = msg.getErrorsOrWarnings()) && fintekkers_requests_util_errors_summary_pb.SummaryProto.toObject(includeInstance, f)
|
|
88
91
|
};
|
|
89
92
|
|
|
90
93
|
if (includeInstance) {
|
|
@@ -139,6 +142,11 @@ proto.fintekkers.requests.transaction.QueryTransactionResponseProto.deserializeB
|
|
|
139
142
|
reader.readMessage(value,fintekkers_models_transaction_transaction_pb.TransactionProto.deserializeBinaryFromReader);
|
|
140
143
|
msg.addTransactionResponse(value);
|
|
141
144
|
break;
|
|
145
|
+
case 40:
|
|
146
|
+
var value = new fintekkers_requests_util_errors_summary_pb.SummaryProto;
|
|
147
|
+
reader.readMessage(value,fintekkers_requests_util_errors_summary_pb.SummaryProto.deserializeBinaryFromReader);
|
|
148
|
+
msg.setErrorsOrWarnings(value);
|
|
149
|
+
break;
|
|
142
150
|
default:
|
|
143
151
|
reader.skipField();
|
|
144
152
|
break;
|
|
@@ -198,6 +206,14 @@ proto.fintekkers.requests.transaction.QueryTransactionResponseProto.serializeBin
|
|
|
198
206
|
fintekkers_models_transaction_transaction_pb.TransactionProto.serializeBinaryToWriter
|
|
199
207
|
);
|
|
200
208
|
}
|
|
209
|
+
f = message.getErrorsOrWarnings();
|
|
210
|
+
if (f != null) {
|
|
211
|
+
writer.writeMessage(
|
|
212
|
+
40,
|
|
213
|
+
f,
|
|
214
|
+
fintekkers_requests_util_errors_summary_pb.SummaryProto.serializeBinaryToWriter
|
|
215
|
+
);
|
|
216
|
+
}
|
|
201
217
|
};
|
|
202
218
|
|
|
203
219
|
|
|
@@ -312,4 +328,41 @@ proto.fintekkers.requests.transaction.QueryTransactionResponseProto.prototype.cl
|
|
|
312
328
|
};
|
|
313
329
|
|
|
314
330
|
|
|
331
|
+
/**
|
|
332
|
+
* optional fintekkers.requests.util.errors.SummaryProto errors_or_warnings = 40;
|
|
333
|
+
* @return {?proto.fintekkers.requests.util.errors.SummaryProto}
|
|
334
|
+
*/
|
|
335
|
+
proto.fintekkers.requests.transaction.QueryTransactionResponseProto.prototype.getErrorsOrWarnings = function() {
|
|
336
|
+
return /** @type{?proto.fintekkers.requests.util.errors.SummaryProto} */ (
|
|
337
|
+
jspb.Message.getWrapperField(this, fintekkers_requests_util_errors_summary_pb.SummaryProto, 40));
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* @param {?proto.fintekkers.requests.util.errors.SummaryProto|undefined} value
|
|
343
|
+
* @return {!proto.fintekkers.requests.transaction.QueryTransactionResponseProto} returns this
|
|
344
|
+
*/
|
|
345
|
+
proto.fintekkers.requests.transaction.QueryTransactionResponseProto.prototype.setErrorsOrWarnings = function(value) {
|
|
346
|
+
return jspb.Message.setWrapperField(this, 40, value);
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Clears the message field making it undefined.
|
|
352
|
+
* @return {!proto.fintekkers.requests.transaction.QueryTransactionResponseProto} returns this
|
|
353
|
+
*/
|
|
354
|
+
proto.fintekkers.requests.transaction.QueryTransactionResponseProto.prototype.clearErrorsOrWarnings = function() {
|
|
355
|
+
return this.setErrorsOrWarnings(undefined);
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Returns whether this field is set.
|
|
361
|
+
* @return {boolean}
|
|
362
|
+
*/
|
|
363
|
+
proto.fintekkers.requests.transaction.QueryTransactionResponseProto.prototype.hasErrorsOrWarnings = function() {
|
|
364
|
+
return jspb.Message.getField(this, 40) != null;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
|
|
315
368
|
goog.object.extend(exports, proto.fintekkers.requests.transaction);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createFieldMapEntry = exports.packStringIntoAny = void 0;
|
|
4
|
-
var position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
|
|
5
|
-
var any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
|
|
6
|
-
var wrappers_pb_1 = require("google-protobuf/google/protobuf/wrappers_pb");
|
|
7
|
-
function packStringIntoAny(inputString) {
|
|
8
|
-
// First, create a StringValue wrapper around the string
|
|
9
|
-
var stringValue = new wrappers_pb_1.StringValue();
|
|
10
|
-
stringValue.setValue(inputString);
|
|
11
|
-
// Next, create an Any message and pack the StringValue into it
|
|
12
|
-
var anyMessage = new any_pb_1.Any();
|
|
13
|
-
anyMessage.pack(stringValue.serializeBinary(), 'type.googleapis.com/google.protobuf.StringValue');
|
|
14
|
-
return anyMessage;
|
|
15
|
-
}
|
|
16
|
-
exports.packStringIntoAny = packStringIntoAny;
|
|
17
|
-
/**
|
|
18
|
-
* @param {*} field FieldProto.ASSET_CLASS, as an example
|
|
19
|
-
* @param {*} fieldValue The appropriate value for the FieldProto, e.g. FieldProto.ASSET_CLASS would have a string fieldValue
|
|
20
|
-
*/
|
|
21
|
-
function createFieldMapEntry(field, fieldValue) {
|
|
22
|
-
var fieldMapEntry = new position_util_pb_1.FieldMapEntry();
|
|
23
|
-
fieldMapEntry.setField(field); //FieldProto.ASSET_CLASS);
|
|
24
|
-
fieldMapEntry.setFieldValuePacked(packStringIntoAny(fieldValue)); //"Cash"));
|
|
25
|
-
return fieldMapEntry;
|
|
26
|
-
}
|
|
27
|
-
exports.createFieldMapEntry = createFieldMapEntry;
|
|
28
|
-
//# sourceMappingURL=util.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["util.ts"],"names":[],"mappings":";;;AAAA,yFAAqF;AACrF,iEAA6D;AAC7D,2EAA0E;AAE1E,SAAS,iBAAiB,CAAC,WAAmB;IAC5C,wDAAwD;IACxD,IAAM,WAAW,GAAG,IAAI,yBAAW,EAAE,CAAC;IACtC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAElC,+DAA+D;IAC/D,IAAM,UAAU,GAAG,IAAI,YAAG,EAAE,CAAC;IAC7B,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,EAAE,iDAAiD,CAAC,CAAC;IAElG,OAAO,UAAU,CAAC;AACpB,CAAC;AAaQ,8CAAiB;AAX1B;;;GAGG;AACH,SAAS,mBAAmB,CAAC,KAAa,EAAE,UAAkB;IAC5D,IAAM,aAAa,GAAG,IAAI,gCAAa,EAAE,CAAC;IAC1C,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,0BAA0B;IACzD,aAAa,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW;IAC7E,OAAO,aAAa,CAAC;AACvB,CAAC;AAE2B,kDAAmB"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { FieldMapEntry } from '../../../fintekkers/models/position/position_util_pb';
|
|
2
|
-
import { Any } from 'google-protobuf/google/protobuf/any_pb';
|
|
3
|
-
import { StringValue } from 'google-protobuf/google/protobuf/wrappers_pb';
|
|
4
|
-
|
|
5
|
-
function packStringIntoAny(inputString: string): Any {
|
|
6
|
-
// First, create a StringValue wrapper around the string
|
|
7
|
-
const stringValue = new StringValue();
|
|
8
|
-
stringValue.setValue(inputString);
|
|
9
|
-
|
|
10
|
-
// Next, create an Any message and pack the StringValue into it
|
|
11
|
-
const anyMessage = new Any();
|
|
12
|
-
anyMessage.pack(stringValue.serializeBinary(), 'type.googleapis.com/google.protobuf.StringValue');
|
|
13
|
-
|
|
14
|
-
return anyMessage;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @param {*} field FieldProto.ASSET_CLASS, as an example
|
|
19
|
-
* @param {*} fieldValue The appropriate value for the FieldProto, e.g. FieldProto.ASSET_CLASS would have a string fieldValue
|
|
20
|
-
*/
|
|
21
|
-
function createFieldMapEntry(field: number, fieldValue: string): FieldMapEntry {
|
|
22
|
-
const fieldMapEntry = new FieldMapEntry();
|
|
23
|
-
fieldMapEntry.setField(field); //FieldProto.ASSET_CLASS);
|
|
24
|
-
fieldMapEntry.setFieldValuePacked(packStringIntoAny(fieldValue)); //"Cash"));
|
|
25
|
-
return fieldMapEntry;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { packStringIntoAny, createFieldMapEntry };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"portfolio.test.js","sourceRoot":"","sources":["portfolio.test.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAET,cAAc;AACd,mEAAoE;AACpE,0CAA4C;AAC5C,4CAA8C;AAE9C,qBAAqB;AACrB,kFAAiF;AACjF,4EAA6E;AAG7E,SAAe,aAAa;;;;;;oBACpB,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;oBAC5C,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;oBAE7B,gBAAgB,GAAG,IAAI,mCAAgB,EAAE,CAAC;oBAE1C,SAAS,GAAG,IAAI,6BAAc,EAAE,CAAC;oBACvC,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;oBACtC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;oBAC9B,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAC5B,SAAS,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;oBAC7C,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC;oBAEf,qBAAM,gBAAgB,CAAC,uBAAuB,CAAC,SAAS,CAAC,EAAA;;oBAA7E,iBAAiB,GAAG,SAAyD;oBACjF,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;oBAE4B,qBAAM,gBAAgB,CAAC,eAAe,CAAC,SAAS,CAAC,EAAA;;oBAAxG,uBAAuB,GAAgC,SAAiD;oBAC5G,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;oBAEjB,qBAAM,gBAAgB,CAAC,eAAe,CAAC,GAAG,CAAC,aAAa,EAAE,EAAE,qBAAU,CAAC,cAAc,EAAE,+BAA+B,CAAC,EAAA;;oBAAvI,aAAa,GAAG,SAAuH;oBAC3I,OAAO,CAAC,GAAG,CAAC,0CAA0C,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;;;;;CAC/E;AAEQ,sCAAa"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// Models
|
|
2
|
-
|
|
3
|
-
// Model Utils
|
|
4
|
-
import { FieldProto } from '../fintekkers/models/position/field_pb';
|
|
5
|
-
import * as uuid from './models/utils/uuid';
|
|
6
|
-
import * as dt from './models/utils/datetime';
|
|
7
|
-
|
|
8
|
-
//Requests & Services
|
|
9
|
-
import { PortfolioService } from './services/portfolio-service/PortfolioService';
|
|
10
|
-
import { PortfolioProto } from '../fintekkers/models/portfolio/portfolio_pb';
|
|
11
|
-
import { CreatePortfolioResponseProto } from '../fintekkers/requests/portfolio/create_portfolio_response_pb';
|
|
12
|
-
|
|
13
|
-
async function testPortfolio(): Promise<void> {
|
|
14
|
-
const id_proto = uuid.UUID.random().toUUIDProto();
|
|
15
|
-
const now = dt.ZonedDateTime.now();
|
|
16
|
-
|
|
17
|
-
const portfolioService = new PortfolioService();
|
|
18
|
-
|
|
19
|
-
const portfolio = new PortfolioProto();
|
|
20
|
-
portfolio.setObjectClass('Portfolio');
|
|
21
|
-
portfolio.setVersion('0.0.1');
|
|
22
|
-
portfolio.setUuid(id_proto);
|
|
23
|
-
portfolio.setPortfolioName('TEST PORTFOLIO');
|
|
24
|
-
portfolio.setAsOf(now.to_date_proto());
|
|
25
|
-
|
|
26
|
-
var validationSummary = await portfolioService.validateCreatePortfolio(portfolio);
|
|
27
|
-
console.log(validationSummary);
|
|
28
|
-
|
|
29
|
-
var createPortfolioResponse:CreatePortfolioResponseProto = await portfolioService.createPortfolio(portfolio);
|
|
30
|
-
console.log(createPortfolioResponse);
|
|
31
|
-
|
|
32
|
-
var searchResults = await portfolioService.searchPortfolio(now.to_date_proto(), FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings');
|
|
33
|
-
console.log('There are %d securities in this response', searchResults.length);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export { testPortfolio };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"position.test.js","sourceRoot":"","sources":["position.test.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAET,cAAc;AACd,mEAAoE;AAIpE,qBAAqB;AACrB,kFAAiF;AAIjF,4CAAwD;AACxD,+EAA8E;AAC9E,yEAAgH;AAChH,uGAAsG;AAEtG,wFAAyF;AACzF,iEAA6D;AAC7D,mFAA+E;AAC/E,uFAAuF;AACvF,oDAAwD;AAExD,uEAAwE;AAGxE,qEAAqE;AAErE,qLAAqL;AAErL,SAAe,YAAY,CAAC,QAAsB,EACtC,SAAwB,EACxB,QAAuB,EACvB,aAA+B,EAC/B,MAAoD,EACpD,kBAAuB,EAAE,KAA2B;IADpD,uBAAA,EAAA,UAAU,qBAAU,CAAC,SAAS,EAAE,qBAAU,CAAC,QAAQ,CAAC;IACpD,mCAAA,EAAA,uBAAuB;IAAE,sBAAA,EAAA,QAAQ,wBAAa,CAAC,GAAG,EAAE;;;;;;oBACtD,OAAO,GAAG,EAAE,CAAC;oBAEnB,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE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