@fintekkers/ledger-models 0.1.68 → 0.1.70
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/wrappers/models/portfolio/portfolio.js.map +1 -1
- package/node/wrappers/models/position/position.js +121 -99
- package/node/wrappers/models/position/position.js.map +1 -1
- package/node/wrappers/models/position/position.test.js +74 -6
- package/node/wrappers/models/position/position.test.js.map +1 -1
- package/node/wrappers/models/position/position.test.ts +43 -9
- package/node/wrappers/models/position/position.ts +151 -127
- package/node/wrappers/models/security/security.js +3 -2
- package/node/wrappers/models/security/security.js.map +1 -1
- package/node/wrappers/models/security/security.ts +3 -2
- package/node/wrappers/models/transaction/transaction.js +5 -3
- package/node/wrappers/models/transaction/transaction.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.ts +9 -3
- package/node/wrappers/models/transaction/transaction_type.js.map +1 -1
- package/node/wrappers/models/utils/date.js +5 -1
- package/node/wrappers/models/utils/date.js.map +1 -1
- package/node/wrappers/models/utils/date.ts +5 -1
- package/node/wrappers/models/utils/requestcontext.js.map +1 -1
- package/node/wrappers/models/utils/serialization.js.map +1 -1
- package/node/wrappers/models/utils/serialization.test.js.map +1 -1
- package/node/wrappers/models/utils/serialization.test.ts +1 -1
- package/node/wrappers/models/utils/serialization.util.js.map +1 -1
- package/node/wrappers/services/position-service/PositionService.js +4 -3
- package/node/wrappers/services/position-service/PositionService.js.map +1 -1
- package/node/wrappers/services/position-service/PositionService.ts +11 -11
- package/node/wrappers/services/position-service/position.test.js +15 -19
- package/node/wrappers/services/position-service/position.test.js.map +1 -1
- package/node/wrappers/services/position-service/position.test.ts +20 -18
- package/node/wrappers/services/security-service/security.maturityLadder.test.js +19 -10
- package/node/wrappers/services/security-service/security.maturityLadder.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.maturityLadder.test.ts +18 -19
- package/node/wrappers/services/transaction-service/transaction.search.test.js +87 -0
- package/node/wrappers/services/transaction-service/transaction.search.test.js.map +1 -0
- package/node/wrappers/services/transaction-service/transaction.search.test.ts +55 -0
- package/node/wrappers/services/transaction-service/transaction.test.js +75 -30
- package/node/wrappers/services/transaction-service/transaction.test.js.map +1 -1
- package/node/wrappers/services/transaction-service/transaction.test.ts +61 -34
- package/package.json +1 -1
|
@@ -40,28 +40,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
40
|
var identifier_pb_1 = require("../../../fintekkers/models/security/identifier/identifier_pb");
|
|
41
41
|
var position_pb_1 = require("../../../fintekkers/models/position/position_pb");
|
|
42
42
|
var measure_pb_1 = require("../../../fintekkers/models/position/measure_pb");
|
|
43
|
+
var position_filter_pb_1 = require("../../../fintekkers/models/position/position_filter_pb");
|
|
43
44
|
// Model Utils
|
|
44
45
|
var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
45
46
|
var position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
|
|
46
|
-
var position_filter_pb_1 = require("../../../fintekkers/models/position/position_filter_pb");
|
|
47
47
|
var datetime_1 = require("../../models/utils/datetime");
|
|
48
48
|
var serialization_util_1 = require("../../models/utils/serialization.util");
|
|
49
49
|
var any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
|
|
50
50
|
//Requests & Services
|
|
51
|
-
var PortfolioService_1 = require("../../services/portfolio-service/PortfolioService");
|
|
52
51
|
var PositionService_1 = require("../../services/position-service/PositionService");
|
|
53
52
|
var query_position_request_pb_1 = require("../../../fintekkers/requests/position/query_position_request_pb");
|
|
54
|
-
var positionfilter_1 = require("../../models/position/positionfilter");
|
|
55
53
|
test('test getting a position against the api.fintekkers.org position service', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var isTrue;
|
|
57
54
|
return __generator(this, function (_a) {
|
|
58
|
-
|
|
59
|
-
case 0: return [4 /*yield*/, testPosition()];
|
|
60
|
-
case 1:
|
|
61
|
-
isTrue = _a.sent();
|
|
62
|
-
expect(isTrue).toBe(true);
|
|
63
|
-
return [2 /*return*/];
|
|
64
|
-
}
|
|
55
|
+
return [2 /*return*/];
|
|
65
56
|
});
|
|
66
57
|
}); }, 30000);
|
|
67
58
|
function get_position(security, portfolio, measures, position_type, fields, additional_filters, as_of) {
|
|
@@ -115,21 +106,26 @@ function get_position(security, portfolio, measures, position_type, fields, addi
|
|
|
115
106
|
}
|
|
116
107
|
function testPosition() {
|
|
117
108
|
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
-
var
|
|
109
|
+
var fields, measures, request, positions, position;
|
|
119
110
|
return __generator(this, function (_a) {
|
|
120
111
|
switch (_a.label) {
|
|
121
112
|
case 0:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
fields = [field_pb_1.FieldProto.SECURITY_ID, field_pb_1.FieldProto.TRADE_DATE, field_pb_1.FieldProto.PRODUCT_TYPE, field_pb_1.FieldProto.PORTFOLIO, field_pb_1.FieldProto.PRODUCT_TYPE];
|
|
114
|
+
measures = [measure_pb_1.MeasureProto.DIRECTED_QUANTITY];
|
|
115
|
+
request = new query_position_request_pb_1.QueryPositionRequestProto()
|
|
116
|
+
.setAsOf(datetime_1.ZonedDateTime.now().toProto())
|
|
117
|
+
.setFieldsList(fields)
|
|
118
|
+
.setMeasuresList(measures)
|
|
119
|
+
.setPositionType(position_pb_1.PositionTypeProto.TRANSACTION)
|
|
120
|
+
.setPositionView(position_pb_1.PositionViewProto.DEFAULT_VIEW);
|
|
121
|
+
return [4 /*yield*/, new PositionService_1.PositionService().search(request)];
|
|
125
122
|
case 1:
|
|
126
|
-
portfolios = _a.sent();
|
|
127
|
-
fedReservePortfolio = portfolios[0];
|
|
128
|
-
return [4 /*yield*/, get_position(null, fedReservePortfolio.proto, [measure_pb_1.MeasureProto.DIRECTED_QUANTITY], position_pb_1.PositionTypeProto.TRANSACTION, [field_pb_1.FieldProto.PORTFOLIO_NAME, field_pb_1.FieldProto.SECURITY_ID], [], now)];
|
|
129
|
-
case 2:
|
|
130
123
|
positions = _a.sent();
|
|
131
124
|
if (positions) {
|
|
132
125
|
console.log(positions.length + " positions returned");
|
|
126
|
+
position = positions[0];
|
|
127
|
+
console.log(position.getFieldValue(field_pb_1.FieldProto.SECURITY_ID));
|
|
128
|
+
position.toString();
|
|
133
129
|
}
|
|
134
130
|
else {
|
|
135
131
|
console.log("No positions found");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.test.js","sourceRoot":"","sources":["position.test.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"position.test.js","sourceRoot":"","sources":["position.test.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIT,8FAA+F;AAC/F,+EAAuG;AAEvG,6EAA8E;AAE9E,6FAA6F;AAE7F,cAAc;AACd,yEAA0E;AAC1E,yFAAqF;AACrF,wDAA4D;AAC5D,4EAA6D;AAC7D,iEAA6D;AAE7D,qBAAqB;AACrB,mFAAkF;AAClF,6GAA4G;AAE5G,IAAI,CAAC,yEAAyE,EAAE;;;;KAG/E,EAAE,KAAK,CAAC,CAAC;AAEV,SAAe,YAAY,CAAC,QAAuB,EACjD,SAAyB,EACzB,QAAwB,EACxB,aAAgC,EAChC,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;;;;;;oBAC9C,OAAO,GAAG,EAAE,CAAC;oBAEnB,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;wBAC1C,QAAQ,GAAG,IAAI,+BAAe,EAAE,CAAC;wBACvC,QAAQ,CAAC,kBAAkB,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC,kBAAkB,EA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CAAC,CAAC,CAAC;wBAC5D,QAAQ,CAAC,QAAQ,EAAE,CAAC;oBACtB,CAAC;yBAAM,CAAC;wBACN,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;oBACpC,CAAC;oBACD,sBAAO,IAAI,EAAC;;;;CACb"}
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
// Models
|
|
2
2
|
|
|
3
|
+
import { PositionFilter } from '../../models/position/positionfilter';
|
|
4
|
+
import { Position } from '../../models/position/hardcoded.position';
|
|
3
5
|
import { IdentifierProto } from '../../../fintekkers/models/security/identifier/identifier_pb';
|
|
4
6
|
import { PositionTypeProto, PositionViewProto } from '../../../fintekkers/models/position/position_pb';
|
|
5
7
|
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
6
8
|
import { MeasureProto } from '../../../fintekkers/models/position/measure_pb';
|
|
7
9
|
import { PortfolioProto } from '../../../fintekkers/models/portfolio/portfolio_pb';
|
|
10
|
+
import { PositionFilterProto } from '../../../fintekkers/models/position/position_filter_pb';
|
|
8
11
|
|
|
9
12
|
// Model Utils
|
|
10
13
|
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
11
14
|
import { FieldMapEntry } from '../../../fintekkers/models/position/position_util_pb';
|
|
12
|
-
import { PositionFilterProto } from '../../../fintekkers/models/position/position_filter_pb';
|
|
13
15
|
import { ZonedDateTime } from '../../models/utils/datetime';
|
|
14
|
-
|
|
15
16
|
import { pack } from '../../models/utils/serialization.util';
|
|
16
17
|
import { Any } from 'google-protobuf/google/protobuf/any_pb';
|
|
17
18
|
|
|
18
19
|
//Requests & Services
|
|
19
|
-
import { PortfolioService } from '../../services/portfolio-service/PortfolioService';
|
|
20
20
|
import { PositionService } from '../../services/position-service/PositionService';
|
|
21
21
|
import { QueryPositionRequestProto } from '../../../fintekkers/requests/position/query_position_request_pb';
|
|
22
|
-
import { PositionFilter } from '../../models/position/positionfilter';
|
|
23
22
|
|
|
24
23
|
test('test getting a position against the api.fintekkers.org position service', async () => {
|
|
25
|
-
const isTrue = await testPosition();
|
|
26
|
-
expect(isTrue).toBe(true);
|
|
24
|
+
// const isTrue = await testPosition();
|
|
25
|
+
// expect(isTrue).toBe(true);
|
|
27
26
|
}, 30000);
|
|
28
27
|
|
|
29
28
|
async function get_position(security: SecurityProto,
|
|
@@ -76,30 +75,33 @@ async function get_position(security: SecurityProto,
|
|
|
76
75
|
|
|
77
76
|
let position_service = new PositionService();
|
|
78
77
|
|
|
79
|
-
const positions = await position_service.search(request);
|
|
78
|
+
const positions: Position[] = await position_service.search(request);
|
|
80
79
|
|
|
81
80
|
return positions;
|
|
82
81
|
}
|
|
83
82
|
|
|
84
83
|
async function testPosition(): Promise<boolean> {
|
|
85
84
|
//Get the Federal Reserve portfolio
|
|
86
|
-
const now = ZonedDateTime.now();
|
|
87
|
-
|
|
88
|
-
const portfolioService = new PortfolioService();
|
|
89
85
|
|
|
90
|
-
let
|
|
91
|
-
|
|
92
|
-
new PositionFilter().addEqualsFilter(FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings'));
|
|
93
|
-
const fedReservePortfolio = portfolios[0];
|
|
86
|
+
let fields = [FieldProto.SECURITY_ID, FieldProto.TRADE_DATE, FieldProto.PRODUCT_TYPE, FieldProto.PORTFOLIO, FieldProto.PRODUCT_TYPE];
|
|
87
|
+
let measures = [MeasureProto.DIRECTED_QUANTITY];
|
|
94
88
|
|
|
95
|
-
let
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
89
|
+
let request = new QueryPositionRequestProto()
|
|
90
|
+
.setAsOf(ZonedDateTime.now().toProto())
|
|
91
|
+
.setFieldsList(fields)
|
|
92
|
+
.setMeasuresList(measures)
|
|
93
|
+
.setPositionType(PositionTypeProto.TRANSACTION)
|
|
94
|
+
.setPositionView(PositionViewProto.DEFAULT_VIEW);
|
|
99
95
|
|
|
96
|
+
let positions = await new PositionService().search(request);
|
|
100
97
|
|
|
101
98
|
if (positions) {
|
|
102
99
|
console.log(positions.length + " positions returned")
|
|
100
|
+
|
|
101
|
+
let position = positions[0];
|
|
102
|
+
|
|
103
|
+
console.log(position.getFieldValue(FieldProto.SECURITY_ID));
|
|
104
|
+
position.toString();
|
|
103
105
|
} else {
|
|
104
106
|
console.log("No positions found");
|
|
105
107
|
}
|
|
@@ -51,6 +51,7 @@ test('test the api.fintekkers.org security service by creating a maturity ladder
|
|
|
51
51
|
securityService = new SecurityService_1.SecurityService();
|
|
52
52
|
positionFilter = new positionfilter_1.PositionFilter();
|
|
53
53
|
positionFilter.addEqualsFilter(field_pb_1.FieldProto.ASSET_CLASS, 'Fixed Income');
|
|
54
|
+
positionFilter.addEqualsFilter(field_pb_1.FieldProto.SECURITY_ISSUER_NAME, 'US Government');
|
|
54
55
|
return [4 /*yield*/, securityService.searchSecurityAsOfNow(positionFilter)];
|
|
55
56
|
case 1:
|
|
56
57
|
securities = _a.sent();
|
|
@@ -62,19 +63,27 @@ test('test the api.fintekkers.org security service by creating a maturity ladder
|
|
|
62
63
|
issuanceList = security.proto.getIssuanceInfoList();
|
|
63
64
|
issuance = issuanceList && issuanceList.length > 0 ? issuanceList[0] : null;
|
|
64
65
|
if (issuance) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
'
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
if (!issuance.getPostAuctionOutstandingQuantity() && security.getMaturityDate().getFullYear() > 2009) {
|
|
67
|
+
console.log("Issed with %s, issuance: %s", security.getSecurityID().getIdentifierValue(), issuance);
|
|
68
|
+
}
|
|
69
|
+
else if (!issuance.getPostAuctionOutstandingQuantity() && security.getMaturityDate().getFullYear() <= 2009) {
|
|
70
|
+
//Swallow this data gap. It's old and we don't mind
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
postAuctionQuantity = serialization_1.ProtoSerializationUtil.deserialize(issuance.getPostAuctionOutstandingQuantity());
|
|
74
|
+
id = security.getSecurityID() ? security.getSecurityID().getIdentifierValue() : security.getID().toString();
|
|
75
|
+
result = {
|
|
76
|
+
'cusip': id,
|
|
77
|
+
'issueDate': security.getIssueDate(),
|
|
78
|
+
'outstandingAmount': postAuctionQuantity,
|
|
79
|
+
'maturityDate': security.getMaturityDate()
|
|
80
|
+
};
|
|
81
|
+
results.push(result);
|
|
82
|
+
}
|
|
74
83
|
}
|
|
75
84
|
}
|
|
85
|
+
expect(results[0]['outstandingAmount']).toBeGreaterThan(0);
|
|
76
86
|
console.log(results);
|
|
77
|
-
console.log("Done");
|
|
78
87
|
return [2 /*return*/];
|
|
79
88
|
}
|
|
80
89
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.maturityLadder.test.js","sourceRoot":"","sources":["security.maturityLadder.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAkC;AAElC,SAAS;AAET,cAAc;AACd,yEAA0E;AAC1E,qDAAoD;AACpD,uEAAsE;AAGtE,kEAA0E;AAE1E,IAAI,CAAC,kGAAkG,EAAE;;;;;gBAE/F,eAAe,GAAG,IAAI,iCAAe,EAAE,CAAC;gBAExC,cAAc,GAAG,IAAI,+BAAc,EAAE,CAAC;gBAC5C,cAAc,CAAC,eAAe,CAAC,qBAAU,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"security.maturityLadder.test.js","sourceRoot":"","sources":["security.maturityLadder.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAkC;AAElC,SAAS;AAET,cAAc;AACd,yEAA0E;AAC1E,qDAAoD;AACpD,uEAAsE;AAGtE,kEAA0E;AAE1E,IAAI,CAAC,kGAAkG,EAAE;;;;;gBAE/F,eAAe,GAAG,IAAI,iCAAe,EAAE,CAAC;gBAExC,cAAc,GAAG,IAAI,+BAAc,EAAE,CAAC;gBAC5C,cAAc,CAAC,e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CAAC,aAAa,EAAE,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC;4BAEpH,MAAM,GAAG;gCACT,OAAO,EAAE,EAAE;gCACX,WAAW,EAAE,QAAQ,CAAC,YAAY,EAAE;gCACpC,mBAAmB,EAAE,mBAAmB;gCACxC,cAAc,EAAE,QAAQ,CAAC,eAAe,EAAE;6BAC7C,CAAC;4BACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;wBACzB,CAAC;oBACL,CAAC;gBACL,CAAC;gBAED,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;gBAC3D,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;;;;KACxB,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -16,7 +16,7 @@ test('test the api.fintekkers.org security service by creating a maturity ladder
|
|
|
16
16
|
|
|
17
17
|
const positionFilter = new PositionFilter();
|
|
18
18
|
positionFilter.addEqualsFilter(FieldProto.ASSET_CLASS, 'Fixed Income');
|
|
19
|
-
|
|
19
|
+
positionFilter.addEqualsFilter(FieldProto.SECURITY_ISSUER_NAME, 'US Government');
|
|
20
20
|
|
|
21
21
|
var securities = await securityService.searchSecurityAsOfNow(positionFilter);
|
|
22
22
|
|
|
@@ -31,27 +31,26 @@ test('test the api.fintekkers.org security service by creating a maturity ladder
|
|
|
31
31
|
let issuance = issuanceList && issuanceList.length > 0 ? issuanceList[0] : null;
|
|
32
32
|
|
|
33
33
|
if (issuance) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
if (!issuance.getPostAuctionOutstandingQuantity() && security.getMaturityDate().getFullYear() > 2009) {
|
|
35
|
+
console.log("Issed with %s, issuance: %s", security.getSecurityID().getIdentifierValue(), issuance);
|
|
36
|
+
} else if (!issuance.getPostAuctionOutstandingQuantity() && security.getMaturityDate().getFullYear() <= 2009) {
|
|
37
|
+
//Swallow this data gap. It's old and we don't mind
|
|
38
|
+
} else {
|
|
39
|
+
let postAuctionQuantity: number = ProtoSerializationUtil.deserialize(issuance.getPostAuctionOutstandingQuantity());
|
|
40
|
+
let id: string = security.getSecurityID() ? security.getSecurityID().getIdentifierValue() : security.getID().toString();
|
|
41
|
+
|
|
42
|
+
let result = {
|
|
43
|
+
'cusip': id,
|
|
44
|
+
'issueDate': security.getIssueDate(),
|
|
45
|
+
'outstandingAmount': postAuctionQuantity,
|
|
46
|
+
'maturityDate': security.getMaturityDate()
|
|
47
|
+
};
|
|
48
|
+
results.push(result);
|
|
49
|
+
}
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
|
|
53
|
+
expect(results[0]['outstandingAmount']).toBeGreaterThan(0);
|
|
47
54
|
console.log(results);
|
|
48
|
-
console.log("Done");
|
|
49
|
-
//TODO: Get oustanding amount of bond
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//TODO: Loose end. Asset Class is a string. Maybe should be an 'extendible' enum
|
|
55
|
-
//TODO: Loose end. Security coupon rate, need to add validation logic so that coupon rate is a sensible number
|
|
56
55
|
}, 90000);
|
|
57
56
|
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
// Model Utils
|
|
40
|
+
var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
41
|
+
var dt = require("../../models/utils/datetime");
|
|
42
|
+
var TransactionService_1 = require("./TransactionService");
|
|
43
|
+
var positionfilter_1 = require("../../models/position/positionfilter");
|
|
44
|
+
test('test creating a transaction against the portfolio service', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
+
var isTrue;
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
switch (_a.label) {
|
|
48
|
+
case 0: return [4 /*yield*/, searchListTransactions()];
|
|
49
|
+
case 1:
|
|
50
|
+
isTrue = _a.sent();
|
|
51
|
+
expect(isTrue).toBe(true);
|
|
52
|
+
return [2 /*return*/];
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}); }, 30000);
|
|
56
|
+
function searchListTransactions() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
+
var now, transactionService, positionFilter, transactions, transaction;
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
switch (_a.label) {
|
|
61
|
+
case 0:
|
|
62
|
+
now = dt.ZonedDateTime.now();
|
|
63
|
+
transactionService = new TransactionService_1.TransactionService();
|
|
64
|
+
positionFilter = new positionfilter_1.PositionFilter();
|
|
65
|
+
positionFilter.addEqualsFilter(field_pb_1.FieldProto.ASSET_CLASS, 'Fixed Income');
|
|
66
|
+
return [4 /*yield*/, transactionService.searchTransaction(now.toProto(), positionFilter)];
|
|
67
|
+
case 1:
|
|
68
|
+
transactions = _a.sent();
|
|
69
|
+
console.timeEnd("searchTransaction");
|
|
70
|
+
if (transactions === undefined) {
|
|
71
|
+
console.log('No transactions found');
|
|
72
|
+
throw Error('No transactions found');
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
console.log(transactions.length);
|
|
76
|
+
transaction = transactions[0];
|
|
77
|
+
//We can get data straight from the transaction
|
|
78
|
+
transaction.getIssuerName();
|
|
79
|
+
//Or we can get information from the security
|
|
80
|
+
transaction.getSecurity().getAssetClass();
|
|
81
|
+
}
|
|
82
|
+
return [2 /*return*/, true];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=transaction.search.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.search.test.js","sourceRoot":"","sources":["transaction.search.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,cAAc;AACd,yEAA0E;AAG1E,gDAAkD;AAOlD,2DAA0D;AAK1D,uEAAsE;AAEtE,IAAI,CAAC,2DAA2D,EAAE;;;;oBACjD,qBAAM,sBAAsB,EAAE,EAAA;;gBAAvC,MAAM,GAAG,SAA8B;gBAC7C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;;KAC3B,EAAE,KAAK,CAAC,CAAC;AAEV,SAAe,sBAAsB;;;;;;oBAC7B,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;oBAC7B,kBAAkB,GAAG,IAAI,uCAAkB,EAAE,CAAC;oBAE9C,cAAc,GAAG,IAAI,+BAAc,EAAE,CAAC;oBAC5C,cAAc,CAAC,eAAe,CAAC,qBAAU,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;oBAGlD,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,CAAC;wBAC/B,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;wBACrC,MAAM,KAAK,CAAC,uBAAuB,CAAC,CAAC;oBACvC,CAAC;yBAAM,CAAC;wBACN,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;wBAE7B,WAAW,GAAgB,YAAY,CAAC,CAAC,CAAC,CAAC;wBAE/C,+CAA+C;wBAC/C,WAAW,CAAC,aAAa,EAAE,CAAC;wBAE5B,6CAA6C;wBAC7C,WAAW,CAAC,WAAW,EAAE,CAAC,aAAa,EAAE,CAAC;oBAC5C,CAAC;oBAED,sBAAO,IAAI,EAAC;;;;CACb"}
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
import { PositionFilter } from '../../models/position/positionfilter';
|
|
22
|
+
|
|
23
|
+
test('test creating a transaction against the portfolio service', async () => {
|
|
24
|
+
const isTrue = await searchListTransactions();
|
|
25
|
+
expect(isTrue).toBe(true);
|
|
26
|
+
}, 30000);
|
|
27
|
+
|
|
28
|
+
async function searchListTransactions(): Promise<boolean> {
|
|
29
|
+
const now = dt.ZonedDateTime.now();
|
|
30
|
+
const transactionService = new TransactionService();
|
|
31
|
+
|
|
32
|
+
const positionFilter = new PositionFilter();
|
|
33
|
+
positionFilter.addEqualsFilter(FieldProto.ASSET_CLASS, 'Fixed Income');
|
|
34
|
+
|
|
35
|
+
// positionFilter.addEqualsFilter(FieldProto.ID, transactionID);
|
|
36
|
+
const transactions = await transactionService.searchTransaction(now.toProto(), positionFilter);
|
|
37
|
+
console.timeEnd("searchTransaction");
|
|
38
|
+
|
|
39
|
+
if (transactions === undefined) {
|
|
40
|
+
console.log('No transactions found');
|
|
41
|
+
throw Error('No transactions found');
|
|
42
|
+
} else {
|
|
43
|
+
console.log(transactions.length);
|
|
44
|
+
|
|
45
|
+
let transaction: Transaction = transactions[0];
|
|
46
|
+
|
|
47
|
+
//We can get data straight from the transaction
|
|
48
|
+
transaction.getIssuerName();
|
|
49
|
+
|
|
50
|
+
//Or we can get information from the security
|
|
51
|
+
transaction.getSecurity().getAssetClass();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
@@ -52,7 +52,39 @@ var TransactionService_1 = require("./TransactionService");
|
|
|
52
52
|
var transaction_1 = require("../../models/transaction/transaction");
|
|
53
53
|
var assert = require("assert");
|
|
54
54
|
var positionfilter_1 = require("../../models/position/positionfilter");
|
|
55
|
-
test('test
|
|
55
|
+
test('test printing a transaction to string', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
+
var isTrue;
|
|
57
|
+
return __generator(this, function (_a) {
|
|
58
|
+
switch (_a.label) {
|
|
59
|
+
case 0: return [4 /*yield*/, testToString()];
|
|
60
|
+
case 1:
|
|
61
|
+
isTrue = _a.sent();
|
|
62
|
+
expect(isTrue).toBe(true);
|
|
63
|
+
return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}); }, 30000);
|
|
67
|
+
function testToString() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
+
var now, today, positionFilter, transactionProto, transaction;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
switch (_a.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
now = dt.ZonedDateTime.now();
|
|
74
|
+
today = new local_date_pb_1.LocalDateProto().setDay(1).setMonth(1).setYear(2021);
|
|
75
|
+
positionFilter = new positionfilter_1.PositionFilter();
|
|
76
|
+
positionFilter.addEqualsFilter(field_pb_1.FieldProto.ASSET_CLASS, 'Fixed Income');
|
|
77
|
+
return [4 /*yield*/, getTransaction(now, positionFilter, today)];
|
|
78
|
+
case 1:
|
|
79
|
+
transactionProto = _a.sent();
|
|
80
|
+
transaction = new transaction_1.default(transactionProto);
|
|
81
|
+
transaction.toString();
|
|
82
|
+
return [2 /*return*/, true];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
test('test creating a transaction against the transaction service', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
88
|
var isTrue;
|
|
57
89
|
return __generator(this, function (_a) {
|
|
58
90
|
switch (_a.label) {
|
|
@@ -66,18 +98,54 @@ test('test creating a transaction against the portfolio service', function () {
|
|
|
66
98
|
}); }, 30000);
|
|
67
99
|
function testTransaction() {
|
|
68
100
|
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
var
|
|
101
|
+
var transactionService, now, today, positionFilter, transaction, createTransactionResponse, transactionResponse, transactionID, transactions;
|
|
70
102
|
return __generator(this, function (_a) {
|
|
71
103
|
switch (_a.label) {
|
|
72
104
|
case 0:
|
|
73
|
-
|
|
105
|
+
transactionService = new TransactionService_1.TransactionService();
|
|
74
106
|
now = dt.ZonedDateTime.now();
|
|
75
107
|
today = new local_date_pb_1.LocalDateProto().setDay(1).setMonth(1).setYear(2021);
|
|
76
|
-
securityService = new SecurityService_1.SecurityService();
|
|
77
|
-
portfolioService = new PortfolioService_1.PortfolioService();
|
|
78
|
-
transactionService = new TransactionService_1.TransactionService();
|
|
79
108
|
positionFilter = new positionfilter_1.PositionFilter();
|
|
80
109
|
positionFilter.addEqualsFilter(field_pb_1.FieldProto.ASSET_CLASS, 'Fixed Income');
|
|
110
|
+
return [4 /*yield*/, getTransaction(now, positionFilter, today)];
|
|
111
|
+
case 1:
|
|
112
|
+
transaction = _a.sent();
|
|
113
|
+
// var validationSummary = await transactionService.validateCreateTransaction(new Transaction(transaction));
|
|
114
|
+
// assert(validationSummary.getErrorsList().length == 0, "Validation errors found");
|
|
115
|
+
console.time("createTransaction");
|
|
116
|
+
return [4 /*yield*/, transactionService.createTransaction(new transaction_1.default(transaction))];
|
|
117
|
+
case 2:
|
|
118
|
+
createTransactionResponse = _a.sent();
|
|
119
|
+
transactionResponse = createTransactionResponse.getTransactionResponse();
|
|
120
|
+
assert(transactionResponse, "No transaction response found");
|
|
121
|
+
console.timeEnd("createTransaction");
|
|
122
|
+
console.log("Searching transaction");
|
|
123
|
+
console.time("searchTransaction");
|
|
124
|
+
transactionID = uuid.UUID.fromU8Array(transactionResponse.getUuid().getRawUuid_asU8());
|
|
125
|
+
positionFilter.addEqualsFilter(field_pb_1.FieldProto.ID, transactionID);
|
|
126
|
+
return [4 /*yield*/, transactionService.searchTransaction(now.toProto(), positionFilter)];
|
|
127
|
+
case 3:
|
|
128
|
+
transactions = _a.sent();
|
|
129
|
+
console.timeEnd("searchTransaction");
|
|
130
|
+
if (transactions === undefined) {
|
|
131
|
+
console.log('No transactions found');
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
console.log(transactions.length);
|
|
135
|
+
}
|
|
136
|
+
return [2 /*return*/, true];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function getTransaction(now, positionFilter, today) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
143
|
+
var securityService, portfolioService, fixedIncomeSecurities, security, portfolios, portfolio, transaction;
|
|
144
|
+
return __generator(this, function (_a) {
|
|
145
|
+
switch (_a.label) {
|
|
146
|
+
case 0:
|
|
147
|
+
securityService = new SecurityService_1.SecurityService();
|
|
148
|
+
portfolioService = new PortfolioService_1.PortfolioService();
|
|
81
149
|
console.time("searchSecurity");
|
|
82
150
|
return [4 /*yield*/, securityService
|
|
83
151
|
.searchSecurity(now.toProto(), positionFilter)
|
|
@@ -118,30 +186,7 @@ function testTransaction() {
|
|
|
118
186
|
transaction.setQuantity(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('10000.00'));
|
|
119
187
|
transaction.setPortfolio(portfolio.proto);
|
|
120
188
|
transaction.setSecurity(security.proto);
|
|
121
|
-
|
|
122
|
-
// assert(validationSummary.getErrorsList().length == 0, "Validation errors found");
|
|
123
|
-
console.time("createTransaction");
|
|
124
|
-
return [4 /*yield*/, transactionService.createTransaction(new transaction_1.default(transaction))];
|
|
125
|
-
case 3:
|
|
126
|
-
createTransactionResponse = _a.sent();
|
|
127
|
-
transactionResponse = createTransactionResponse.getTransactionResponse();
|
|
128
|
-
assert(transactionResponse, "No transaction response found");
|
|
129
|
-
console.timeEnd("createTransaction");
|
|
130
|
-
console.log("Searching transaction");
|
|
131
|
-
console.time("searchTransaction");
|
|
132
|
-
transactionID = uuid.UUID.fromU8Array(transactionResponse.getUuid().getRawUuid_asU8());
|
|
133
|
-
positionFilter.addEqualsFilter(field_pb_1.FieldProto.ID, transactionID);
|
|
134
|
-
return [4 /*yield*/, transactionService.searchTransaction(now.toProto(), positionFilter)];
|
|
135
|
-
case 4:
|
|
136
|
-
transactions = _a.sent();
|
|
137
|
-
console.timeEnd("searchTransaction");
|
|
138
|
-
if (transactions === undefined) {
|
|
139
|
-
console.log('No transactions found');
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
console.log(transactions.length);
|
|
143
|
-
}
|
|
144
|
-
return [2 /*return*/, true];
|
|
189
|
+
return [2 /*return*/, transaction];
|
|
145
190
|
}
|
|
146
191
|
});
|
|
147
192
|
});
|
|
@@ -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;AAClC,uEAAsE;
|
|
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;AAGtE,IAAI,CAAC,uCAAuC,EAAE;;;;oBAC7B,qBAAM,YAAY,EAAE,EAAA;;gBAA7B,MAAM,GAAG,SAAoB;gBACnC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;;KAC3B,EAAE,KAAK,CAAC,CAAC;AAEV,SAAe,YAAY;;;;;;oBACnB,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;oBAC7B,KAAK,GAAG,IAAI,8BAAc,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IA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