@fintekkers/ledger-models 0.1.72 → 0.1.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +1 -1
- package/node/wrappers/models/position/field.js +27 -0
- package/node/wrappers/models/position/field.js.map +1 -0
- package/node/wrappers/models/position/field.test.js +63 -0
- package/node/wrappers/models/position/field.test.js.map +1 -0
- package/node/wrappers/models/position/field.test.ts +13 -0
- package/node/wrappers/models/position/field.ts +25 -0
- package/node/wrappers/models/position/position.js +7 -19
- package/node/wrappers/models/position/position.js.map +1 -1
- package/node/wrappers/models/position/position.test copy.js +107 -0
- package/node/wrappers/models/position/position.test copy.js.map +1 -0
- package/node/wrappers/models/position/position.test.js +32 -4
- package/node/wrappers/models/position/position.test.js.map +1 -1
- package/node/wrappers/models/position/position.test.ts +34 -19
- package/node/wrappers/models/position/position.ts +11 -38
- package/node/wrappers/models/utils/date.js +2 -2
- package/node/wrappers/models/utils/date.js.map +1 -1
- package/node/wrappers/models/utils/date.ts +2 -4
- package/node/wrappers/models/utils/datetime.js +0 -19
- package/node/wrappers/models/utils/datetime.js.map +1 -1
- package/node/wrappers/models/utils/datetime.test.js +48 -0
- package/node/wrappers/models/utils/datetime.test.js.map +1 -0
- package/node/wrappers/models/utils/datetime.test.ts +8 -0
- package/node/wrappers/models/utils/datetime.ts +0 -24
- package/node/wrappers/models/utils/protoEnum.js +54 -0
- package/node/wrappers/models/utils/protoEnum.js.map +1 -0
- package/node/wrappers/models/utils/protoEnum.test.js +25 -0
- package/node/wrappers/models/utils/protoEnum.test.js.map +1 -0
- package/node/wrappers/models/utils/protoEnum.test.ts +28 -0
- package/node/wrappers/models/utils/protoEnum.ts +59 -0
- package/node/wrappers/models/utils/serialization.js +9 -2
- package/node/wrappers/models/utils/serialization.js.map +1 -1
- package/node/wrappers/models/utils/serialization.ts +11 -9
- package/node/wrappers/services/portfolio-service/portfolio.test.js +0 -1
- package/node/wrappers/services/portfolio-service/portfolio.test.js.map +1 -1
- package/node/wrappers/services/portfolio-service/portfolio.test.ts +0 -1
- package/node/wrappers/services/position-service/PositionService.js +2 -2
- package/node/wrappers/services/position-service/PositionService.js.map +1 -1
- package/node/wrappers/services/position-service/PositionService.ts +1 -1
- package/node/wrappers/services/position-service/position.test.js +18 -63
- package/node/wrappers/services/position-service/position.test.js.map +1 -1
- package/node/wrappers/services/position-service/position.test.ts +8 -73
- package/node/wrappers/services/security-service/security.maturityLadder.test.js +0 -1
- package/node/wrappers/services/security-service/security.maturityLadder.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.maturityLadder.test.ts +0 -2
- package/node/wrappers/services/transaction-service/transaction.search.test.js +0 -1
- package/node/wrappers/services/transaction-service/transaction.search.test.js.map +1 -1
- package/node/wrappers/services/transaction-service/transaction.search.test.ts +0 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.test.js","sourceRoot":"","sources":["position.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"position.test.js","sourceRoot":"","sources":["position.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT,+EAAuG;AACvG,6EAA8E;AAE9E,cAAc;AACd,yEAA0E;AAC1E,wDAA4D;AAE5D,qBAAqB;AACrB,mFAAkF;AAClF,6GAA4G;AAE5G,IAAI,CAAC,yEAAyE,EAAE;;;;oBAC/D,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;;;;;;oBAErB,MAAM,GAAG,CAAC,qBAAU,CAAC,WAAW,EAAE,qBAAU,CAAC,UAAU,EAAE,qBAAU,CAAC,YAAY,EAAE,qBAAU,CAAC,SAAS,EAAE,qBAAU,CAAC,YAAY,CAAC,CAAC;oBACjI,QAAQ,GAAG,CAAC,yBAAY,CAAC,iBAAiB,CAAC,CAAC;oBAE5C,OAAO,GAAG,IAAI,qDAAyB,EAAE;yBAC1C,OAAO,CAAC,wBAAa,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;yBACtC,aAAa,CAAC,MAAM,CAAC;yBACrB,eAAe,CAAC,QAAQ,CAAC;yBACzB,eAAe,CAAC,+BAAiB,CAAC,WAAW,CAAC;yBAC9C,eAAe,CAAC,+BAAiB,CAAC,YAAY,CAAC,CAAC;oBAEnC,qBAAM,IAAI,iCAAe,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAA;;oBAAvD,SAAS,GAAG,SAA2C;oBAE3D,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBACtC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,qBAAqB,CAAC,CAAA;wBAEjD,aAAW,SAAS,CAAC,CAAC,CAAC,CAAC;wBAE5B,MAAM,CAAC,OAAO,CAAC,UAAA,KAAK;4BAClB,UAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;wBAChC,CAAC,CAAC,CAAA;wBACF,sBAAO,IAAI,EAAA;oBACb,CAAC;yBAAM,CAAC;wBACN,sBAAO,KAAK,EAAC;oBACf,CAAC;;;;;CACF"}
|
|
@@ -1,88 +1,22 @@
|
|
|
1
1
|
// Models
|
|
2
|
-
|
|
3
|
-
import { PositionFilter } from '../../models/position/positionfilter';
|
|
4
|
-
import { Position } from '../../models/position/hardcoded.position';
|
|
5
|
-
import { IdentifierProto } from '../../../fintekkers/models/security/identifier/identifier_pb';
|
|
6
2
|
import { PositionTypeProto, PositionViewProto } from '../../../fintekkers/models/position/position_pb';
|
|
7
|
-
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
8
3
|
import { MeasureProto } from '../../../fintekkers/models/position/measure_pb';
|
|
9
|
-
import { PortfolioProto } from '../../../fintekkers/models/portfolio/portfolio_pb';
|
|
10
|
-
import { PositionFilterProto } from '../../../fintekkers/models/position/position_filter_pb';
|
|
11
4
|
|
|
12
5
|
// Model Utils
|
|
13
6
|
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
14
|
-
import { FieldMapEntry } from '../../../fintekkers/models/position/position_util_pb';
|
|
15
7
|
import { ZonedDateTime } from '../../models/utils/datetime';
|
|
16
|
-
import { pack } from '../../models/utils/serialization.util';
|
|
17
|
-
import { Any } from 'google-protobuf/google/protobuf/any_pb';
|
|
18
8
|
|
|
19
9
|
//Requests & Services
|
|
20
10
|
import { PositionService } from '../../services/position-service/PositionService';
|
|
21
11
|
import { QueryPositionRequestProto } from '../../../fintekkers/requests/position/query_position_request_pb';
|
|
22
12
|
|
|
23
13
|
test('test getting a position against the api.fintekkers.org position service', async () => {
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
const isTrue = await testPosition();
|
|
15
|
+
expect(isTrue).toBe(true);
|
|
26
16
|
}, 30000);
|
|
27
17
|
|
|
28
|
-
async function get_position(security: SecurityProto,
|
|
29
|
-
portfolio: PortfolioProto,
|
|
30
|
-
measures: MeasureProto[],
|
|
31
|
-
position_type: PositionTypeProto,
|
|
32
|
-
fields = [FieldProto.PORTFOLIO, FieldProto.SECURITY],
|
|
33
|
-
additional_filters = [], as_of = ZonedDateTime.now()) {
|
|
34
|
-
const filters = [];
|
|
35
|
-
|
|
36
|
-
if (security !== null && security !== undefined) {
|
|
37
|
-
const id_proto = new IdentifierProto();
|
|
38
|
-
id_proto.setIdentifierValue(security.getIdentifier().getIdentifierValue());
|
|
39
|
-
id_proto.setIdentifierType(security.getIdentifier().getIdentifierType());
|
|
40
|
-
|
|
41
|
-
const security_id_packed = new Any();
|
|
42
|
-
security_id_packed.pack(id_proto);
|
|
43
|
-
|
|
44
|
-
const fieldMapEntry = new FieldMapEntry();
|
|
45
|
-
fieldMapEntry.setField(FieldProto.IDENTIFIER);
|
|
46
|
-
fieldMapEntry.setFieldValuePacked(security_id_packed);
|
|
47
|
-
|
|
48
|
-
filters.push(fieldMapEntry);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (portfolio !== null && portfolio !== undefined) {
|
|
52
|
-
const fieldMapEntry = new FieldMapEntry();
|
|
53
|
-
fieldMapEntry.setField(FieldProto.PORTFOLIO_NAME);
|
|
54
|
-
fieldMapEntry.setFieldValuePacked(pack(portfolio.getPortfolioName()));
|
|
55
|
-
|
|
56
|
-
filters.push(fieldMapEntry);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (additional_filters !== null && additional_filters.length > 0) {
|
|
60
|
-
filters.push(...additional_filters);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const filter_fields = new PositionFilterProto();
|
|
64
|
-
filter_fields.setFiltersList(filters);
|
|
65
|
-
|
|
66
|
-
const as_of_proto = as_of.toProto();
|
|
67
|
-
|
|
68
|
-
const request = new QueryPositionRequestProto();
|
|
69
|
-
request.setPositionType(position_type);
|
|
70
|
-
request.setPositionView(PositionViewProto.DEFAULT_VIEW);
|
|
71
|
-
request.setFieldsList(fields);
|
|
72
|
-
request.setMeasuresList(measures);
|
|
73
|
-
request.setFilterFields(filter_fields);
|
|
74
|
-
request.setAsOf(as_of_proto);
|
|
75
|
-
|
|
76
|
-
let position_service = new PositionService();
|
|
77
|
-
|
|
78
|
-
const positions: Position[] = await position_service.search(request);
|
|
79
|
-
|
|
80
|
-
return positions;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
18
|
async function testPosition(): Promise<boolean> {
|
|
84
19
|
//Get the Federal Reserve portfolio
|
|
85
|
-
|
|
86
20
|
let fields = [FieldProto.SECURITY_ID, FieldProto.TRADE_DATE, FieldProto.PRODUCT_TYPE, FieldProto.PORTFOLIO, FieldProto.PRODUCT_TYPE];
|
|
87
21
|
let measures = [MeasureProto.DIRECTED_QUANTITY];
|
|
88
22
|
|
|
@@ -95,16 +29,17 @@ async function testPosition(): Promise<boolean> {
|
|
|
95
29
|
|
|
96
30
|
let positions = await new PositionService().search(request);
|
|
97
31
|
|
|
98
|
-
if (positions) {
|
|
32
|
+
if (positions && positions.length > 0) {
|
|
99
33
|
console.log(positions.length + " positions returned")
|
|
100
34
|
|
|
101
35
|
let position = positions[0];
|
|
102
36
|
|
|
103
|
-
|
|
104
|
-
|
|
37
|
+
fields.forEach(field => {
|
|
38
|
+
position.getFieldValue(field);
|
|
39
|
+
})
|
|
40
|
+
return true
|
|
105
41
|
} else {
|
|
106
|
-
|
|
42
|
+
return false;
|
|
107
43
|
}
|
|
108
|
-
return true;
|
|
109
44
|
}
|
|
110
45
|
|
|
@@ -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;
|
|
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;AAEtE,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;gBACvE,cAAc,CAAC,eAAe,CAAC,qBAAU,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC;gBAEhE,qBAAM,eAAe,CAAC,qBAAqB,CAAC,cAAc,CAAC,EAAA;;gBAAxE,UAAU,GAAG,SAA2D;gBAE5E,MAAM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AAc,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;;;;KAC9D,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -6,7 +6,6 @@ import assert = require('assert');
|
|
|
6
6
|
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
7
7
|
import { SecurityService } from './SecurityService';
|
|
8
8
|
import { PositionFilter } from '../../models/position/positionfilter';
|
|
9
|
-
import { PositionFilterOperator } from '../../../fintekkers/models/position/position_util_pb';
|
|
10
9
|
import Security from '../../models/security/security';
|
|
11
10
|
import { ProtoSerializationUtil } from '../../models/utils/serialization';
|
|
12
11
|
|
|
@@ -51,6 +50,5 @@ test('test the api.fintekkers.org security service by creating a maturity ladder
|
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
expect(results[0]['outstandingAmount']).toBeGreaterThan(0);
|
|
54
|
-
console.log(results);
|
|
55
53
|
}, 90000);
|
|
56
54
|
|
|
@@ -1 +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,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,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;wBACF,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"}
|
|
@@ -40,8 +40,6 @@ async function searchListTransactions(): Promise<boolean> {
|
|
|
40
40
|
console.log('No transactions found');
|
|
41
41
|
throw Error('No transactions found');
|
|
42
42
|
} else {
|
|
43
|
-
console.log(transactions.length);
|
|
44
|
-
|
|
45
43
|
let transaction: Transaction = transactions[0];
|
|
46
44
|
|
|
47
45
|
//We can get data straight from the transaction
|