@decafhub/decaf-client-extras 0.0.1
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/.editorconfig +9 -0
- package/.env.example +4 -0
- package/.eslintignore +3 -0
- package/.eslintrc.js +23 -0
- package/.github/workflows/release-please.yml +47 -0
- package/.github/workflows/test.yml +29 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.release-please-manifest.json +3 -0
- package/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +10 -0
- package/commons/-currency.d.ts +42 -0
- package/commons/-currency.js +50 -0
- package/commons/-date-type.d.ts +11 -0
- package/commons/-date-type.js +10 -0
- package/commons/-id.d.ts +58 -0
- package/commons/-id.js +2 -0
- package/commons/index.d.ts +3 -0
- package/commons/index.js +19 -0
- package/es/commons/-currency.d.ts +42 -0
- package/es/commons/-currency.js +44 -0
- package/es/commons/-date-type.d.ts +11 -0
- package/es/commons/-date-type.js +7 -0
- package/es/commons/-id.d.ts +58 -0
- package/es/commons/-id.js +1 -0
- package/es/commons/index.d.ts +3 -0
- package/es/commons/index.js +3 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +3 -0
- package/es/reports/index.d.ts +1 -0
- package/es/reports/index.js +1 -0
- package/es/reports/valuation/-remote-valuation-report-consolidated.d.ts +69 -0
- package/es/reports/valuation/-remote-valuation-report-consolidated.js +56 -0
- package/es/reports/valuation/-remote-valuation-report-portfolio.d.ts +150 -0
- package/es/reports/valuation/-remote-valuation-report-portfolio.js +134 -0
- package/es/reports/valuation/-remote-valuation-report-shared.d.ts +233 -0
- package/es/reports/valuation/-remote-valuation-report-shared.js +127 -0
- package/es/reports/valuation/-valuation-report-consolidated.d.ts +35 -0
- package/es/reports/valuation/-valuation-report-consolidated.js +1 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/-machinery.d.ts +10 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/-machinery.js +116 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/-types.d.ts +23 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/-types.js +1 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/-utils.d.ts +1 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/-utils.js +12 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/index.d.ts +2 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/index.js +2 -0
- package/es/reports/valuation/-valuation-report-portfolio.d.ts +79 -0
- package/es/reports/valuation/-valuation-report-portfolio.js +1 -0
- package/es/reports/valuation/-valuation-report-shared.d.ts +189 -0
- package/es/reports/valuation/-valuation-report-shared.js +6 -0
- package/es/reports/valuation/index.d.ts +8 -0
- package/es/reports/valuation/index.js +6 -0
- package/index.d.ts +3 -0
- package/index.js +32 -0
- package/jest.config.js +6 -0
- package/package.json +79 -0
- package/postinstall.sh +16 -0
- package/release-please-config.json +9 -0
- package/reports/index.d.ts +1 -0
- package/reports/index.js +27 -0
- package/reports/valuation/-remote-valuation-report-consolidated.d.ts +69 -0
- package/reports/valuation/-remote-valuation-report-consolidated.js +113 -0
- package/reports/valuation/-remote-valuation-report-portfolio.d.ts +150 -0
- package/reports/valuation/-remote-valuation-report-portfolio.js +191 -0
- package/reports/valuation/-remote-valuation-report-shared.d.ts +233 -0
- package/reports/valuation/-remote-valuation-report-shared.js +145 -0
- package/reports/valuation/-valuation-report-consolidated.d.ts +35 -0
- package/reports/valuation/-valuation-report-consolidated.js +2 -0
- package/reports/valuation/-valuation-report-holdings-tree/-machinery.d.ts +10 -0
- package/reports/valuation/-valuation-report-holdings-tree/-machinery.js +189 -0
- package/reports/valuation/-valuation-report-holdings-tree/-types.d.ts +23 -0
- package/reports/valuation/-valuation-report-holdings-tree/-types.js +2 -0
- package/reports/valuation/-valuation-report-holdings-tree/-utils.d.ts +1 -0
- package/reports/valuation/-valuation-report-holdings-tree/-utils.js +16 -0
- package/reports/valuation/-valuation-report-holdings-tree/index.d.ts +2 -0
- package/reports/valuation/-valuation-report-holdings-tree/index.js +20 -0
- package/reports/valuation/-valuation-report-portfolio.d.ts +79 -0
- package/reports/valuation/-valuation-report-portfolio.js +2 -0
- package/reports/valuation/-valuation-report-shared.d.ts +189 -0
- package/reports/valuation/-valuation-report-shared.js +11 -0
- package/reports/valuation/index.d.ts +8 -0
- package/reports/valuation/index.js +25 -0
- package/shell.nix +21 -0
- package/src/commons/-currency.ts +55 -0
- package/src/commons/-date-type.ts +12 -0
- package/src/commons/-id.ts +72 -0
- package/src/commons/index.ts +3 -0
- package/src/index.test.ts +67 -0
- package/src/index.ts +3 -0
- package/src/reports/index.ts +1 -0
- package/src/reports/valuation/-remote-valuation-report-consolidated.ts +121 -0
- package/src/reports/valuation/-remote-valuation-report-portfolio.ts +294 -0
- package/src/reports/valuation/-remote-valuation-report-shared.ts +313 -0
- package/src/reports/valuation/-valuation-report-consolidated.ts +46 -0
- package/src/reports/valuation/-valuation-report-holdings-tree/-machinery.ts +171 -0
- package/src/reports/valuation/-valuation-report-holdings-tree/-types.ts +25 -0
- package/src/reports/valuation/-valuation-report-holdings-tree/-utils.ts +15 -0
- package/src/reports/valuation/-valuation-report-holdings-tree/index.ts +2 -0
- package/src/reports/valuation/-valuation-report-portfolio.ts +92 -0
- package/src/reports/valuation/-valuation-report-shared.ts +217 -0
- package/src/reports/valuation/index.ts +8 -0
- package/tsconfig.es.json +13 -0
- package/tsconfig.json +36 -0
- package/typedoc.json +8 -0
package/reports/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.valuation = void 0;
|
|
27
|
+
exports.valuation = __importStar(require("./valuation"));
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { DecafClient } from '@decafhub/decaf-client';
|
|
2
|
+
import { CustomError, Either, SDate } from '@telostat/prelude';
|
|
3
|
+
import { CurrencyCode, DateType } from '../../commons';
|
|
4
|
+
import { RemoteBaseValuationReport } from './-remote-valuation-report-shared';
|
|
5
|
+
import { ConsolidatedValuationReport, ConsolidatedValuationReportContainer, ConsolidatedValuationReportContainerType } from './-valuation-report-consolidated';
|
|
6
|
+
/**
|
|
7
|
+
* Remote consolidated valuation report query type.
|
|
8
|
+
*/
|
|
9
|
+
export interface ConsolidatedValuationReportQuery {
|
|
10
|
+
/**
|
|
11
|
+
* Date of valuation report.
|
|
12
|
+
*/
|
|
13
|
+
date: SDate;
|
|
14
|
+
/**
|
|
15
|
+
* Date type of the valuation report.
|
|
16
|
+
*/
|
|
17
|
+
dateType: DateType;
|
|
18
|
+
/**
|
|
19
|
+
* Reference currency of the valuation report.
|
|
20
|
+
*/
|
|
21
|
+
currency: CurrencyCode;
|
|
22
|
+
/**
|
|
23
|
+
* Indication if we want to include/exclude sandbox portfolios (defaults to `true`).
|
|
24
|
+
*/
|
|
25
|
+
sandbox?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Container type.
|
|
28
|
+
*/
|
|
29
|
+
containerType: ConsolidatedValuationReportContainerType;
|
|
30
|
+
/**
|
|
31
|
+
* Container elements (identifiers).
|
|
32
|
+
*/
|
|
33
|
+
containerElements: (number | string)[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Type definition for the remote (raw) consolidated valuation report data.
|
|
37
|
+
*/
|
|
38
|
+
export interface RemoteConsolidatedValuationReport extends RemoteBaseValuationReport {
|
|
39
|
+
containers: {
|
|
40
|
+
level: ConsolidatedValuationReportContainerType;
|
|
41
|
+
containers: ConsolidatedValuationReportContainer[];
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Attempts to retrieve remote consolidated valuation report.
|
|
46
|
+
*
|
|
47
|
+
* @param client DECAF Barista client.
|
|
48
|
+
* @param query Remote consolidated valuation report endpoint query parameters.
|
|
49
|
+
* @returns Remote (raw) consolidated valuation report data.
|
|
50
|
+
*/
|
|
51
|
+
export declare function fetchRemoteConsolidatedValuationReport(client: DecafClient, query: ConsolidatedValuationReportQuery): Promise<Either<CustomError, RemoteConsolidatedValuationReport>>;
|
|
52
|
+
/**
|
|
53
|
+
* Attempts to re-compile the raw, remote consolidated valuation report and
|
|
54
|
+
* return it.
|
|
55
|
+
*
|
|
56
|
+
* @param x Raw, remote consolidated valuation report.
|
|
57
|
+
* @returns Either of an error message or the re-compiled consolidated valuation
|
|
58
|
+
* report.
|
|
59
|
+
*/
|
|
60
|
+
export declare function recompileConsolidatedValuationReport(x: RemoteConsolidatedValuationReport): Either<CustomError, ConsolidatedValuationReport>;
|
|
61
|
+
/**
|
|
62
|
+
* Attempts to retrieve remote consolidated valuation report, compiles it to
|
|
63
|
+
* [[ConsolidatedValuationReport]] and return it.
|
|
64
|
+
*
|
|
65
|
+
* @param client DECAF Barista client.
|
|
66
|
+
* @param query Remote consolidated valuation report endpoint query parameters.
|
|
67
|
+
* @returns Recompiled consolidated valuation report data.
|
|
68
|
+
*/
|
|
69
|
+
export declare function fetchConsolidatedValuationReport(client: DecafClient, query: ConsolidatedValuationReportQuery): Promise<Either<CustomError, ConsolidatedValuationReport>>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.fetchConsolidatedValuationReport = exports.recompileConsolidatedValuationReport = exports.fetchRemoteConsolidatedValuationReport = void 0;
|
|
51
|
+
var prelude_1 = require("@telostat/prelude");
|
|
52
|
+
var _remote_valuation_report_shared_1 = require("./-remote-valuation-report-shared");
|
|
53
|
+
/**
|
|
54
|
+
* Attempts to retrieve remote consolidated valuation report.
|
|
55
|
+
*
|
|
56
|
+
* @param client DECAF Barista client.
|
|
57
|
+
* @param query Remote consolidated valuation report endpoint query parameters.
|
|
58
|
+
* @returns Remote (raw) consolidated valuation report data.
|
|
59
|
+
*/
|
|
60
|
+
function fetchRemoteConsolidatedValuationReport(client, query) {
|
|
61
|
+
return client.barista
|
|
62
|
+
.get('/consolidation/', {
|
|
63
|
+
params: {
|
|
64
|
+
ccy: query.currency,
|
|
65
|
+
date: query.date,
|
|
66
|
+
type: query.dateType,
|
|
67
|
+
sandbox: query.sandbox,
|
|
68
|
+
c: query.containerType,
|
|
69
|
+
i: query.containerElements,
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
.then(function (x) { return (0, prelude_1.Right)(x.data); })
|
|
73
|
+
.catch(function (err) { return (0, prelude_1.Left)((0, prelude_1.customError)('Error while attempting to fetch remote consolidated valuation report', err)); });
|
|
74
|
+
}
|
|
75
|
+
exports.fetchRemoteConsolidatedValuationReport = fetchRemoteConsolidatedValuationReport;
|
|
76
|
+
/**
|
|
77
|
+
* Attempts to re-compile the raw, remote consolidated valuation report and
|
|
78
|
+
* return it.
|
|
79
|
+
*
|
|
80
|
+
* @param x Raw, remote consolidated valuation report.
|
|
81
|
+
* @returns Either of an error message or the re-compiled consolidated valuation
|
|
82
|
+
* report.
|
|
83
|
+
*/
|
|
84
|
+
function recompileConsolidatedValuationReport(x) {
|
|
85
|
+
// Attempt to get the base valuation report:
|
|
86
|
+
var baseReport = (0, _remote_valuation_report_shared_1.recompileBaseValuationReport)(x);
|
|
87
|
+
// Add consolidated valuation report specific fields and return:
|
|
88
|
+
return baseReport.map(function (report) { return (__assign(__assign({}, report), { containerType: x.containers.level, containers: x.containers.containers })); });
|
|
89
|
+
}
|
|
90
|
+
exports.recompileConsolidatedValuationReport = recompileConsolidatedValuationReport;
|
|
91
|
+
/**
|
|
92
|
+
* Attempts to retrieve remote consolidated valuation report, compiles it to
|
|
93
|
+
* [[ConsolidatedValuationReport]] and return it.
|
|
94
|
+
*
|
|
95
|
+
* @param client DECAF Barista client.
|
|
96
|
+
* @param query Remote consolidated valuation report endpoint query parameters.
|
|
97
|
+
* @returns Recompiled consolidated valuation report data.
|
|
98
|
+
*/
|
|
99
|
+
function fetchConsolidatedValuationReport(client, query) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
+
var rawReport;
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
switch (_a.label) {
|
|
104
|
+
case 0: return [4 /*yield*/, fetchRemoteConsolidatedValuationReport(client, query)];
|
|
105
|
+
case 1:
|
|
106
|
+
rawReport = _a.sent();
|
|
107
|
+
// Attempt to recompile the report (if any) and return:
|
|
108
|
+
return [2 /*return*/, rawReport.chain(recompileConsolidatedValuationReport)];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
exports.fetchConsolidatedValuationReport = fetchConsolidatedValuationReport;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { DecafClient } from '@decafhub/decaf-client';
|
|
2
|
+
import { CustomError, Either, SDate, SDateTime } from '@telostat/prelude';
|
|
3
|
+
import { ActionId, CurrencyCode, DateType, ExternalValuationId, OhlcSeriesId, PortfolioId, PrincipalId, ShareClassFeeScheduleId, ShareClassId } from '../../commons';
|
|
4
|
+
import { RemoteBaseValuationReport } from './-remote-valuation-report-shared';
|
|
5
|
+
import { PortfolioValuationReport, PortfolioValuationReportShareClassValue } from './-valuation-report-portfolio';
|
|
6
|
+
import { ValuationReportPortfolio } from './-valuation-report-shared';
|
|
7
|
+
/**
|
|
8
|
+
* Remote portfolio valuation report query type.
|
|
9
|
+
*/
|
|
10
|
+
export interface PortfolioValuationReportQuery {
|
|
11
|
+
/**
|
|
12
|
+
* Date of valuation report.
|
|
13
|
+
*/
|
|
14
|
+
date: SDate;
|
|
15
|
+
/**
|
|
16
|
+
* Date type of the valuation report.
|
|
17
|
+
*/
|
|
18
|
+
dateType: DateType;
|
|
19
|
+
/**
|
|
20
|
+
* Reference currency of the valuation report.
|
|
21
|
+
*/
|
|
22
|
+
currency: CurrencyCode;
|
|
23
|
+
/**
|
|
24
|
+
* Portfolio the valuation report is requested for.
|
|
25
|
+
*/
|
|
26
|
+
portfolio: PortfolioId;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Type definition for the remote (raw) portfolio valuation report data.
|
|
30
|
+
*/
|
|
31
|
+
export interface RemotePortfolioValuationReport extends RemoteBaseValuationReport {
|
|
32
|
+
portfolio: ValuationReportPortfolio;
|
|
33
|
+
scvals: RemoteValuationShareClassValue[];
|
|
34
|
+
subscriptions?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Type definition for share class valuation on the remote portfolio valuation
|
|
38
|
+
* report.
|
|
39
|
+
*/
|
|
40
|
+
export interface RemoteValuationShareClassValue {
|
|
41
|
+
shareclass: RemoteValuationShareClass;
|
|
42
|
+
external?: RemoteValuationExternalValue;
|
|
43
|
+
nav: number;
|
|
44
|
+
nav_adjusted: number;
|
|
45
|
+
nav_adjusted_total: number;
|
|
46
|
+
coefficient: number;
|
|
47
|
+
gav_refccy: number;
|
|
48
|
+
gav_clsccy: number;
|
|
49
|
+
sharecount_prev: number;
|
|
50
|
+
sharecount_curr: number;
|
|
51
|
+
sharecount_diff: number;
|
|
52
|
+
px_refccy: number;
|
|
53
|
+
px_clsccy: number;
|
|
54
|
+
ytdext?: number;
|
|
55
|
+
ytdint?: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Type definition for share class on the remote portfolio valuation report.
|
|
59
|
+
*/
|
|
60
|
+
export interface RemoteValuationShareClass {
|
|
61
|
+
id: ShareClassId;
|
|
62
|
+
created: SDateTime;
|
|
63
|
+
creator: PrincipalId;
|
|
64
|
+
updated: SDateTime;
|
|
65
|
+
updater: PrincipalId;
|
|
66
|
+
guid: string;
|
|
67
|
+
portfolio: PortfolioId;
|
|
68
|
+
name: string;
|
|
69
|
+
currency: CurrencyCode;
|
|
70
|
+
isin?: string;
|
|
71
|
+
bbgticker?: string;
|
|
72
|
+
liquidity?: string;
|
|
73
|
+
jurisdiction?: string;
|
|
74
|
+
administrator?: string;
|
|
75
|
+
mininvestment?: string;
|
|
76
|
+
subredperiod?: string;
|
|
77
|
+
freqmngt?: number;
|
|
78
|
+
freqperf?: number;
|
|
79
|
+
benchmark?: OhlcSeriesId;
|
|
80
|
+
description?: string;
|
|
81
|
+
feeschedules: ShareClassFeeScheduleId[];
|
|
82
|
+
effectivefeeschedule?: ShareClassFeeScheduleId;
|
|
83
|
+
subscriptions: ActionId[];
|
|
84
|
+
outstanding?: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Type definition for external valuation on the remote portfolio valuation
|
|
88
|
+
* report.
|
|
89
|
+
*/
|
|
90
|
+
export interface RemoteValuationExternalValue {
|
|
91
|
+
id: ExternalValuationId;
|
|
92
|
+
created: SDateTime;
|
|
93
|
+
creator: PrincipalId;
|
|
94
|
+
updated: SDateTime;
|
|
95
|
+
updater: PrincipalId;
|
|
96
|
+
guid: string;
|
|
97
|
+
portfolio: PortfolioId;
|
|
98
|
+
shareclass?: ShareClassId;
|
|
99
|
+
date: SDate;
|
|
100
|
+
ccy: CurrencyCode;
|
|
101
|
+
shares?: number;
|
|
102
|
+
price?: number;
|
|
103
|
+
nav?: number;
|
|
104
|
+
aum?: number;
|
|
105
|
+
hedgepnl?: number;
|
|
106
|
+
feemngt?: number;
|
|
107
|
+
feeperf?: number;
|
|
108
|
+
otheraccrued?: number;
|
|
109
|
+
totalaccrued?: number;
|
|
110
|
+
subred?: number;
|
|
111
|
+
perfdaily?: number;
|
|
112
|
+
perfweekly?: number;
|
|
113
|
+
perfmonthly?: number;
|
|
114
|
+
perfytd?: number;
|
|
115
|
+
perfstart?: number;
|
|
116
|
+
coefficient?: number;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Attempts to retrieve remote portfolio valuation report.
|
|
120
|
+
*
|
|
121
|
+
* @param client DECAF Barista client.
|
|
122
|
+
* @param query Remote portfolio valuation report endpoint query parameters.
|
|
123
|
+
* @returns Remote (raw) portfolio valuation report data.
|
|
124
|
+
*/
|
|
125
|
+
export declare function fetchRemotePortfolioValuationReport(client: DecafClient, query: PortfolioValuationReportQuery): Promise<Either<CustomError, RemotePortfolioValuationReport>>;
|
|
126
|
+
/**
|
|
127
|
+
* Attempts to recompile remote valuation report share class value.
|
|
128
|
+
*
|
|
129
|
+
* @param x remote valuation report share class value object.
|
|
130
|
+
* @return Recompiled valuation report share class value object.
|
|
131
|
+
*/
|
|
132
|
+
export declare function toShareClassValue(x: RemoteValuationShareClassValue): PortfolioValuationReportShareClassValue;
|
|
133
|
+
/**
|
|
134
|
+
* Attempts to re-compile the raw, remote portfolio valuation report and
|
|
135
|
+
* return it.
|
|
136
|
+
*
|
|
137
|
+
* @param x Raw, remote portfolio valuation report.
|
|
138
|
+
* @returns Either of an error message or the re-compiled portfolio valuation
|
|
139
|
+
* report.
|
|
140
|
+
*/
|
|
141
|
+
export declare function recompilePortfolioValuationReport(x: RemotePortfolioValuationReport): Either<CustomError, PortfolioValuationReport>;
|
|
142
|
+
/**
|
|
143
|
+
* Attempts to retrieve remote portfolio valuation report, compiles it to
|
|
144
|
+
* [[PortfolioValuationReport]] and return it.
|
|
145
|
+
*
|
|
146
|
+
* @param client DECAF Barista client.
|
|
147
|
+
* @param query Remote portolio valuation report endpoint query parameters.
|
|
148
|
+
* @returns Recompiled portolio valuation report data.
|
|
149
|
+
*/
|
|
150
|
+
export declare function fetchPortfolioValuationReport(client: DecafClient, query: PortfolioValuationReportQuery): Promise<Either<CustomError, PortfolioValuationReport>>;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.fetchPortfolioValuationReport = exports.recompilePortfolioValuationReport = exports.toShareClassValue = exports.fetchRemotePortfolioValuationReport = void 0;
|
|
51
|
+
var prelude_1 = require("@telostat/prelude");
|
|
52
|
+
var _remote_valuation_report_shared_1 = require("./-remote-valuation-report-shared");
|
|
53
|
+
/**
|
|
54
|
+
* Attempts to retrieve remote portfolio valuation report.
|
|
55
|
+
*
|
|
56
|
+
* @param client DECAF Barista client.
|
|
57
|
+
* @param query Remote portfolio valuation report endpoint query parameters.
|
|
58
|
+
* @returns Remote (raw) portfolio valuation report data.
|
|
59
|
+
*/
|
|
60
|
+
function fetchRemotePortfolioValuationReport(client, query) {
|
|
61
|
+
return client.barista
|
|
62
|
+
.get('/portfolioreport/', {
|
|
63
|
+
params: {
|
|
64
|
+
ccy: query.currency,
|
|
65
|
+
date: query.date,
|
|
66
|
+
type: query.dateType,
|
|
67
|
+
portfolio: "".concat(query.portfolio),
|
|
68
|
+
},
|
|
69
|
+
})
|
|
70
|
+
.then(function (x) { return (0, prelude_1.Right)(x.data); })
|
|
71
|
+
.catch(function (err) { return (0, prelude_1.Left)((0, prelude_1.customError)('Error while attempting to fetch remote portfolio valuation report', err)); });
|
|
72
|
+
}
|
|
73
|
+
exports.fetchRemotePortfolioValuationReport = fetchRemotePortfolioValuationReport;
|
|
74
|
+
/**
|
|
75
|
+
* Attempts to recompile remote valuation report share class value.
|
|
76
|
+
*
|
|
77
|
+
* @param x remote valuation report share class value object.
|
|
78
|
+
* @return Recompiled valuation report share class value object.
|
|
79
|
+
*/
|
|
80
|
+
function toShareClassValue(x) {
|
|
81
|
+
return {
|
|
82
|
+
shareclass: {
|
|
83
|
+
id: x.shareclass.id,
|
|
84
|
+
created: x.shareclass.created,
|
|
85
|
+
creator: prelude_1.Maybe.fromNullable(x.shareclass.creator),
|
|
86
|
+
updated: x.shareclass.updated,
|
|
87
|
+
updater: prelude_1.Maybe.fromNullable(x.shareclass.updater),
|
|
88
|
+
guid: x.shareclass.guid,
|
|
89
|
+
portfolio: x.shareclass.portfolio,
|
|
90
|
+
name: x.shareclass.name,
|
|
91
|
+
currency: x.shareclass.currency,
|
|
92
|
+
isin: (0, prelude_1.sanitizedNonEmptyText)(x.shareclass.isin),
|
|
93
|
+
bbgticker: (0, prelude_1.sanitizedNonEmptyText)(x.shareclass.bbgticker),
|
|
94
|
+
liquidity: (0, prelude_1.sanitizedNonEmptyText)(x.shareclass.liquidity),
|
|
95
|
+
jurisdiction: (0, prelude_1.sanitizedNonEmptyText)(x.shareclass.jurisdiction),
|
|
96
|
+
administrator: (0, prelude_1.sanitizedNonEmptyText)(x.shareclass.administrator),
|
|
97
|
+
minimumInvestment: (0, prelude_1.sanitizedNonEmptyText)(x.shareclass.mininvestment),
|
|
98
|
+
subscriptionRedemptionPeriod: (0, prelude_1.sanitizedNonEmptyText)(x.shareclass.subredperiod),
|
|
99
|
+
managementFeeFrequency: prelude_1.Maybe.fromNullable(x.shareclass.freqmngt),
|
|
100
|
+
performanceFeeFrequency: prelude_1.Maybe.fromNullable(x.shareclass.freqperf),
|
|
101
|
+
benchmark: prelude_1.Maybe.fromNullable(x.shareclass.benchmark),
|
|
102
|
+
description: (0, prelude_1.sanitizedNonEmptyText)(x.shareclass.description),
|
|
103
|
+
feeScheduleIds: x.shareclass.feeschedules,
|
|
104
|
+
effectiveFeeScheduleId: prelude_1.Maybe.fromNullable(x.shareclass.effectivefeeschedule),
|
|
105
|
+
subscriptionIds: x.shareclass.subscriptions,
|
|
106
|
+
outstanding: (0, prelude_1.maybeDecimal)(x.shareclass.outstanding),
|
|
107
|
+
},
|
|
108
|
+
external: prelude_1.Maybe.fromNullable(x.external).map(function (ev) { return ({
|
|
109
|
+
id: ev.id,
|
|
110
|
+
created: ev.created,
|
|
111
|
+
creator: prelude_1.Maybe.fromNullable(ev.updater),
|
|
112
|
+
updated: ev.updated,
|
|
113
|
+
updater: prelude_1.Maybe.fromNullable(ev.updater),
|
|
114
|
+
guid: ev.guid,
|
|
115
|
+
portfolio: ev.portfolio,
|
|
116
|
+
shareclass: prelude_1.Maybe.fromNullable(ev.shareclass),
|
|
117
|
+
date: ev.date,
|
|
118
|
+
ccy: ev.ccy,
|
|
119
|
+
shares: (0, prelude_1.maybeDecimal)(ev.shares),
|
|
120
|
+
price: (0, prelude_1.maybeDecimal)(ev.price),
|
|
121
|
+
nav: (0, prelude_1.maybeDecimal)(ev.nav),
|
|
122
|
+
aum: (0, prelude_1.maybeDecimal)(ev.aum),
|
|
123
|
+
hedgepnl: (0, prelude_1.maybeDecimal)(ev.hedgepnl),
|
|
124
|
+
feemngt: (0, prelude_1.maybeDecimal)(ev.feemngt),
|
|
125
|
+
feeperf: (0, prelude_1.maybeDecimal)(ev.feeperf),
|
|
126
|
+
otheraccrued: (0, prelude_1.maybeDecimal)(ev.otheraccrued),
|
|
127
|
+
totalaccrued: (0, prelude_1.maybeDecimal)(ev.totalaccrued),
|
|
128
|
+
subred: (0, prelude_1.maybeDecimal)(ev.subred),
|
|
129
|
+
perfdaily: (0, prelude_1.maybeDecimal)(ev.perfdaily),
|
|
130
|
+
perfweekly: (0, prelude_1.maybeDecimal)(ev.perfweekly),
|
|
131
|
+
perfmonthly: (0, prelude_1.maybeDecimal)(ev.perfmonthly),
|
|
132
|
+
perfytd: (0, prelude_1.maybeDecimal)(ev.perfytd),
|
|
133
|
+
perfstart: (0, prelude_1.maybeDecimal)(ev.perfstart),
|
|
134
|
+
coefficient: (0, prelude_1.maybeDecimal)(ev.coefficient),
|
|
135
|
+
}); }),
|
|
136
|
+
nav: (0, prelude_1.asDecimal)(x.nav),
|
|
137
|
+
navAdjusted: (0, prelude_1.asDecimal)(x.nav_adjusted),
|
|
138
|
+
navAdjustedTotal: (0, prelude_1.asDecimal)(x.nav_adjusted_total),
|
|
139
|
+
coefficient: (0, prelude_1.asDecimal)(x.coefficient),
|
|
140
|
+
gavRefccy: (0, prelude_1.asDecimal)(x.gav_refccy),
|
|
141
|
+
gavClsccy: (0, prelude_1.asDecimal)(x.gav_clsccy),
|
|
142
|
+
sharecountPrev: (0, prelude_1.asDecimal)(x.sharecount_prev),
|
|
143
|
+
sharecountCurr: (0, prelude_1.asDecimal)(x.sharecount_curr),
|
|
144
|
+
sharecountDiff: (0, prelude_1.asDecimal)(x.sharecount_diff),
|
|
145
|
+
pxRefCcy: (0, prelude_1.asDecimal)(x.px_refccy),
|
|
146
|
+
pxClsCcy: (0, prelude_1.asDecimal)(x.px_clsccy),
|
|
147
|
+
ytdExt: (0, prelude_1.maybeDecimal)(x.ytdext),
|
|
148
|
+
ytdInt: (0, prelude_1.maybeDecimal)(x.ytdint),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
exports.toShareClassValue = toShareClassValue;
|
|
152
|
+
/**
|
|
153
|
+
* Attempts to re-compile the raw, remote portfolio valuation report and
|
|
154
|
+
* return it.
|
|
155
|
+
*
|
|
156
|
+
* @param x Raw, remote portfolio valuation report.
|
|
157
|
+
* @returns Either of an error message or the re-compiled portfolio valuation
|
|
158
|
+
* report.
|
|
159
|
+
*/
|
|
160
|
+
function recompilePortfolioValuationReport(x) {
|
|
161
|
+
// Attempt to get the base valuation report:
|
|
162
|
+
var baseReport = (0, _remote_valuation_report_shared_1.recompileBaseValuationReport)(x);
|
|
163
|
+
// Add consolidated valuation report specific fields and return:
|
|
164
|
+
return baseReport.map(function (report) {
|
|
165
|
+
return __assign(__assign({}, report), { portfolio: x.portfolio, subscriptions: (0, prelude_1.maybeDecimal)(x.subscriptions).orDefault(prelude_1.zero), shareClassValues: x.scvals.map(toShareClassValue) });
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
exports.recompilePortfolioValuationReport = recompilePortfolioValuationReport;
|
|
169
|
+
/**
|
|
170
|
+
* Attempts to retrieve remote portfolio valuation report, compiles it to
|
|
171
|
+
* [[PortfolioValuationReport]] and return it.
|
|
172
|
+
*
|
|
173
|
+
* @param client DECAF Barista client.
|
|
174
|
+
* @param query Remote portolio valuation report endpoint query parameters.
|
|
175
|
+
* @returns Recompiled portolio valuation report data.
|
|
176
|
+
*/
|
|
177
|
+
function fetchPortfolioValuationReport(client, query) {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
179
|
+
var rawReport;
|
|
180
|
+
return __generator(this, function (_a) {
|
|
181
|
+
switch (_a.label) {
|
|
182
|
+
case 0: return [4 /*yield*/, fetchRemotePortfolioValuationReport(client, query)];
|
|
183
|
+
case 1:
|
|
184
|
+
rawReport = _a.sent();
|
|
185
|
+
// Attempt to recompile the report (if any) and return:
|
|
186
|
+
return [2 /*return*/, rawReport.chain(recompilePortfolioValuationReport)];
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
exports.fetchPortfolioValuationReport = fetchPortfolioValuationReport;
|