@fintekkers/ledger-models 0.1.72 → 0.1.73
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 +4 -8
- 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.map +1 -1
- package/node/wrappers/models/position/position.test.ts +1 -14
- package/node/wrappers/models/position/position.ts +4 -14
- 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/protoEnum.js +50 -0
- package/node/wrappers/models/utils/protoEnum.js.map +1 -0
- package/node/wrappers/models/utils/protoEnum.test.js +21 -0
- package/node/wrappers/models/utils/protoEnum.test.js.map +1 -0
- package/node/wrappers/models/utils/protoEnum.test.ts +23 -0
- package/node/wrappers/models/utils/protoEnum.ts +54 -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 +9 -2
- 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
package/.env
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Field = void 0;
|
|
4
|
+
var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
5
|
+
var Field = /** @class */ (function () {
|
|
6
|
+
function Field(field) {
|
|
7
|
+
this.field = field;
|
|
8
|
+
}
|
|
9
|
+
Field.prototype.getName = function () {
|
|
10
|
+
function getEnumNameByValue(enumObj, value) {
|
|
11
|
+
// Find the enum key that matches the value
|
|
12
|
+
var entry = Object.entries(enumObj).find(function (_a) {
|
|
13
|
+
var val = _a[1];
|
|
14
|
+
return val === value;
|
|
15
|
+
});
|
|
16
|
+
// Return the key name if found, otherwise undefined or a placeholder
|
|
17
|
+
return entry ? entry[0] : 'undefined';
|
|
18
|
+
}
|
|
19
|
+
return getEnumNameByValue(field_pb_1.FieldProto, this.field);
|
|
20
|
+
};
|
|
21
|
+
Field.prototype.toString = function () {
|
|
22
|
+
return null; //this.getEnumValueName();
|
|
23
|
+
};
|
|
24
|
+
return Field;
|
|
25
|
+
}());
|
|
26
|
+
exports.Field = Field;
|
|
27
|
+
//# sourceMappingURL=field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.js","sourceRoot":"","sources":["field.ts"],"names":[],"mappings":";;;AACA,yEAA0E;AAE1E;IAGI,eAAY,KAAiB;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,uBAAO,GAAP;QACI,SAAS,kBAAkB,CAAC,OAAY,EAAE,KAAa;YACnD,2CAA2C;YAC3C,IAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,UAAC,EAAO;oBAAJ,GAAG,QAAA;gBAAM,OAAA,GAAG,KAAK,KAAK;YAAb,CAAa,CAAC,CAAC;YACvE,qEAAqE;YACrE,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;QAC1C,CAAC;QAED,OAAO,kBAAkB,CAAC,qBAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,wBAAQ,GAAR;QACI,OAAO,IAAI,CAAC,CAAA,0BAA0B;IAC1C,CAAC;IACL,YAAC;AAAD,CAAC,AArBD,IAqBC;AArBY,sBAAK"}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
40
|
+
var field_1 = require("./field");
|
|
41
|
+
test('test the field wrapper', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var isTrue;
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
switch (_a.label) {
|
|
45
|
+
case 0: return [4 /*yield*/, testSerialization()];
|
|
46
|
+
case 1:
|
|
47
|
+
isTrue = _a.sent();
|
|
48
|
+
expect(isTrue).toBe(true);
|
|
49
|
+
return [2 /*return*/];
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}); });
|
|
53
|
+
function testSerialization() {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
+
var field;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
field = new field_1.Field(field_pb_1.FieldProto.TRADE_DATE);
|
|
58
|
+
expect(field.getName()).toBe("TRADE_DATE");
|
|
59
|
+
return [2 /*return*/, true];
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=field.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.test.js","sourceRoot":"","sources":["field.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAA0E;AAC1E,iCAAgC;AAEhC,IAAI,CAAC,wBAAwB,EAAE;;;;oBACZ,qBAAM,iBAAiB,EAAE,EAAA;;gBAAlC,MAAM,GAAG,SAAyB;gBACxC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;;KAC7B,CAAC,CAAC;AAEH,SAAe,iBAAiB;;;;YACxB,KAAK,GAAU,IAAI,aAAK,CAAC,qBAAU,CAAC,UAAU,CAAC,CAAC;YACpD,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC3C,sBAAO,IAAI,EAAC;;;CACf"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
2
|
+
import { Field } from './field';
|
|
3
|
+
|
|
4
|
+
test('test the field wrapper', async () => {
|
|
5
|
+
const isTrue = await testSerialization();
|
|
6
|
+
expect(isTrue).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
async function testSerialization(): Promise<boolean> {
|
|
10
|
+
let field: Field = new Field(FieldProto.TRADE_DATE);
|
|
11
|
+
expect(field.getName()).toBe("TRADE_DATE");
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
3
|
+
|
|
4
|
+
export class Field {
|
|
5
|
+
private field: FieldProto;
|
|
6
|
+
|
|
7
|
+
constructor(field: FieldProto) {
|
|
8
|
+
this.field = field;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getName() {
|
|
12
|
+
function getEnumNameByValue(enumObj: any, value: number): string {
|
|
13
|
+
// Find the enum key that matches the value
|
|
14
|
+
const entry = Object.entries(enumObj).find(([, val]) => val === value);
|
|
15
|
+
// Return the key name if found, otherwise undefined or a placeholder
|
|
16
|
+
return entry ? entry[0] : 'undefined';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return getEnumNameByValue(FieldProto, this.field);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
toString(): string {
|
|
23
|
+
return null;//this.getEnumValueName();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -16,10 +16,6 @@ var wrappers_pb_1 = require("google-protobuf/google/protobuf/wrappers_pb");
|
|
|
16
16
|
var Position = /** @class */ (function () {
|
|
17
17
|
function Position(positionProto) {
|
|
18
18
|
this.proto = positionProto;
|
|
19
|
-
// //For each field, put into a map
|
|
20
|
-
// this.proto.getFieldsList().forEach(field => {
|
|
21
|
-
// console.log(field);
|
|
22
|
-
// });
|
|
23
19
|
}
|
|
24
20
|
Position.prototype.getFieldValue = function (field) {
|
|
25
21
|
return this.getField(new position_util_pb_1.FieldMapEntry().setField(field));
|
|
@@ -28,13 +24,13 @@ var Position = /** @class */ (function () {
|
|
|
28
24
|
for (var _i = 0, _a = this.proto.getFieldsList(); _i < _a.length; _i++) {
|
|
29
25
|
var tmpField = _a[_i];
|
|
30
26
|
if (tmpField.getField() === fieldToGet.getField()) {
|
|
31
|
-
if (tmpField.getStringValue()) {
|
|
27
|
+
if (tmpField.getStringValue() !== undefined && tmpField.getStringValue().length > 0) {
|
|
32
28
|
return tmpField.getStringValue();
|
|
33
29
|
}
|
|
34
30
|
if (tmpField.getEnumValue() > 0) {
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
|
|
31
|
+
// let fieldName: string = new Field(fieldToGet.getField()).getName();
|
|
32
|
+
// let proto: ProtoEnum = ProtoEnum.fromEnumName(fieldName, tmpField.getEnumValue());
|
|
33
|
+
return tmpField.getEnumValue(); //proto.enumDescriptor['EXECUTED'];
|
|
38
34
|
}
|
|
39
35
|
var unpackedValue = Position.unpackField(tmpField);
|
|
40
36
|
if (field_pb_1.FieldProto.SECURITY == fieldToGet.getField()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.js","sourceRoot":"","sources":["position.ts"],"names":[],"mappings":";AAAA,2FAA2F;;;
|
|
1
|
+
{"version":3,"file":"position.js","sourceRoot":"","sources":["position.ts"],"names":[],"mappings":";AAAA,2FAA2F;;;AAE3F,yEAA0E;AAE1E,yFAAsG;AACtG,oDAA+C;AAC/C,iDAA4C;AAC5C,mEAAoE;AACpE,yFAAyF;AACzF,+EAA+E;AAC/E,8FAA+F;AAC/F,6EAA8E;AAE9E,wDAAgE;AAChE,2EAA0E;AAE1E;IAGE,kBAAY,aAA4B;QACtC,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC;IAC7B,CAAC;IAEM,gCAAa,GAApB,UAAqB,KAAiB;QACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,gCAAa,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5D,CAAC;IAEM,2BAAQ,GAAf,UAAgB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AC;YAC3F,KAAK,qBAAU,CAAC,gBAAgB,CAAC;YACjC,KAAK,qBAAU,CAAC,eAAe;gBAC7B,mDAAmD;gBACnD,gFAAgF;gBAChF,OAAO,IAAI,CAAC,CAAC,qDAAqD;YACpE,KAAK,qBAAU,CAAC,cAAc,CAAC;YAC/B,KAAK,qBAAU,CAAC,oBAAoB,CAAC;YACrC,KAAK,qBAAU,CAAC,YAAY,CAAC;YAC7B,KAAK,qBAAU,CAAC,WAAW;gBACzB,OAAO,yBAAW,CAAC,iBAAiB,CAAC,aAAa,CAAC,mBAAmB,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;YACvF,KAAK,qBAAU,CAAC,SAAS;gBACvB,OAAO,aAAa,CAAC,mBAAmB,EAAE,CAAC;YAC7C,KAAK,qBAAU,CAAC,QAAQ;gBACtB,OAAO,aAAa,CAAC,mBAAmB,EAAE,CAAC;YAC7C;gBACE,MAAM,IAAI,KAAK,CAAC,4CAAqC,qBAAU,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAE,CAAC,CAAC;QACjG,CAAC;IACH,CAAC;IASH,eAAC;AAAD,CAAC,AA7ID,IA6IC;AA7IY,4BAAQ"}
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
var uuid_1 = require("../utils/uuid");
|
|
40
|
+
var any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
|
|
41
|
+
var decimal_value_pb_1 = require("../../../fintekkers/models/util/decimal_value_pb");
|
|
42
|
+
var position_pb_1 = require("../../../fintekkers/models/position/position_pb");
|
|
43
|
+
var position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
|
|
44
|
+
var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
45
|
+
var measure_pb_1 = require("../../../fintekkers/models/position/measure_pb");
|
|
46
|
+
var security_pb_1 = require("../../../fintekkers/models/security/security_pb");
|
|
47
|
+
var portfolio_pb_1 = require("../../../fintekkers/models/portfolio/portfolio_pb");
|
|
48
|
+
var position_1 = require("./position");
|
|
49
|
+
var date_1 = require("../utils/date");
|
|
50
|
+
var position_status_pb_1 = require("../../../fintekkers/models/position/position_status_pb");
|
|
51
|
+
test('test the position wrapper', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
+
var isTrue;
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
switch (_a.label) {
|
|
55
|
+
case 0: return [4 /*yield*/, testSerialization()];
|
|
56
|
+
case 1:
|
|
57
|
+
isTrue = _a.sent();
|
|
58
|
+
expect(isTrue).toBe(true);
|
|
59
|
+
return [2 /*return*/];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}); });
|
|
63
|
+
function testSerialization() {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
+
var fields, security, portfolio, tradeDate, productType, id, measure, measureValue, tradeDatePacked, idPacked, positionProto, position, tradeDatePosition, securityPosition, portfolioPosition, positionID;
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
fields = [field_pb_1.FieldProto.ID, field_pb_1.FieldProto.TRADE_DATE, field_pb_1.FieldProto.PRODUCT_TYPE, field_pb_1.FieldProto.PORTFOLIO, field_pb_1.FieldProto.SECURITY];
|
|
68
|
+
security = new security_pb_1.SecurityProto().setAssetClass("Test");
|
|
69
|
+
portfolio = new portfolio_pb_1.PortfolioProto().setPortfolioName("Test portfolio");
|
|
70
|
+
tradeDate = date_1.LocalDate.today().toDate();
|
|
71
|
+
productType = "Test product type";
|
|
72
|
+
id = new uuid_1.UUID(uuid_1.UUID.random().toBytes());
|
|
73
|
+
measure = measure_pb_1.MeasureProto.DIRECTED_QUANTITY;
|
|
74
|
+
measureValue = new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue("1.0");
|
|
75
|
+
tradeDatePacked = new any_pb_1.Any();
|
|
76
|
+
tradeDatePacked.setTypeUrl("Doesn't matter");
|
|
77
|
+
tradeDatePacked.setValue(date_1.LocalDate.from(tradeDate).toProto().serializeBinary());
|
|
78
|
+
idPacked = new any_pb_1.Any();
|
|
79
|
+
idPacked.setTypeUrl("Doesn't matter");
|
|
80
|
+
idPacked.setValue(id.toUUIDProto().serializeBinary());
|
|
81
|
+
positionProto = new position_pb_1.PositionProto();
|
|
82
|
+
positionProto.setFieldsList([
|
|
83
|
+
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.TRADE_DATE).setFieldValuePacked(tradeDatePacked),
|
|
84
|
+
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.SECURITY).setFieldValuePacked(security),
|
|
85
|
+
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.PORTFOLIO).setFieldValuePacked(portfolio),
|
|
86
|
+
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.POSITION_STATUS).setEnumValue(position_status_pb_1.PositionStatusProto.EXECUTED),
|
|
87
|
+
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.PRODUCT_TYPE).setStringValue(productType),
|
|
88
|
+
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.ID).setFieldValuePacked(idPacked),
|
|
89
|
+
]);
|
|
90
|
+
position = new position_1.Position(positionProto);
|
|
91
|
+
tradeDatePosition = position.getFieldValue(field_pb_1.FieldProto.TRADE_DATE);
|
|
92
|
+
expect(tradeDate.getFullYear()).toBe(tradeDatePosition.getFullYear());
|
|
93
|
+
expect(tradeDate.getMonth()).toBe(tradeDatePosition.getMonth());
|
|
94
|
+
expect(tradeDate.getDay()).toBe(tradeDatePosition.getDay());
|
|
95
|
+
securityPosition = position.getFieldValue(field_pb_1.FieldProto.SECURITY);
|
|
96
|
+
expect(securityPosition.getAssetClass()).toBe(security.getAssetClass());
|
|
97
|
+
portfolioPosition = position.getFieldValue(field_pb_1.FieldProto.PORTFOLIO);
|
|
98
|
+
expect(portfolioPosition.getPortfolioName()).toBe(portfolio.getPortfolioName());
|
|
99
|
+
expect(position.getFieldValue(field_pb_1.FieldProto.PRODUCT_TYPE)).toBe(productType);
|
|
100
|
+
positionID = position.getFieldValue(field_pb_1.FieldProto.ID);
|
|
101
|
+
expect(positionID.toString()).toBe(id.toString());
|
|
102
|
+
expect(position.getFieldValue(field_pb_1.FieldProto.POSITION_STATUS)).toBe(position_status_pb_1.PositionStatusProto.EXECUTED);
|
|
103
|
+
return [2 /*return*/, true];
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=position.test%20copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.test copy.js","sourceRoot":"","sources":["position.test copy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sCAAqC;AACrC,iEAA6D;AAS7D,qFAAqF;AAErF,+EAAsH;AACtH,yFAAqF;AACrF,yEAA0E;AAK1E,6EAA8E;AAC9E,+EAAgF;AAChF,kFAAmF;AACnF,uCAAsC;AACtC,sCAA0C;AAC1C,6FAA6F;AAE7F,IAAI,CAAC,2BAA2B,EAAE;;;;oBACf,qBAAM,iBAAiB,EAAE,EAAA;;gBAAlC,MAAM,GAAG,SAAyB;gBACxC,MAAM,CAAC,MAAM,CAAC,CAA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C;YAEpE,iBAAiB,GAAmB,QAAQ,CAAC,aAAa,CAAC,qBAAU,CAAC,SAAS,CAAC,CAAC;YACrF,MAAM,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC;YAEhF,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,qBAAU,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAEtE,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,qBAAU,CAAC,EAAE,CAAC,CAAC;YACvD,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;YAElD,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,qBAAU,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,wCAAmB,CAAC,QAAQ,CAAC,CAAC;YAE9F,sBAAO,IAAI,EAAC;;;CACf"}
|
|
@@ -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,sCAAqC;AACrC,iEAA6D;AAI7D,qFAAqF;AACrF,+EAAgF;AAChF,yFAAqF;AACrF,yEAA0E;AAC1E,6EAA8E;AAC9E,+EAAgF;AAChF,kFAAmF;AACnF,uCAAsC;AACtC,sCAA0C;AAC1C,6FAA6F;AAE7F,IAAI,CAAC,2BAA2B,EAAE;;;;oBACf,qBAAM,iBAAiB,EAAE,EAAA;;gBAAlC,MAAM,GAAG,SAAyB;gBACxC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,C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mB,QAAQ,CAAC,aAAa,CAAC,qBAAU,CAAC,SAAS,CAAC,CAAC;YACrF,MAAM,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC;YAEhF,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,qBAAU,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAEtE,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,qBAAU,CAAC,EAAE,CAAC,CAAC;YACvD,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;YAElD,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,qBAAU,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,wCAAmB,CAAC,QAAQ,CAAC,CAAC;YAE9F,sBAAO,IAAI,EAAC;;;CACf"}
|
|
@@ -1,25 +1,12 @@
|
|
|
1
|
-
import { LocalDateProto } from '../../../fintekkers/models/util/local_date_pb';
|
|
2
|
-
import { UUIDProto } from '../../../fintekkers/models/util/uuid_pb';
|
|
3
|
-
import { ProtoSerializationUtil } from '../utils/serialization';
|
|
4
1
|
import { UUID } from '../utils/uuid';
|
|
5
2
|
import { Any } from 'google-protobuf/google/protobuf/any_pb';
|
|
6
3
|
|
|
7
4
|
import assert = require('assert');
|
|
8
|
-
import Transaction from '../transaction/transaction';
|
|
9
|
-
import { TransactionProto } from '../../../fintekkers/models/transaction/transaction_pb';
|
|
10
|
-
import { TransactionTypeProto } from '../../../fintekkers/models/transaction/transaction_type_pb';
|
|
11
|
-
import { LocalTimestampProto } from '../../../fintekkers/models/util/local_timestamp_pb';
|
|
12
5
|
|
|
13
|
-
import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
|
14
6
|
import { DecimalValueProto } from '../../../fintekkers/models/util/decimal_value_pb';
|
|
15
|
-
import {
|
|
16
|
-
import { PositionProto, PositionTypeProto, PositionViewProto } from '../../../fintekkers/models/position/position_pb';
|
|
7
|
+
import { PositionProto } from '../../../fintekkers/models/position/position_pb';
|
|
17
8
|
import { FieldMapEntry } from '../../../fintekkers/models/position/position_util_pb';
|
|
18
9
|
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
19
|
-
import { PositionService } from '../../services/position-service/PositionService';
|
|
20
|
-
import { PositionFilter } from './positionfilter';
|
|
21
|
-
import { QueryPositionRequestProto } from '../../../fintekkers/requests/position/query_position_request_pb';
|
|
22
|
-
import { ZonedDateTime } from '../utils/datetime';
|
|
23
10
|
import { MeasureProto } from '../../../fintekkers/models/position/measure_pb';
|
|
24
11
|
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
25
12
|
import { PortfolioProto } from '../../../fintekkers/models/portfolio/portfolio_pb';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Note: Some classes and functions have been omitted or simplified due to lack of context.
|
|
2
2
|
|
|
3
|
-
import { Any } from "@grpc/grpc-js/build/src/generated/google/protobuf/Any";
|
|
4
3
|
import { FieldProto } from "../../../fintekkers/models/position/field_pb";
|
|
5
4
|
import { PositionProto } from "../../../fintekkers/models/position/position_pb";
|
|
6
5
|
import { FieldMapEntry, MeasureMapEntry } from "../../../fintekkers/models/position/position_util_pb";
|
|
@@ -10,12 +9,9 @@ import { UUIDProto } from "../../../fintekkers/models/util/uuid_pb";
|
|
|
10
9
|
import { LocalTimestampProto } from "../../../fintekkers/models/util/local_timestamp_pb";
|
|
11
10
|
import { LocalDateProto } from "../../../fintekkers/models/util/local_date_pb";
|
|
12
11
|
import { IdentifierProto } from "../../../fintekkers/models/security/identifier/identifier_pb";
|
|
13
|
-
import { UUID } from "../utils/uuid";
|
|
14
12
|
import { MeasureProto } from "../../../fintekkers/models/position/measure_pb";
|
|
15
13
|
import Decimal from "decimal.js";
|
|
16
14
|
import { ProtoSerializationUtil } from "../utils/serialization";
|
|
17
|
-
import { SecurityProto } from "../../../fintekkers/models/security/security_pb";
|
|
18
|
-
import { PortfolioProto } from "../../../fintekkers/models/portfolio/portfolio_pb";
|
|
19
15
|
import { StringValue } from 'google-protobuf/google/protobuf/wrappers_pb';
|
|
20
16
|
|
|
21
17
|
export class Position {
|
|
@@ -23,12 +19,6 @@ export class Position {
|
|
|
23
19
|
|
|
24
20
|
constructor(positionProto: PositionProto) {
|
|
25
21
|
this.proto = positionProto;
|
|
26
|
-
|
|
27
|
-
// //For each field, put into a map
|
|
28
|
-
// this.proto.getFieldsList().forEach(field => {
|
|
29
|
-
// console.log(field);
|
|
30
|
-
// });
|
|
31
|
-
|
|
32
22
|
}
|
|
33
23
|
|
|
34
24
|
public getFieldValue(field: FieldProto): any {
|
|
@@ -39,14 +29,14 @@ export class Position {
|
|
|
39
29
|
for (const tmpField of this.proto.getFieldsList()) {
|
|
40
30
|
if (tmpField.getField() === fieldToGet.getField()) {
|
|
41
31
|
|
|
42
|
-
if (tmpField.getStringValue()) {
|
|
32
|
+
if (tmpField.getStringValue() !== undefined && tmpField.getStringValue().length > 0) {
|
|
43
33
|
return tmpField.getStringValue();
|
|
44
34
|
}
|
|
45
35
|
|
|
46
36
|
if (tmpField.getEnumValue() > 0) {
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
|
|
37
|
+
// let fieldName: string = new Field(fieldToGet.getField()).getName();
|
|
38
|
+
// let proto: ProtoEnum = ProtoEnum.fromEnumName(fieldName, tmpField.getEnumValue());
|
|
39
|
+
return tmpField.getEnumValue();//proto.enumDescriptor['EXECUTED'];
|
|
50
40
|
}
|
|
51
41
|
|
|
52
42
|
const unpackedValue = Position.unpackField(tmpField);
|
|
@@ -21,10 +21,10 @@ var LocalDate = /** @class */ (function () {
|
|
|
21
21
|
};
|
|
22
22
|
LocalDate.today = function () {
|
|
23
23
|
var today = new Date();
|
|
24
|
-
return
|
|
24
|
+
return this.from(today);
|
|
25
25
|
};
|
|
26
26
|
LocalDate.from = function (date) {
|
|
27
|
-
return new LocalDate(new local_date_pb_1.LocalDateProto().setYear(date.getFullYear()).setMonth(date.getMonth()).setDay(date.getDate()));
|
|
27
|
+
return new LocalDate(new local_date_pb_1.LocalDateProto().setYear(date.getFullYear()).setMonth(date.getMonth() + 1).setDay(date.getDate()));
|
|
28
28
|
};
|
|
29
29
|
return LocalDate;
|
|
30
30
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["date.ts"],"names":[],"mappings":";;;AACA,+EAA+E;AAC/E,iDAAyD;AAEzD;IAGE,mBAAY,KAAqB;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,0BAAM,GAAN;QACE,sEAAsE;QACtE,gFAAgF;QAChF,4EAA4E;QAC5E,OAAO,sCAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,4BAAQ,GAAR;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IACxF,CAAC;IAED,2BAAO,GAAP;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEM,eAAK,GAAZ;QACE,IAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;QACzB,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["date.ts"],"names":[],"mappings":";;;AACA,+EAA+E;AAC/E,iDAAyD;AAEzD;IAGE,mBAAY,KAAqB;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,0BAAM,GAAN;QACE,sEAAsE;QACtE,gFAAgF;QAChF,4EAA4E;QAC5E,OAAO,sCAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,4BAAQ,GAAR;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IACxF,CAAC;IAED,2BAAO,GAAP;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEM,eAAK,GAAZ;QACE,IAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAEM,cAAI,GAAX,UAAY,IAAU;QACpB,OAAO,IAAI,SAAS,CAClB,IAAI,8BAAc,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CACtG,CAAC;IACJ,CAAC;IACH,gBAAC;AAAD,CAAC,AAhCD,IAgCC;AAEQ,8BAAS"}
|
|
@@ -26,14 +26,12 @@ class LocalDate {
|
|
|
26
26
|
|
|
27
27
|
static today(): LocalDate {
|
|
28
28
|
const today = new Date();
|
|
29
|
-
return
|
|
30
|
-
new LocalDateProto().setYear(today.getFullYear()).setMonth(today.getMonth()).setDay(today.getDate())
|
|
31
|
-
);
|
|
29
|
+
return this.from(today);
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
static from(date: Date): LocalDate {
|
|
35
33
|
return new LocalDate(
|
|
36
|
-
new LocalDateProto().setYear(date.getFullYear()).setMonth(date.getMonth()).setDay(date.getDate())
|
|
34
|
+
new LocalDateProto().setYear(date.getFullYear()).setMonth(date.getMonth() + 1).setDay(date.getDate())
|
|
37
35
|
);
|
|
38
36
|
}
|
|
39
37
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProtoEnum = void 0;
|
|
4
|
+
var transaction_type_pb_1 = require("../../../fintekkers/models/transaction/transaction_type_pb");
|
|
5
|
+
var position_status_pb_1 = require("../../../fintekkers/models/position/position_status_pb");
|
|
6
|
+
var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
7
|
+
var ProtoEnum = /** @class */ (function () {
|
|
8
|
+
function ProtoEnum(enumDescriptor, enumValue) {
|
|
9
|
+
this.enumValue = enumValue;
|
|
10
|
+
this.enumDescriptor = enumDescriptor;
|
|
11
|
+
}
|
|
12
|
+
ProtoEnum.fromEnumName = function (enumName, enumValue) {
|
|
13
|
+
return new ProtoEnum(ProtoEnum.getFieldDescriptorFromName(enumName), enumValue);
|
|
14
|
+
};
|
|
15
|
+
ProtoEnum.getFieldDescriptorFromName = function (enumName) {
|
|
16
|
+
if (enumName === "TRANSACTION_TYPE") {
|
|
17
|
+
return transaction_type_pb_1.TransactionTypeProto;
|
|
18
|
+
}
|
|
19
|
+
if (enumName === "POSITION_STATUS") {
|
|
20
|
+
return position_status_pb_1.PositionStatusProto;
|
|
21
|
+
}
|
|
22
|
+
if (enumName === "FIELD") {
|
|
23
|
+
return field_pb_1.FieldProto;
|
|
24
|
+
}
|
|
25
|
+
throw new Error("Enum has not been mapped: ".concat(enumName));
|
|
26
|
+
};
|
|
27
|
+
ProtoEnum.prototype.getEnumName = function () {
|
|
28
|
+
// Assuming your enumDescriptor has a name property or similar
|
|
29
|
+
return this.enumDescriptor.name;
|
|
30
|
+
};
|
|
31
|
+
ProtoEnum.prototype.getEnumValue = function () {
|
|
32
|
+
return this.enumValue;
|
|
33
|
+
};
|
|
34
|
+
ProtoEnum.prototype.getEnumValueName = function () {
|
|
35
|
+
var _this = this;
|
|
36
|
+
// In TypeScript/JS, enum values can be accessed directly if you know the value
|
|
37
|
+
// Assuming your enums are simple objects or as generated by protobuf ts
|
|
38
|
+
var enumKey = Object.keys(this.enumDescriptor).find(function (key) { return _this.enumDescriptor[key] === _this.enumValue; });
|
|
39
|
+
if (!enumKey) {
|
|
40
|
+
return 'UNKNOWN'; // Or handle as appropriate
|
|
41
|
+
}
|
|
42
|
+
return enumKey;
|
|
43
|
+
};
|
|
44
|
+
ProtoEnum.prototype.toString = function () {
|
|
45
|
+
return this.getEnumValueName();
|
|
46
|
+
};
|
|
47
|
+
return ProtoEnum;
|
|
48
|
+
}());
|
|
49
|
+
exports.ProtoEnum = ProtoEnum;
|
|
50
|
+
//# sourceMappingURL=protoEnum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protoEnum.js","sourceRoot":"","sources":["protoEnum.ts"],"names":[],"mappings":";;;AACA,kGAAkG;AAClG,6FAA6F;AAC7F,yEAA0E;AAE1E;IAII,mBAAY,cAAmB,EAAE,SAAiB;QAC9C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;IAEM,sBAAY,GAAnB,UAAoB,QAAgB,EAAE,SAAiB;QACnD,OAAO,IAAI,SAAS,CAAC,SAAS,CAAC,0BAA0B,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IACpF,CAAC;IAEc,oCAA0B,GAAzC,UAA0C,QAAgB;QACtD,IAAI,QAAQ,KAAK,kBAAkB,EAAE,CAAC;YAClC,OAAO,0CAAoB,CAAC;QAChC,CAAC;QACD,IAAI,QAAQ,KAAK,iBAAiB,EAAE,CAAC;YACjC,OAAO,wCAAmB,CAAC;QAC/B,CAAC;QACD,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACvB,OAAO,qBAAU,CAAC;QACtB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,oCAA6B,QAAQ,CAAE,CAAC,CAAC;IAC7D,CAAC;IAED,+BAAW,GAAX;QACI,8DAA8D;QAC9D,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;IACpC,CAAC;IAED,gCAAY,GAAZ;QACI,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,oCAAgB,GAAhB;QAAA,iBAQC;QAPG,+EAA+E;QAC/E,wEAAwE;QACxE,IAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,KAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,KAAI,CAAC,SAAS,EAA3C,CAA2C,CAAC,CAAC;QAC1G,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO,SAAS,CAAC,CAAC,2BAA2B;QACjD,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,4BAAQ,GAAR;QACI,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACnC,CAAC;IACL,gBAAC;AAAD,CAAC,AAhDD,IAgDC;AAhDY,8BAAS"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ProtoEnum.test.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
var position_status_pb_1 = require("../../../fintekkers/models/position/position_status_pb");
|
|
5
|
+
var transaction_type_pb_1 = require("../../../fintekkers/models/transaction/transaction_type_pb");
|
|
6
|
+
var protoEnum_1 = require("./protoEnum");
|
|
7
|
+
describe('ProtoEnum', function () {
|
|
8
|
+
it('should correctly identify the name of the enum value for TransactionTypeProto', function () {
|
|
9
|
+
var protoEnum = new protoEnum_1.ProtoEnum(transaction_type_pb_1.TransactionTypeProto, 1);
|
|
10
|
+
expect(protoEnum.getEnumValueName()).toEqual('BUY');
|
|
11
|
+
});
|
|
12
|
+
it('should correctly return the enum value for PositionStatusProto', function () {
|
|
13
|
+
var protoEnum = new protoEnum_1.ProtoEnum(position_status_pb_1.PositionStatusProto.INTENDED, 2);
|
|
14
|
+
expect(protoEnum.getEnumValue()).toEqual(2);
|
|
15
|
+
});
|
|
16
|
+
it('should throw an error for an unmapped enum name', function () {
|
|
17
|
+
expect(function () { return protoEnum_1.ProtoEnum.fromEnumName('UNMAPPED_ENUM', 0); }).toThrow('Enum has not been mapped: UNMAPPED_ENUM');
|
|
18
|
+
});
|
|
19
|
+
// Add more tests as necessary to cover your use cases
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=protoEnum.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protoEnum.test.js","sourceRoot":"","sources":["protoEnum.test.ts"],"names":[],"mappings":";AAAA,oBAAoB;;AAEpB,6FAA6F;AAC7F,kGAAkG;AAClG,yCAAwC;AAExC,QAAQ,CAAC,WAAW,EAAE;IAClB,EAAE,CAAC,+EAA+E,EAAE;QAChF,IAAM,SAAS,GAAG,IAAI,qBAAS,CAAC,0CAAoB,EAAE,CAAC,CAAC,CAAC;QACzD,MAAM,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gEAAgE,EAAE;QACjE,IAAM,SAAS,GAAG,IAAI,qBAAS,CAAC,wCAAmB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE;QAClD,MAAM,CAAC,cAAM,OAAA,qBAAS,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC,CAAC,EAA1C,CAA0C,CAAC,CAAC,OAAO,CAAC,yCAAyC,CAAC,CAAC;IAChH,CAAC,CAAC,CAAC;IAEH,sDAAsD;AAC1D,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// ProtoEnum.test.ts
|
|
2
|
+
|
|
3
|
+
import { PositionStatusProto } from '../../../fintekkers/models/position/position_status_pb';
|
|
4
|
+
import { TransactionTypeProto } from '../../../fintekkers/models/transaction/transaction_type_pb';
|
|
5
|
+
import { ProtoEnum } from './protoEnum';
|
|
6
|
+
|
|
7
|
+
describe('ProtoEnum', () => {
|
|
8
|
+
it('should correctly identify the name of the enum value for TransactionTypeProto', () => {
|
|
9
|
+
const protoEnum = new ProtoEnum(TransactionTypeProto, 1);
|
|
10
|
+
expect(protoEnum.getEnumValueName()).toEqual('BUY');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should correctly return the enum value for PositionStatusProto', () => {
|
|
14
|
+
const protoEnum = new ProtoEnum(PositionStatusProto.INTENDED, 2);
|
|
15
|
+
expect(protoEnum.getEnumValue()).toEqual(2);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should throw an error for an unmapped enum name', () => {
|
|
19
|
+
expect(() => ProtoEnum.fromEnumName('UNMAPPED_ENUM', 0)).toThrow('Enum has not been mapped: UNMAPPED_ENUM');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Add more tests as necessary to cover your use cases
|
|
23
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
import { TransactionTypeProto } from '../../../fintekkers/models/transaction/transaction_type_pb';
|
|
3
|
+
import { PositionStatusProto } from '../../../fintekkers/models/position/position_status_pb';
|
|
4
|
+
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
5
|
+
|
|
6
|
+
export class ProtoEnum {
|
|
7
|
+
private enumValue: number;
|
|
8
|
+
private enumDescriptor: any; // Use appropriate type for enum descriptor
|
|
9
|
+
|
|
10
|
+
constructor(enumDescriptor: any, enumValue: number) {
|
|
11
|
+
this.enumValue = enumValue;
|
|
12
|
+
this.enumDescriptor = enumDescriptor;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static fromEnumName(enumName: string, enumValue: number): ProtoEnum {
|
|
16
|
+
return new ProtoEnum(ProtoEnum.getFieldDescriptorFromName(enumName), enumValue);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private static getFieldDescriptorFromName(enumName: string): any {
|
|
20
|
+
if (enumName === "TRANSACTION_TYPE") {
|
|
21
|
+
return TransactionTypeProto;
|
|
22
|
+
}
|
|
23
|
+
if (enumName === "POSITION_STATUS") {
|
|
24
|
+
return PositionStatusProto;
|
|
25
|
+
}
|
|
26
|
+
if (enumName === "FIELD") {
|
|
27
|
+
return FieldProto;
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`Enum has not been mapped: ${enumName}`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getEnumName(): string {
|
|
33
|
+
// Assuming your enumDescriptor has a name property or similar
|
|
34
|
+
return this.enumDescriptor.name;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
getEnumValue(): number {
|
|
38
|
+
return this.enumValue;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getEnumValueName(): string {
|
|
42
|
+
// In TypeScript/JS, enum values can be accessed directly if you know the value
|
|
43
|
+
// Assuming your enums are simple objects or as generated by protobuf ts
|
|
44
|
+
const enumKey = Object.keys(this.enumDescriptor).find(key => this.enumDescriptor[key] === this.enumValue);
|
|
45
|
+
if (!enumKey) {
|
|
46
|
+
return 'UNKNOWN'; // Or handle as appropriate
|
|
47
|
+
}
|
|
48
|
+
return enumKey;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
toString(): string {
|
|
52
|
+
return this.getEnumValueName();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -7,6 +7,7 @@ var local_timestamp_pb_1 = require("../../../fintekkers/models/util/local_timest
|
|
|
7
7
|
var uuid_pb_1 = require("../../../fintekkers/models/util/uuid_pb");
|
|
8
8
|
var datetime_1 = require("./datetime");
|
|
9
9
|
var uuid_1 = require("./uuid");
|
|
10
|
+
var wrappers_pb_1 = require("google-protobuf/google/protobuf/wrappers_pb");
|
|
10
11
|
var ProtoSerializationUtil = /** @class */ (function () {
|
|
11
12
|
function ProtoSerializationUtil() {
|
|
12
13
|
}
|
|
@@ -17,7 +18,7 @@ var ProtoSerializationUtil = /** @class */ (function () {
|
|
|
17
18
|
if (obj instanceof Date) {
|
|
18
19
|
return new local_date_pb_1.LocalDateProto()
|
|
19
20
|
.setYear(obj.getFullYear())
|
|
20
|
-
.setMonth(obj.getMonth())
|
|
21
|
+
.setMonth(obj.getMonth() + 1)
|
|
21
22
|
.setDay(obj.getDate());
|
|
22
23
|
}
|
|
23
24
|
if (obj instanceof datetime_1.ZonedDateTime) {
|
|
@@ -26,6 +27,9 @@ var ProtoSerializationUtil = /** @class */ (function () {
|
|
|
26
27
|
if (typeof obj === "number") {
|
|
27
28
|
return new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue(obj.toString());
|
|
28
29
|
}
|
|
30
|
+
if (obj instanceof String) {
|
|
31
|
+
return wrappers_pb_1.StringValue.of(obj);
|
|
32
|
+
}
|
|
29
33
|
throw new Error("Could not serialize object of type ".concat(typeof obj, ". Value: ").concat(obj));
|
|
30
34
|
};
|
|
31
35
|
ProtoSerializationUtil.deserialize = function (obj) {
|
|
@@ -33,7 +37,7 @@ var ProtoSerializationUtil = /** @class */ (function () {
|
|
|
33
37
|
return uuid_1.UUID.fromU8Array(obj.getRawUuid_asU8());
|
|
34
38
|
}
|
|
35
39
|
if (obj instanceof local_date_pb_1.LocalDateProto) {
|
|
36
|
-
var date = new Date(obj.getYear(), obj.getMonth(), obj.getDay());
|
|
40
|
+
var date = new Date(obj.getYear(), obj.getMonth() - 1, obj.getDay());
|
|
37
41
|
date.setHours(0, 0, 0, 0);
|
|
38
42
|
return date;
|
|
39
43
|
}
|
|
@@ -46,6 +50,9 @@ var ProtoSerializationUtil = /** @class */ (function () {
|
|
|
46
50
|
if (obj instanceof decimal_value_pb_1.DecimalValueProto) {
|
|
47
51
|
return parseFloat(obj.getArbitraryPrecisionValue());
|
|
48
52
|
}
|
|
53
|
+
if (obj instanceof wrappers_pb_1.StringValue) {
|
|
54
|
+
return obj.toString();
|
|
55
|
+
}
|
|
49
56
|
throw new Error("Could not deserialize object of type ".concat(typeof obj, ". Value: ").concat(obj));
|
|
50
57
|
};
|
|
51
58
|
return ProtoSerializationUtil;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.js","sourceRoot":"","sources":["serialization.ts"],"names":[],"mappings":";;;AAAA,qFAAqF;AACrF,+EAA+E;AAC/E,yFAAyF;AACzF,mEAAoE;AACpE,uCAA2C;AAC3C,+BAA8B;
|
|
1
|
+
{"version":3,"file":"serialization.js","sourceRoot":"","sources":["serialization.ts"],"names":[],"mappings":";;;AAAA,qFAAqF;AACrF,+EAA+E;AAC/E,yFAAyF;AACzF,mEAAoE;AACpE,uCAA2C;AAC3C,+BAA8B;AAC9B,2EAA0E;AAO1E;IAAA;IAgDA,CAAC;IA/CQ,gCAAS,GAAhB,UAAiB,GAAQ;QACvB,IAAI,GAAG,YAAY,WAAI,EAAE,CAAC;YACxB,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC;QAC3B,CAAC;QACD,IAAI,GAAG,YAAY,IAAI,EAAE,CAAC;YACxB,OAAO,IAAI,8BAAc,EAAE;iBACxB,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;iBAC1B,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;iBAC5B,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3B,CAAC;QACD,IAAI,GAAG,YAAY,wBAAa,EAAE,CAAC;YACjC,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC;QACvB,CAAC;QACD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC5B,OAAO,IAAI,oCAAiB,EAAE,CAAC,0BAA0B,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC5E,CAAC;QACD,IAAI,GAAG,YAAY,MAAM,EAAE,CAAC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,wDAAsB"}
|
|
@@ -4,6 +4,7 @@ import { LocalTimestampProto } from "../../../fintekkers/models/util/local_times
|
|
|
4
4
|
import { UUIDProto } from "../../../fintekkers/models/util/uuid_pb";
|
|
5
5
|
import { ZonedDateTime } from "./datetime";
|
|
6
6
|
import { UUID } from "./uuid";
|
|
7
|
+
import { StringValue } from 'google-protobuf/google/protobuf/wrappers_pb';
|
|
7
8
|
|
|
8
9
|
interface EnumValueDescriptor {
|
|
9
10
|
name: string;
|
|
@@ -18,7 +19,7 @@ export class ProtoSerializationUtil {
|
|
|
18
19
|
if (obj instanceof Date) {
|
|
19
20
|
return new LocalDateProto()
|
|
20
21
|
.setYear(obj.getFullYear())
|
|
21
|
-
.setMonth(obj.getMonth())
|
|
22
|
+
.setMonth(obj.getMonth() + 1)
|
|
22
23
|
.setDay(obj.getDate());
|
|
23
24
|
}
|
|
24
25
|
if (obj instanceof ZonedDateTime) {
|
|
@@ -27,6 +28,9 @@ export class ProtoSerializationUtil {
|
|
|
27
28
|
if (typeof obj === "number") {
|
|
28
29
|
return new DecimalValueProto().setArbitraryPrecisionValue(obj.toString());
|
|
29
30
|
}
|
|
31
|
+
if (obj instanceof String) {
|
|
32
|
+
return StringValue.of(obj);
|
|
33
|
+
}
|
|
30
34
|
|
|
31
35
|
throw new Error(`Could not serialize object of type ${typeof obj}. Value: ${obj}`);
|
|
32
36
|
}
|
|
@@ -36,7 +40,7 @@ export class ProtoSerializationUtil {
|
|
|
36
40
|
return UUID.fromU8Array(obj.getRawUuid_asU8());
|
|
37
41
|
}
|
|
38
42
|
if (obj instanceof LocalDateProto) {
|
|
39
|
-
const date = new Date(obj.getYear(), obj.getMonth(), obj.getDay());
|
|
43
|
+
const date = new Date(obj.getYear(), obj.getMonth() - 1, obj.getDay());
|
|
40
44
|
date.setHours(0, 0, 0, 0);
|
|
41
45
|
return date;
|
|
42
46
|
}
|
|
@@ -49,6 +53,9 @@ export class ProtoSerializationUtil {
|
|
|
49
53
|
if (obj instanceof DecimalValueProto) {
|
|
50
54
|
return parseFloat(obj.getArbitraryPrecisionValue());
|
|
51
55
|
}
|
|
56
|
+
if (obj instanceof StringValue) {
|
|
57
|
+
return obj.toString();
|
|
58
|
+
}
|
|
52
59
|
|
|
53
60
|
throw new Error(`Could not deserialize object of type ${typeof obj}. Value: ${obj}`);
|
|
54
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portfolio.test.js","sourceRoot":"","sources":["portfolio.test.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAET,cAAc;AACd,yEAA0E;AAC1E,8CAAgD;AAChD,gDAAkD;AAElD,qBAAqB;AACrB,uDAAsD;AACtD,kFAAmF;AAEnF,uEAAsE;AAGtE,IAAI,CAAC,4EAA4E,EAAE;;;;;gBAC3E,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;gBAC5C,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;gBAE7B,gBAAgB,GAAG,IAAI,mCAAgB,EAAE,CAAC;gBAE1C,SAAS,GAAG,IAAI,6BAAc,EAAE,CAAC;gBACvC,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;gBACtC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC9B,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAC5B,SAAS,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;gBAC7C,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBAET,qBAAM,gBAAgB,CAAC,uBAAuB,CAAC,SAAS,CAAC,EAAA;;gBAA7E,iBAAiB,GAAG,SAAyD;gBACjF,MAAM,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBA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CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBAET,qBAAM,gBAAgB,CAAC,uBAAuB,CAAC,SAAS,CAAC,EAAA;;gBAA7E,iBAAiB,GAAG,SAAyD;gBACjF,MAAM,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAEG,qBAAM,gBAAgB,CAAC,eAAe,CAAC,SAAS,CAAC,EAAA;;gBAAzG,uBAAuB,GAAiC,SAAiD;gBAC7G,MAAM,CAAC,uBAAuB,CAAC,wBAAwB,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAEtD,qBAAM,gBAAgB,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,+BAAc,EAAE,CAAC,eAAe,CAAC,qBAAU,CAAC,cAAc,EAAE,+BAA+B,CAAC,CAAC,EAAA;;gBAAvK,aAAa,GAAG,SAAuJ;gBAC3K,MAAM,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;;KAC7C,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -33,5 +33,4 @@ test('test creating a portfolio against the api.fintekkers.org portfolio service
|
|
|
33
33
|
|
|
34
34
|
var searchResults = await portfolioService.searchPortfolio(now.toProto(), new PositionFilter().addEqualsFilter(FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings'));
|
|
35
35
|
expect(searchResults.length > 0).toBe(true);
|
|
36
|
-
console.log(searchResults[0].getPortfolioName());
|
|
37
36
|
}, 30000);
|
|
@@ -38,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.PositionService = void 0;
|
|
40
40
|
// Models
|
|
41
|
-
var
|
|
41
|
+
var position_1 = require("../../models/position/position");
|
|
42
42
|
// Requests & Services
|
|
43
43
|
var position_service_grpc_pb_1 = require("../../../fintekkers/services/position-service/position_service_grpc_pb");
|
|
44
44
|
//Utils
|
|
@@ -57,7 +57,7 @@ var PositionService = /** @class */ (function () {
|
|
|
57
57
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
58
58
|
stream2.on('data', function (response) {
|
|
59
59
|
response.getPositionsList().forEach(function (position) {
|
|
60
|
-
listPositions.push(new
|
|
60
|
+
listPositions.push(new position_1.Position(position));
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
63
|
stream2.on('end', function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PositionService.js","sourceRoot":"","sources":["PositionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT
|
|
1
|
+
{"version":3,"file":"PositionService.js","sourceRoot":"","sources":["PositionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT,2DAA0D;AAM1D,sBAAsB;AACtB,mHAAwG;AAExG,OAAO;AACP,oEAA0D;AAE1D;IAGE;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,yCAAc,CAAC,wBAAS,CAAC,MAAM,EAAE,wBAAS,CAAC,cAAc,CAAC,CAAC;IAC/E,CAAC;IAEK,gCAAM,GAAZ,UAAa,OAAkC;;YAI7C,SAAe,0BAA0B;;;;wBACjC,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;wBAE1C,sBAAO,IAAI,OAAO,CAAa,UAAC,OAAO,EAAE,MAAM;gCAC7C,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,QAAoC;oCACtD,QAAQ,CAAC,gBAAgB,EAAE,CAAC,OAAO,CAAC,UAAC,QAAQ;wCAC3C,aAAa,CAAC,IAAI,CAAC,IAAI,mBAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;oCAC7C,CAAC,CAAC,CAAC;gCACL,CAAC,CAAC,CAAC;gCAEH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;oCAChB,OAAO,CAAC,aAAa,CAAC,CAAC;gCACzB,CAAC,CAAC,CAAC;gCAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,GAAG;oCACtB,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;oCAC3C,MAAM,CAAC,GAAG,CAAC,CAAC;gCACd,CAAC,CAAC,CAAC;4BACL,CAAC,CAAC,EAAC;;;aACJ;;;;;wBAtBK,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC;wBACxB,aAAa,GAAe,EAAE,CAAC;wBAuB9B,qBAAM,0BAA0B,EAAE,EAAA;4BAAzC,sBAAO,SAAkC,EAAC;;;;KAC3C;IACH,sBAAC;AAAD,CAAC,AAlCD,IAkCC;AAEQ,0CAAe"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Models
|
|
3
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -37,76 +36,30 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
36
|
}
|
|
38
37
|
};
|
|
39
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
|
|
39
|
+
// Models
|
|
41
40
|
var position_pb_1 = require("../../../fintekkers/models/position/position_pb");
|
|
42
41
|
var measure_pb_1 = require("../../../fintekkers/models/position/measure_pb");
|
|
43
|
-
var position_filter_pb_1 = require("../../../fintekkers/models/position/position_filter_pb");
|
|
44
42
|
// Model Utils
|
|
45
43
|
var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
46
|
-
var position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
|
|
47
44
|
var datetime_1 = require("../../models/utils/datetime");
|
|
48
|
-
var serialization_util_1 = require("../../models/utils/serialization.util");
|
|
49
|
-
var any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
|
|
50
45
|
//Requests & Services
|
|
51
46
|
var PositionService_1 = require("../../services/position-service/PositionService");
|
|
52
47
|
var query_position_request_pb_1 = require("../../../fintekkers/requests/position/query_position_request_pb");
|
|
53
48
|
test('test getting a position against the api.fintekkers.org position service', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
+
var isTrue;
|
|
54
50
|
return __generator(this, function (_a) {
|
|
55
|
-
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0: return [4 /*yield*/, testPosition()];
|
|
53
|
+
case 1:
|
|
54
|
+
isTrue = _a.sent();
|
|
55
|
+
expect(isTrue).toBe(true);
|
|
56
|
+
return [2 /*return*/];
|
|
57
|
+
}
|
|
56
58
|
});
|
|
57
59
|
}); }, 30000);
|
|
58
|
-
function get_position(security, portfolio, measures, position_type, fields, additional_filters, as_of) {
|
|
59
|
-
if (fields === void 0) { fields = [field_pb_1.FieldProto.PORTFOLIO, field_pb_1.FieldProto.SECURITY]; }
|
|
60
|
-
if (additional_filters === void 0) { additional_filters = []; }
|
|
61
|
-
if (as_of === void 0) { as_of = datetime_1.ZonedDateTime.now(); }
|
|
62
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var filters, id_proto, security_id_packed, fieldMapEntry, fieldMapEntry, filter_fields, as_of_proto, request, position_service, positions;
|
|
64
|
-
return __generator(this, function (_a) {
|
|
65
|
-
switch (_a.label) {
|
|
66
|
-
case 0:
|
|
67
|
-
filters = [];
|
|
68
|
-
if (security !== null && security !== undefined) {
|
|
69
|
-
id_proto = new identifier_pb_1.IdentifierProto();
|
|
70
|
-
id_proto.setIdentifierValue(security.getIdentifier().getIdentifierValue());
|
|
71
|
-
id_proto.setIdentifierType(security.getIdentifier().getIdentifierType());
|
|
72
|
-
security_id_packed = new any_pb_1.Any();
|
|
73
|
-
security_id_packed.pack(id_proto);
|
|
74
|
-
fieldMapEntry = new position_util_pb_1.FieldMapEntry();
|
|
75
|
-
fieldMapEntry.setField(field_pb_1.FieldProto.IDENTIFIER);
|
|
76
|
-
fieldMapEntry.setFieldValuePacked(security_id_packed);
|
|
77
|
-
filters.push(fieldMapEntry);
|
|
78
|
-
}
|
|
79
|
-
if (portfolio !== null && portfolio !== undefined) {
|
|
80
|
-
fieldMapEntry = new position_util_pb_1.FieldMapEntry();
|
|
81
|
-
fieldMapEntry.setField(field_pb_1.FieldProto.PORTFOLIO_NAME);
|
|
82
|
-
fieldMapEntry.setFieldValuePacked((0, serialization_util_1.pack)(portfolio.getPortfolioName()));
|
|
83
|
-
filters.push(fieldMapEntry);
|
|
84
|
-
}
|
|
85
|
-
if (additional_filters !== null && additional_filters.length > 0) {
|
|
86
|
-
filters.push.apply(filters, additional_filters);
|
|
87
|
-
}
|
|
88
|
-
filter_fields = new position_filter_pb_1.PositionFilterProto();
|
|
89
|
-
filter_fields.setFiltersList(filters);
|
|
90
|
-
as_of_proto = as_of.toProto();
|
|
91
|
-
request = new query_position_request_pb_1.QueryPositionRequestProto();
|
|
92
|
-
request.setPositionType(position_type);
|
|
93
|
-
request.setPositionView(position_pb_1.PositionViewProto.DEFAULT_VIEW);
|
|
94
|
-
request.setFieldsList(fields);
|
|
95
|
-
request.setMeasuresList(measures);
|
|
96
|
-
request.setFilterFields(filter_fields);
|
|
97
|
-
request.setAsOf(as_of_proto);
|
|
98
|
-
position_service = new PositionService_1.PositionService();
|
|
99
|
-
return [4 /*yield*/, position_service.search(request)];
|
|
100
|
-
case 1:
|
|
101
|
-
positions = _a.sent();
|
|
102
|
-
return [2 /*return*/, positions];
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
60
|
function testPosition() {
|
|
108
61
|
return __awaiter(this, void 0, void 0, function () {
|
|
109
|
-
var fields, measures, request, positions,
|
|
62
|
+
var fields, measures, request, positions, position_1;
|
|
110
63
|
return __generator(this, function (_a) {
|
|
111
64
|
switch (_a.label) {
|
|
112
65
|
case 0:
|
|
@@ -121,16 +74,18 @@ function testPosition() {
|
|
|
121
74
|
return [4 /*yield*/, new PositionService_1.PositionService().search(request)];
|
|
122
75
|
case 1:
|
|
123
76
|
positions = _a.sent();
|
|
124
|
-
if (positions) {
|
|
77
|
+
if (positions && positions.length > 0) {
|
|
125
78
|
console.log(positions.length + " positions returned");
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
79
|
+
position_1 = positions[0];
|
|
80
|
+
fields.forEach(function (field) {
|
|
81
|
+
position_1.getFieldValue(field);
|
|
82
|
+
});
|
|
83
|
+
return [2 /*return*/, true];
|
|
129
84
|
}
|
|
130
85
|
else {
|
|
131
|
-
|
|
86
|
+
return [2 /*return*/, false];
|
|
132
87
|
}
|
|
133
|
-
return [2 /*return
|
|
88
|
+
return [2 /*return*/];
|
|
134
89
|
}
|
|
135
90
|
});
|
|
136
91
|
});
|
|
@@ -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,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G;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;;;;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,IAA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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;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
|