@fintekkers/ledger-models 0.1.96 → 0.1.97
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/node/fintekkers/models/portfolio/portfolio_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/field_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/measure_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/position_filter_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/position_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/position_status_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/position_util_grpc_pb.js +1 -0
- package/node/fintekkers/models/price/price_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/bond/auction_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/bond/issuance_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/coupon_frequency_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/coupon_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/identifier/identifier_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/identifier/identifier_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/security_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/security_pb.test.d.ts +1 -0
- package/node/fintekkers/models/security/security_pb.test.js +10 -10
- package/node/fintekkers/models/security/security_pb.test.js.map +1 -1
- package/node/fintekkers/models/security/security_quantity_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/security_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/tenor_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/tenor_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/strategy/strategy_allocation_grpc_pb.js +1 -0
- package/node/fintekkers/models/strategy/strategy_grpc_pb.js +1 -0
- package/node/fintekkers/models/transaction/transaction_grpc_pb.js +1 -0
- package/node/fintekkers/models/transaction/transaction_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/api/api_key_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/date_range_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/date_range_pb.d.ts +43 -0
- package/node/fintekkers/models/util/date_range_pb.js +310 -0
- package/node/fintekkers/models/util/decimal_value_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/endpoint_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/local_date_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/local_timestamp_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/lock/node_partition_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/lock/node_state_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/uuid_grpc_pb.js +1 -0
- package/node/fintekkers/requests/portfolio/create_portfolio_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/portfolio/create_portfolio_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/portfolio/query_portfolio_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/portfolio/query_portfolio_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/position/query_position_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/position/query_position_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/price/create_price_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/price/create_price_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/price/query_price_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/price/query_price_request_pb.d.ts +47 -0
- package/node/fintekkers/requests/price/query_price_request_pb.js +190 -2
- package/node/fintekkers/requests/price/query_price_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/create_security_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/create_security_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/get_field_values_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/get_field_values_request_pb.js +238 -0
- package/node/fintekkers/requests/security/get_field_values_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/get_field_values_response_pb.js +268 -0
- package/node/fintekkers/requests/security/get_fields_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/get_fields_response_pb.js +266 -0
- package/node/fintekkers/requests/security/query_security_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/query_security_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/transaction/create_transaction_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/transaction/create_transaction_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/transaction/query_transaction_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/transaction/query_transaction_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/errors/error_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/errors/message_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/errors/summary_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/lock/lock_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/lock/lock_request_pb.js +54 -1
- package/node/fintekkers/requests/util/lock/lock_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/operation_grpc_pb.js +1 -0
- package/node/fintekkers/requests/valuation/valuation_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/valuation/valuation_response_grpc_pb.js +1 -0
- package/node/wrappers/models/portfolio/portfolio.d.ts +15 -0
- package/node/wrappers/models/portfolio/portfolio.js +26 -21
- package/node/wrappers/models/portfolio/portfolio.js.map +1 -1
- package/node/wrappers/models/portfolio/portfolio.ts +6 -2
- package/node/wrappers/models/position/field.d.ts +7 -0
- package/node/wrappers/models/position/field.js +10 -14
- package/node/wrappers/models/position/field.js.map +1 -1
- package/node/wrappers/models/position/field.test.d.ts +1 -0
- package/node/wrappers/models/position/field.test.js +10 -48
- package/node/wrappers/models/position/field.test.js.map +1 -1
- package/node/wrappers/models/position/field.ts +1 -2
- package/node/wrappers/models/position/position.d.ts +32 -0
- package/node/wrappers/models/position/position.js +89 -83
- package/node/wrappers/models/position/position.js.map +1 -1
- package/node/wrappers/models/position/position.test.d.ts +1 -0
- package/node/wrappers/models/position/position.test.js +128 -198
- package/node/wrappers/models/position/position.test.js.map +1 -1
- package/node/wrappers/models/position/position.test.ts +1 -1
- package/node/wrappers/models/position/position.ts +19 -12
- package/node/wrappers/models/position/positionfilter.d.ts +24 -0
- package/node/wrappers/models/position/positionfilter.js +19 -20
- package/node/wrappers/models/position/positionfilter.js.map +1 -1
- package/node/wrappers/models/position/positionfilter.ts +1 -1
- package/node/wrappers/models/security/security.d.ts +23 -0
- package/node/wrappers/models/security/security.js +55 -44
- package/node/wrappers/models/security/security.js.map +1 -1
- package/node/wrappers/models/security/security.test.d.ts +1 -0
- package/node/wrappers/models/security/security.test.js +14 -11
- package/node/wrappers/models/security/security.test.js.map +1 -1
- package/node/wrappers/models/security/security.ts +13 -6
- package/node/wrappers/models/transaction/transaction.d.ts +36 -0
- package/node/wrappers/models/transaction/transaction.js +98 -68
- package/node/wrappers/models/transaction/transaction.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.test.d.ts +1 -0
- package/node/wrappers/models/transaction/transaction.test.js +12 -9
- package/node/wrappers/models/transaction/transaction.test.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.ts +30 -12
- package/node/wrappers/models/transaction/transaction_type.d.ts +17 -0
- package/node/wrappers/models/transaction/transaction_type.js +12 -12
- package/node/wrappers/models/transaction/transaction_type.js.map +1 -1
- package/node/wrappers/models/transaction/transaction_type.ts +5 -5
- package/node/wrappers/models/utils/date.d.ts +11 -0
- package/node/wrappers/models/utils/date.js +16 -17
- package/node/wrappers/models/utils/date.js.map +1 -1
- package/node/wrappers/models/utils/date.test.d.ts +1 -0
- package/node/wrappers/models/utils/date.test.js +28 -58
- package/node/wrappers/models/utils/date.test.js.map +1 -1
- package/node/wrappers/models/utils/date.ts +1 -1
- package/node/wrappers/models/utils/datetime.d.ts +14 -0
- package/node/wrappers/models/utils/datetime.js +41 -34
- package/node/wrappers/models/utils/datetime.js.map +1 -1
- package/node/wrappers/models/utils/datetime.test.d.ts +1 -0
- package/node/wrappers/models/utils/datetime.test.js +40 -70
- package/node/wrappers/models/utils/datetime.test.js.map +1 -1
- package/node/wrappers/models/utils/datetime.ts +13 -8
- package/node/wrappers/models/utils/protoEnum.d.ts +12 -0
- package/node/wrappers/models/utils/protoEnum.js +22 -24
- package/node/wrappers/models/utils/protoEnum.js.map +1 -1
- package/node/wrappers/models/utils/protoEnum.test.d.ts +1 -0
- package/node/wrappers/models/utils/protoEnum.test.js +13 -13
- package/node/wrappers/models/utils/protoEnum.test.js.map +1 -1
- package/node/wrappers/models/utils/requestcontext.d.ts +13 -0
- package/node/wrappers/models/utils/requestcontext.js +52 -44
- package/node/wrappers/models/utils/requestcontext.js.map +1 -1
- package/node/wrappers/models/utils/requestcontext.ts +15 -15
- package/node/wrappers/models/utils/requestcontext_d.d.ts +6 -0
- package/node/wrappers/models/utils/requestcontext_d.js +1 -0
- package/node/wrappers/models/utils/serialization.d.ts +12 -0
- package/node/wrappers/models/utils/serialization.js +19 -22
- package/node/wrappers/models/utils/serialization.js.map +1 -1
- package/node/wrappers/models/utils/serialization.test.d.ts +1 -0
- package/node/wrappers/models/utils/serialization.test.js +14 -14
- package/node/wrappers/models/utils/serialization.test.js.map +1 -1
- package/node/wrappers/models/utils/serialization.ts +1 -1
- package/node/wrappers/models/utils/serialization.util.d.ts +4 -0
- package/node/wrappers/models/utils/serialization.util.js +25 -25
- package/node/wrappers/models/utils/serialization.util.js.map +1 -1
- package/node/wrappers/models/utils/serialization.util.test.d.ts +1 -0
- package/node/wrappers/models/utils/serialization.util.test.js +15 -15
- package/node/wrappers/models/utils/serialization.util.test.js.map +1 -1
- package/node/wrappers/models/utils/serialization.util.ts +5 -5
- package/node/wrappers/models/utils/uuid.d.ts +13 -0
- package/node/wrappers/models/utils/uuid.js +53 -31
- package/node/wrappers/models/utils/uuid.js.map +1 -1
- package/node/wrappers/models/utils/uuid.test.d.ts +1 -0
- package/node/wrappers/models/utils/uuid.test.js +7 -7
- package/node/wrappers/models/utils/uuid.test.js.map +1 -1
- package/node/wrappers/models/utils/uuid.ts +1 -1
- package/node/wrappers/requests/position/QueryPositionRequest.d.ts +19 -0
- package/node/wrappers/requests/position/QueryPositionRequest.js +19 -20
- package/node/wrappers/requests/position/QueryPositionRequest.js.map +1 -1
- package/node/wrappers/services/portfolio-service/PortfolioService.d.ts +15 -0
- package/node/wrappers/services/portfolio-service/PortfolioService.js +58 -109
- package/node/wrappers/services/portfolio-service/PortfolioService.js.map +1 -1
- package/node/wrappers/services/portfolio-service/PortfolioService.ts +2 -2
- package/node/wrappers/services/portfolio-service/portfolioService.test.d.ts +1 -0
- package/node/wrappers/services/portfolio-service/portfolioService.test.js +47 -64
- package/node/wrappers/services/portfolio-service/portfolioService.test.js.map +1 -1
- package/node/wrappers/services/position-service/PositionService.d.ts +10 -0
- package/node/wrappers/services/position-service/PositionService.js +45 -83
- package/node/wrappers/services/position-service/PositionService.js.map +1 -1
- package/node/wrappers/services/position-service/position.test.d.ts +1 -0
- package/node/wrappers/services/position-service/position.test.js +52 -118
- package/node/wrappers/services/position-service/position.test.js.map +1 -1
- package/node/wrappers/services/position-service/position.test.ts +7 -1
- package/node/wrappers/services/security-service/SecurityService.d.ts +15 -0
- package/node/wrappers/services/security-service/SecurityService.js +86 -117
- package/node/wrappers/services/security-service/SecurityService.js.map +1 -1
- package/node/wrappers/services/security-service/SecurityService.ts +2 -2
- package/node/wrappers/services/security-service/security.maturityLadder.test.d.ts +1 -0
- package/node/wrappers/services/security-service/security.maturityLadder.test.js +40 -75
- package/node/wrappers/services/security-service/security.maturityLadder.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.maturityLadder.test.ts +1 -1
- package/node/wrappers/services/security-service/security.test.d.ts +1 -0
- package/node/wrappers/services/security-service/security.test.js +88 -114
- package/node/wrappers/services/security-service/security.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.test.ts +2 -2
- package/node/wrappers/services/transaction-service/TransactionService.d.ts +13 -0
- package/node/wrappers/services/transaction-service/TransactionService.js +53 -98
- package/node/wrappers/services/transaction-service/TransactionService.js.map +1 -1
- package/node/wrappers/services/transaction-service/TransactionService.ts +2 -2
- package/node/wrappers/services/transaction-service/transaction.search.test.d.ts +1 -0
- package/node/wrappers/services/transaction-service/transaction.search.test.js +51 -70
- package/node/wrappers/services/transaction-service/transaction.search.test.js.map +1 -1
- package/node/wrappers/services/transaction-service/transaction.test.d.ts +1 -0
- package/node/wrappers/services/transaction-service/transaction.test.js +127 -171
- package/node/wrappers/services/transaction-service/transaction.test.js.map +1 -1
- package/node/wrappers/services/transaction-service/transaction.test.ts +3 -1
- package/package.json +4 -1
- package/tsconfig.json +15 -6
|
@@ -8,83 +8,48 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
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
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
|
|
12
|
+
const assert = require("assert");
|
|
40
13
|
// Models
|
|
41
14
|
// Model Utils
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
test('test the api.fintekkers.org security service by creating a maturity ladder for the US government',
|
|
47
|
-
|
|
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
|
-
'outstandingAmount': postAuctionQuantity,
|
|
79
|
-
'maturityDate': security.getMaturityDate()
|
|
80
|
-
};
|
|
81
|
-
results.push(result);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
expect(results[0]['outstandingAmount']).toBeGreaterThan(0);
|
|
86
|
-
return [2 /*return*/];
|
|
15
|
+
const field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
16
|
+
const SecurityService_1 = require("./SecurityService");
|
|
17
|
+
const positionfilter_1 = require("../../models/position/positionfilter");
|
|
18
|
+
const serialization_1 = require("../../models/utils/serialization");
|
|
19
|
+
test('test the api.fintekkers.org security service by creating a maturity ladder for the US government', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
//Get list of all securities from the US government, with a maturity data beyond today's date
|
|
21
|
+
const securityService = new SecurityService_1.SecurityService();
|
|
22
|
+
const positionFilter = new positionfilter_1.PositionFilter();
|
|
23
|
+
positionFilter.addEqualsFilter(field_pb_1.FieldProto.ASSET_CLASS, 'Fixed Income');
|
|
24
|
+
positionFilter.addEqualsFilter(field_pb_1.FieldProto.SECURITY_ISSUER_NAME, 'US Government');
|
|
25
|
+
var securities = yield securityService.searchSecurityAsOfNow(positionFilter);
|
|
26
|
+
assert(securities.length > 0);
|
|
27
|
+
let results = [];
|
|
28
|
+
//Map results into list of maps -> Date, Amount
|
|
29
|
+
for (let index in securities) {
|
|
30
|
+
let security = securities[index];
|
|
31
|
+
let issuanceList = security.proto.getIssuanceInfoList();
|
|
32
|
+
let issuance = issuanceList && issuanceList.length > 0 ? issuanceList[0] : null;
|
|
33
|
+
if (issuance) {
|
|
34
|
+
if (!issuance.getPostAuctionOutstandingQuantity() && security.getMaturityDate().getFullYear() > 2009) {
|
|
35
|
+
console.log("Issed with %s, issuance: %s", security.getSecurityID().getIdentifierValue(), issuance);
|
|
36
|
+
}
|
|
37
|
+
else if (!issuance.getPostAuctionOutstandingQuantity() && security.getMaturityDate().getFullYear() <= 2009) {
|
|
38
|
+
//Swallow this data gap. It's old and we don't mind
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
let postAuctionQuantity = serialization_1.ProtoSerializationUtil.deserialize(issuance.getPostAuctionOutstandingQuantity());
|
|
42
|
+
let id = security.getSecurityID() ? security.getSecurityID().getIdentifierValue() : security.getID().toString();
|
|
43
|
+
let result = {
|
|
44
|
+
'cusip': id,
|
|
45
|
+
'issueDate': security.getIssueDate(),
|
|
46
|
+
'outstandingAmount': postAuctionQuantity,
|
|
47
|
+
'maturityDate': security.getMaturityDate()
|
|
48
|
+
};
|
|
49
|
+
results.push(result);
|
|
50
|
+
}
|
|
87
51
|
}
|
|
88
|
-
}
|
|
89
|
-
|
|
52
|
+
}
|
|
53
|
+
expect(results[0]['outstandingAmount']).toBeGreaterThan(0);
|
|
54
|
+
}), 90000);
|
|
90
55
|
//# sourceMappingURL=security.maturityLadder.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.maturityLadder.test.js","sourceRoot":"","sources":["security.maturityLadder.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"security.maturityLadder.test.js","sourceRoot":"","sources":["security.maturityLadder.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAkC;AAElC,SAAS;AAET,cAAc;AACd,2EAA0E;AAC1E,uDAAoD;AACpD,yEAAsE;AAEtE,oEAA0E;AAE1E,IAAI,CAAC,kGAAkG,EAAE,GAAS,EAAE;IAChH,6FAA6F;IAC7F,MAAM,eAAe,GAAG,IAAI,iCAAe,EAAE,CAAC;IAE9C,MAAM,cAAc,GAAG,IAAI,+BAAc,EAAE,CAAC;IAC5C,cAAc,CAAC,eAAe,CAAC,qBAAU,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACvE,cAAc,CAAC,eAAe,CAAC,qBAAU,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC;IAEjF,IAAI,UAAU,GAAG,MAAM,eAAe,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC;IAE7E,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC9B,IAAI,OAAO,GAA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;iBAC7C,CAAC;gBACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACzB,CAAC;QACL,CAAC;IACL,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;AAC/D,CAAC,CAAA,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -35,7 +35,7 @@ test('test the api.fintekkers.org security service by creating a maturity ladder
|
|
|
35
35
|
} else if (!issuance.getPostAuctionOutstandingQuantity() && security.getMaturityDate().getFullYear() <= 2009) {
|
|
36
36
|
//Swallow this data gap. It's old and we don't mind
|
|
37
37
|
} else {
|
|
38
|
-
let postAuctionQuantity: number = ProtoSerializationUtil.deserialize(issuance.getPostAuctionOutstandingQuantity());
|
|
38
|
+
let postAuctionQuantity: number = ProtoSerializationUtil.deserialize(issuance.getPostAuctionOutstandingQuantity()) as number;
|
|
39
39
|
let id: string = security.getSecurityID() ? security.getSecurityID().getIdentifierValue() : security.getID().toString();
|
|
40
40
|
|
|
41
41
|
let result = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,125 +31,76 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
32
|
});
|
|
10
33
|
};
|
|
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
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
35
|
// Models
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
const security_pb_1 = require("../../../fintekkers/models/security/security_pb");
|
|
37
|
+
const coupon_frequency_pb_1 = require("../../../fintekkers/models/security/coupon_frequency_pb");
|
|
38
|
+
const decimal_value_pb_1 = require("../../../fintekkers/models/util/decimal_value_pb");
|
|
39
|
+
const coupon_type_pb_1 = require("../../../fintekkers/models/security/coupon_type_pb");
|
|
40
|
+
const security_type_pb_1 = require("../../../fintekkers/models/security/security_type_pb");
|
|
41
|
+
const local_date_pb_1 = require("../../../fintekkers/models/util/local_date_pb");
|
|
46
42
|
// Model Utils
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
test('test creating a security against the api.fintekkers.org security service',
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
case 0: return [4 /*yield*/, testSecurity()];
|
|
59
|
-
case 1:
|
|
60
|
-
isTrue = _a.sent();
|
|
61
|
-
expect(isTrue).toBe(true);
|
|
62
|
-
return [2 /*return*/];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}); }, 30000);
|
|
43
|
+
const field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
44
|
+
const uuid = __importStar(require("../../models/utils/uuid"));
|
|
45
|
+
const dt = __importStar(require("../../models/utils/datetime"));
|
|
46
|
+
const SecurityService_1 = require("./SecurityService");
|
|
47
|
+
const positionfilter_1 = require("../../models/position/positionfilter");
|
|
48
|
+
const issuance_pb_1 = require("../../../fintekkers/models/security/bond/issuance_pb");
|
|
49
|
+
const serialization_1 = require("../../models/utils/serialization");
|
|
50
|
+
test('test creating a security against the api.fintekkers.org security service', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
const isTrue = yield testSecurity();
|
|
52
|
+
expect(isTrue).toBe(true);
|
|
53
|
+
}), 30000);
|
|
66
54
|
function testSecurity() {
|
|
67
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return [4 /*yield*/, securityService
|
|
76
|
-
.searchSecurity(now.toProto(), new positionfilter_1.PositionFilter().addEqualsFilter(field_pb_1.FieldProto.ASSET_CLASS, 'Cash'))
|
|
77
|
-
.then(function (securities) {
|
|
78
|
-
return securities[0];
|
|
79
|
-
})];
|
|
80
|
-
case 1:
|
|
81
|
-
usd_security = _a.sent();
|
|
82
|
-
security = new security_pb_1.SecurityProto();
|
|
83
|
-
security.setObjectClass('Security');
|
|
84
|
-
security.setVersion('0.0.1');
|
|
85
|
-
security.setUuid(id_proto);
|
|
86
|
-
security.setSettlementCurrency(usd_security.proto);
|
|
87
|
-
security.setAsOf(now.toProto());
|
|
88
|
-
security.setAssetClass('FixedIncome');
|
|
89
|
-
security.setCouponFrequency(coupon_frequency_pb_1.CouponFrequencyProto.SEMIANNUALLY);
|
|
90
|
-
security.setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED);
|
|
91
|
-
security.setSecurityType(security_type_pb_1.SecurityTypeProto.BOND_SECURITY);
|
|
92
|
-
faceValue = new decimal_value_pb_1.DecimalValueProto();
|
|
93
|
-
faceValue.setArbitraryPrecisionValue('1000.00');
|
|
94
|
-
security.setFaceValue(faceValue);
|
|
95
|
-
couponRate = new decimal_value_pb_1.DecimalValueProto();
|
|
96
|
-
couponRate.setArbitraryPrecisionValue('0.05');
|
|
97
|
-
security.setCouponRate(couponRate); // Fixed a typo here. It was security.setFaceValue(couponRate);
|
|
98
|
-
issueDate = new local_date_pb_1.LocalDateProto();
|
|
99
|
-
issueDate.setYear(2023);
|
|
100
|
-
issueDate.setMonth(1);
|
|
101
|
-
issueDate.setDay(1);
|
|
102
|
-
security.setIssueDate(issueDate);
|
|
103
|
-
security.setDatedDate(issueDate);
|
|
104
|
-
maturityDate = new local_date_pb_1.LocalDateProto();
|
|
105
|
-
maturityDate.setYear(2033); //10Y
|
|
106
|
-
maturityDate.setMonth(1);
|
|
107
|
-
maturityDate.setDay(1);
|
|
108
|
-
security.setMaturityDate(maturityDate);
|
|
109
|
-
security.setIssuerName('US Treasury');
|
|
110
|
-
security.setDescription('Dummy US Treasury 10Y Bond');
|
|
111
|
-
issuance = new issuance_pb_1.IssuanceProto();
|
|
112
|
-
issuance.setPostAuctionOutstandingQuantity(serialization_1.ProtoSerializationUtil.serialize(1000000.00));
|
|
113
|
-
issuance.setTotalAccepted(serialization_1.ProtoSerializationUtil.serialize(100000000.00));
|
|
114
|
-
security.addIssuanceInfo(issuance);
|
|
115
|
-
return [4 /*yield*/, securityService.validateCreateSecurity(security)];
|
|
116
|
-
case 2:
|
|
117
|
-
validationSummary = _a.sent();
|
|
118
|
-
expect(validationSummary.getErrorsList().length).toBe(0);
|
|
119
|
-
return [4 /*yield*/, securityService.createSecurity(security)];
|
|
120
|
-
case 3:
|
|
121
|
-
createSecurityResponse = _a.sent();
|
|
122
|
-
expect(createSecurityResponse.getSecurityResponse()).toBeTruthy();
|
|
123
|
-
return [4 /*yield*/, securityService.searchSecurity(now.toProto(), new positionfilter_1.PositionFilter().addEqualsFilter(field_pb_1.FieldProto.ASSET_CLASS, 'Fixed Income'))];
|
|
124
|
-
case 4:
|
|
125
|
-
searchResults = _a.sent();
|
|
126
|
-
expect(searchResults.length).toBeGreaterThan(0);
|
|
127
|
-
return [2 /*return*/, true];
|
|
128
|
-
}
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const id_proto = uuid.UUID.random().toUUIDProto();
|
|
57
|
+
const now = dt.ZonedDateTime.now();
|
|
58
|
+
const securityService = new SecurityService_1.SecurityService();
|
|
59
|
+
let usd_security = yield securityService
|
|
60
|
+
.searchSecurity(now.toProto(), new positionfilter_1.PositionFilter().addEqualsFilter(field_pb_1.FieldProto.ASSET_CLASS, 'Cash'))
|
|
61
|
+
.then((securities) => {
|
|
62
|
+
return securities[0];
|
|
129
63
|
});
|
|
64
|
+
const security = new security_pb_1.SecurityProto();
|
|
65
|
+
security.setObjectClass('Security');
|
|
66
|
+
security.setVersion('0.0.1');
|
|
67
|
+
security.setUuid(id_proto);
|
|
68
|
+
security.setSettlementCurrency(usd_security.proto);
|
|
69
|
+
security.setAsOf(now.toProto());
|
|
70
|
+
security.setAssetClass('FixedIncome');
|
|
71
|
+
security.setCouponFrequency(coupon_frequency_pb_1.CouponFrequencyProto.SEMIANNUALLY);
|
|
72
|
+
security.setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED);
|
|
73
|
+
security.setSecurityType(security_type_pb_1.SecurityTypeProto.BOND_SECURITY);
|
|
74
|
+
const faceValue = new decimal_value_pb_1.DecimalValueProto();
|
|
75
|
+
faceValue.setArbitraryPrecisionValue('1000.00');
|
|
76
|
+
security.setFaceValue(faceValue);
|
|
77
|
+
const couponRate = new decimal_value_pb_1.DecimalValueProto();
|
|
78
|
+
couponRate.setArbitraryPrecisionValue('0.05');
|
|
79
|
+
security.setCouponRate(couponRate); // Fixed a typo here. It was security.setFaceValue(couponRate);
|
|
80
|
+
const issueDate = new local_date_pb_1.LocalDateProto();
|
|
81
|
+
issueDate.setYear(2023);
|
|
82
|
+
issueDate.setMonth(1);
|
|
83
|
+
issueDate.setDay(1);
|
|
84
|
+
security.setIssueDate(issueDate);
|
|
85
|
+
security.setDatedDate(issueDate);
|
|
86
|
+
const maturityDate = new local_date_pb_1.LocalDateProto();
|
|
87
|
+
maturityDate.setYear(2033); //10Y
|
|
88
|
+
maturityDate.setMonth(1);
|
|
89
|
+
maturityDate.setDay(1);
|
|
90
|
+
security.setMaturityDate(maturityDate);
|
|
91
|
+
security.setIssuerName('US Treasury');
|
|
92
|
+
security.setDescription('Dummy US Treasury 10Y Bond');
|
|
93
|
+
const issuance = new issuance_pb_1.IssuanceProto();
|
|
94
|
+
issuance.setPostAuctionOutstandingQuantity(serialization_1.ProtoSerializationUtil.serialize(1000000.00));
|
|
95
|
+
issuance.setTotalAccepted(serialization_1.ProtoSerializationUtil.serialize(100000000.00));
|
|
96
|
+
security.addIssuanceInfo(issuance);
|
|
97
|
+
var validationSummary = yield securityService.validateCreateSecurity(security);
|
|
98
|
+
expect(validationSummary.getErrorsList().length).toBe(0);
|
|
99
|
+
var createSecurityResponse = yield securityService.createSecurity(security);
|
|
100
|
+
expect(createSecurityResponse.getSecurityResponse()).toBeTruthy();
|
|
101
|
+
var searchResults = yield securityService.searchSecurity(now.toProto(), new positionfilter_1.PositionFilter().addEqualsFilter(field_pb_1.FieldProto.ASSET_CLASS, 'Fixed Income'));
|
|
102
|
+
expect(searchResults.length).toBeGreaterThan(0);
|
|
103
|
+
return true;
|
|
130
104
|
});
|
|
131
105
|
}
|
|
132
106
|
//# sourceMappingURL=security.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.test.js","sourceRoot":"","sources":["security.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"security.test.js","sourceRoot":"","sources":["security.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT,iFAAgF;AAChF,iGAA+F;AAC/F,uFAAqF;AACrF,uFAAqF;AACrF,2FAAyF;AACzF,iFAA+E;AAE/E,cAAc;AACd,2EAA0E;AAE1E,8DAAgD;AAChD,gEAAkD;AAGlD,uDAAoD;AACpD,yEAAsE;AACtE,sFAAqF;AACrF,oEAA0E;AAE1E,IAAI,CAAC,0EAA0E,EAAE,GAAS,EAAE;IAC1F,MAAM,MAAM,GAAG,MAAM,YAAY,EAAE,CAAC;IACpC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAA,EAAE,KAAK,CAAC,CAAC;AAEV,SAAe,YAAY;;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;QAClD,MAAM,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;QAEnC,MAAM,eAAe,GAAG,IAAI,iCAAe,EAAE,CAAC;QAE9C,IAAI,YAAY,GAAG,MAAM,eAAe;aACrC,cAAc,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,+BAAc,EAAE,CAAC,eAAe,CAAC,qBAAU,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;aACnG,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE;YACnB,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QAEL,MAAM,QAAQ,GAAG,IAAI,2BAAa,EAAE,CAAC;QACrC,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACpC,QAAQ,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uance = new IssuanceProto();
|
|
74
|
-
issuance.setPostAuctionOutstandingQuantity(ProtoSerializationUtil.serialize(1000000.00));
|
|
75
|
-
issuance.setTotalAccepted(ProtoSerializationUtil.serialize(100000000.00));
|
|
74
|
+
issuance.setPostAuctionOutstandingQuantity(ProtoSerializationUtil.serialize(1000000.00) as DecimalValueProto);
|
|
75
|
+
issuance.setTotalAccepted(ProtoSerializationUtil.serialize(100000000.00) as DecimalValueProto);
|
|
76
76
|
security.addIssuanceInfo(issuance);
|
|
77
77
|
|
|
78
78
|
var validationSummary = await securityService.validateCreateSecurity(security);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Transaction from '../../models/transaction/transaction';
|
|
2
|
+
import { PositionFilter } from '../../models/position/positionfilter';
|
|
3
|
+
import { LocalTimestampProto } from '../../../fintekkers/models/util/local_timestamp_pb';
|
|
4
|
+
import { SummaryProto } from '../../../fintekkers/requests/util/errors/summary_pb';
|
|
5
|
+
import { CreateTransactionResponseProto } from '../../../fintekkers/requests/transaction/create_transaction_response_pb';
|
|
6
|
+
declare class TransactionService {
|
|
7
|
+
private client;
|
|
8
|
+
constructor();
|
|
9
|
+
validateCreateTransaction(transaction: Transaction): Promise<SummaryProto>;
|
|
10
|
+
createTransaction(transaction: Transaction): Promise<CreateTransactionResponseProto>;
|
|
11
|
+
searchTransaction(asOf: LocalTimestampProto, positionFilter: PositionFilter, maxResults?: number): Promise<Transaction[]>;
|
|
12
|
+
}
|
|
13
|
+
export { TransactionService };
|
|
@@ -8,123 +8,78 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var
|
|
12
|
-
|
|
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
|
-
}
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
13
|
};
|
|
38
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
15
|
exports.TransactionService = void 0;
|
|
40
|
-
|
|
16
|
+
const util_1 = require("util");
|
|
41
17
|
// Models
|
|
42
|
-
|
|
18
|
+
const transaction_1 = __importDefault(require("../../models/transaction/transaction"));
|
|
43
19
|
// Model Utils
|
|
44
20
|
// Requests & Services
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
21
|
+
const transaction_service_grpc_pb_1 = require("../../../fintekkers/services/transaction-service/transaction_service_grpc_pb");
|
|
22
|
+
const create_transaction_request_pb_1 = require("../../../fintekkers/requests/transaction/create_transaction_request_pb");
|
|
23
|
+
const query_transaction_request_pb_1 = require("../../../fintekkers/requests/transaction/query_transaction_request_pb");
|
|
24
|
+
const requestcontext_1 = __importDefault(require("../../models/utils/requestcontext"));
|
|
25
|
+
class TransactionService {
|
|
26
|
+
constructor() {
|
|
51
27
|
this.client = new transaction_service_grpc_pb_1.TransactionClient(requestcontext_1.default.apiURL, requestcontext_1.default.apiCredentials);
|
|
52
28
|
}
|
|
53
|
-
|
|
54
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
createRequest.setCreateTransactionInput(transaction.proto);
|
|
63
|
-
validateCreateOrUpdateAsync = (0, util_1.promisify)(this.client.validateCreateOrUpdate.bind(this.client));
|
|
64
|
-
return [4 /*yield*/, validateCreateOrUpdateAsync(createRequest)];
|
|
65
|
-
case 1:
|
|
66
|
-
response = _a.sent();
|
|
67
|
-
return [2 /*return*/, response];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
29
|
+
validateCreateTransaction(transaction) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const createRequest = new create_transaction_request_pb_1.CreateTransactionRequestProto();
|
|
32
|
+
createRequest.setObjectClass('TransactionRequest');
|
|
33
|
+
createRequest.setVersion('0.0.1');
|
|
34
|
+
createRequest.setCreateTransactionInput(transaction.proto);
|
|
35
|
+
const validateCreateOrUpdateAsync = (0, util_1.promisify)(this.client.validateCreateOrUpdate.bind(this.client));
|
|
36
|
+
const response = yield validateCreateOrUpdateAsync(createRequest);
|
|
37
|
+
return response;
|
|
70
38
|
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
createRequest.setCreateTransactionInput(transaction.proto);
|
|
82
|
-
createTransactionAsync = (0, util_1.promisify)(this.client.createOrUpdate.bind(this.client));
|
|
83
|
-
return [4 /*yield*/, createTransactionAsync(createRequest)];
|
|
84
|
-
case 1:
|
|
85
|
-
response = _a.sent();
|
|
86
|
-
return [2 /*return*/, response];
|
|
87
|
-
}
|
|
88
|
-
});
|
|
39
|
+
}
|
|
40
|
+
createTransaction(transaction) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const createRequest = new create_transaction_request_pb_1.CreateTransactionRequestProto();
|
|
43
|
+
createRequest.setObjectClass('TransactionRequest');
|
|
44
|
+
createRequest.setVersion('0.0.1');
|
|
45
|
+
createRequest.setCreateTransactionInput(transaction.proto);
|
|
46
|
+
const createTransactionAsync = (0, util_1.promisify)(this.client.createOrUpdate.bind(this.client));
|
|
47
|
+
const response = yield createTransactionAsync(createRequest);
|
|
48
|
+
return response;
|
|
89
49
|
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var searchRequest = new query_transaction_request_pb_1.QueryTransactionRequestProto();
|
|
50
|
+
}
|
|
51
|
+
searchTransaction(asOf, positionFilter, maxResults = 100) {
|
|
52
|
+
const searchRequest = new query_transaction_request_pb_1.QueryTransactionRequestProto();
|
|
94
53
|
searchRequest.setObjectClass('SecurityRequest');
|
|
95
54
|
searchRequest.setVersion('0.0.1');
|
|
96
55
|
searchRequest.setAsOf(asOf);
|
|
97
56
|
searchRequest.setSearchTransactionInput(positionFilter.toProto());
|
|
98
57
|
searchRequest.setLimit(maxResults);
|
|
99
|
-
|
|
58
|
+
const tmpClient = this.client;
|
|
100
59
|
function processStreamSynchronously() {
|
|
101
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
reject(err);
|
|
120
|
-
});
|
|
121
|
-
})];
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const stream2 = tmpClient.search(searchRequest);
|
|
62
|
+
var results = [];
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
stream2.on('data', (response) => {
|
|
65
|
+
response.getTransactionResponseList().forEach((transaction) => {
|
|
66
|
+
const txn = new transaction_1.default(transaction);
|
|
67
|
+
results.push(txn);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
stream2.on('end', () => {
|
|
71
|
+
console.log("Stream ended with ", results.length);
|
|
72
|
+
resolve(results);
|
|
73
|
+
});
|
|
74
|
+
stream2.on('error', (err) => {
|
|
75
|
+
console.error('Error in the stream:', err);
|
|
76
|
+
reject(err);
|
|
77
|
+
});
|
|
122
78
|
});
|
|
123
79
|
});
|
|
124
80
|
}
|
|
125
81
|
return processStreamSynchronously();
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
}());
|
|
82
|
+
}
|
|
83
|
+
}
|
|
129
84
|
exports.TransactionService = TransactionService;
|
|
130
85
|
//# sourceMappingURL=TransactionService.js.map
|
|
@@ -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,+BAAiC;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