@decafhub/decaf-client-extras 0.2.0 → 0.4.0
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/.github/workflows/release-please.yml +3 -5
- package/.github/workflows/test.yml +3 -3
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +22 -0
- package/README.md +2 -2
- package/es/reports/valuation/-remote-valuation-report-portfolio.d.ts +2 -2
- package/es/reports/valuation/-remote-valuation-report-portfolio.js +42 -41
- package/es/reports/valuation/-valuation-report-portfolio.d.ts +4 -4
- package/package.json +26 -25
- package/reports/valuation/-remote-valuation-report-portfolio.d.ts +2 -2
- package/reports/valuation/-remote-valuation-report-portfolio.js +42 -41
- package/reports/valuation/-valuation-report-portfolio.d.ts +4 -4
- package/src/index.test.ts +4 -3
- package/src/reports/valuation/-remote-valuation-report-portfolio.ts +44 -42
- package/src/reports/valuation/-valuation-report-portfolio.ts +4 -4
|
@@ -8,15 +8,13 @@ jobs:
|
|
|
8
8
|
release-please:
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
steps:
|
|
11
|
-
- uses: google-github-actions/release-please-action@
|
|
11
|
+
- uses: google-github-actions/release-please-action@v4
|
|
12
12
|
id: release
|
|
13
|
-
with:
|
|
14
|
-
command: manifest
|
|
15
13
|
|
|
16
|
-
- uses: actions/checkout@
|
|
14
|
+
- uses: actions/checkout@v4
|
|
17
15
|
if: ${{ steps.release.outputs.release_created }}
|
|
18
16
|
|
|
19
|
-
- uses: actions/setup-node@
|
|
17
|
+
- uses: actions/setup-node@v4
|
|
20
18
|
with:
|
|
21
19
|
node-version: 'lts/*'
|
|
22
20
|
registry-url: 'https://registry.npmjs.org'
|
|
@@ -12,12 +12,12 @@ jobs:
|
|
|
12
12
|
runs-on: ${{ matrix.os }}
|
|
13
13
|
strategy:
|
|
14
14
|
matrix:
|
|
15
|
-
node: [
|
|
15
|
+
node: [18, 20, 21]
|
|
16
16
|
os: [ubuntu-latest]
|
|
17
17
|
steps:
|
|
18
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
19
|
|
|
20
|
-
- uses: actions/setup-node@
|
|
20
|
+
- uses: actions/setup-node@v4
|
|
21
21
|
with:
|
|
22
22
|
node-version: ${{ matrix.node }}
|
|
23
23
|
registry-url: 'https://registry.npmjs.org'
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.0](https://github.com/teloscube/decaf-client-javascript-extras/compare/v0.3.0...v0.4.0) (2024-03-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* fix various type issues due to DECAF Barista v2 release
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* fix various type issues due to DECAF Barista v2 release ([f15d9ac](https://github.com/teloscube/decaf-client-javascript-extras/commit/f15d9ac523b4911abd7fc9705803fd85e0e0acb5))
|
|
13
|
+
|
|
14
|
+
## [0.3.0](https://github.com/teloscube/decaf-client-javascript-extras/compare/v0.2.0...v0.3.0) (2023-12-05)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### ⚠ BREAKING CHANGES
|
|
18
|
+
|
|
19
|
+
* drop support for Node 16
|
|
20
|
+
|
|
21
|
+
### Miscellaneous Chores
|
|
22
|
+
|
|
23
|
+
* drop support for Node 16 ([4ba8384](https://github.com/teloscube/decaf-client-javascript-extras/commit/4ba8384aabf4f48fc7f9ce6ea85c6326057c749d))
|
|
24
|
+
|
|
3
25
|
## [0.2.0](https://github.com/teloscube/decaf-client-javascript-extras/compare/v0.1.1...v0.2.0) (2023-05-19)
|
|
4
26
|
|
|
5
27
|
|
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
-
Install
|
|
9
|
+
Install `@decafhub/decaf-client-extras` along with its peer dependencies:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install --save @decafhub/decaf-client
|
|
12
|
+
npm install --save dayjs @decafhub/decaf-client @decafhub/decaf-client-extras
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Testing
|
|
@@ -38,7 +38,7 @@ export interface RemotePortfolioValuationReport extends RemoteBaseValuationRepor
|
|
|
38
38
|
* report.
|
|
39
39
|
*/
|
|
40
40
|
export interface RemoteValuationShareClassValue {
|
|
41
|
-
shareclass
|
|
41
|
+
shareclass?: RemoteValuationShareClass;
|
|
42
42
|
external?: RemoteValuationExternalValue;
|
|
43
43
|
nav: number;
|
|
44
44
|
nav_adjusted: number;
|
|
@@ -129,7 +129,7 @@ export declare function fetchRemotePortfolioValuationReport(client: DecafClient,
|
|
|
129
129
|
* @param x remote valuation report share class value object.
|
|
130
130
|
* @return Recompiled valuation report share class value object.
|
|
131
131
|
*/
|
|
132
|
-
export declare function toShareClassValue(
|
|
132
|
+
export declare function toShareClassValue(s: RemoteValuationShareClassValue): PortfolioValuationReportShareClassValue;
|
|
133
133
|
/**
|
|
134
134
|
* Attempts to re-compile the raw, remote portfolio valuation report and
|
|
135
135
|
* return it.
|
|
@@ -26,35 +26,36 @@ export function fetchRemotePortfolioValuationReport(client, query) {
|
|
|
26
26
|
* @param x remote valuation report share class value object.
|
|
27
27
|
* @return Recompiled valuation report share class value object.
|
|
28
28
|
*/
|
|
29
|
-
export function toShareClassValue(
|
|
29
|
+
export function toShareClassValue(s) {
|
|
30
|
+
const shareclass = Maybe.fromNullable(s.shareclass).map((x) => ({
|
|
31
|
+
id: x.id,
|
|
32
|
+
created: x.created,
|
|
33
|
+
creator: Maybe.fromNullable(x.creator),
|
|
34
|
+
updated: x.updated,
|
|
35
|
+
updater: Maybe.fromNullable(x.updater),
|
|
36
|
+
guid: x.guid,
|
|
37
|
+
portfolio: x.portfolio,
|
|
38
|
+
name: x.name,
|
|
39
|
+
currency: x.currency,
|
|
40
|
+
isin: sanitizedNonEmptyText(x.isin),
|
|
41
|
+
bbgticker: sanitizedNonEmptyText(x.bbgticker),
|
|
42
|
+
liquidity: sanitizedNonEmptyText(x.liquidity),
|
|
43
|
+
jurisdiction: sanitizedNonEmptyText(x.jurisdiction),
|
|
44
|
+
administrator: sanitizedNonEmptyText(x.administrator),
|
|
45
|
+
minimumInvestment: Maybe.fromNullable(x.mininvestment),
|
|
46
|
+
subscriptionRedemptionPeriod: sanitizedNonEmptyText(x.subredperiod),
|
|
47
|
+
managementFeeFrequency: Maybe.fromNullable(x.freqmngt),
|
|
48
|
+
performanceFeeFrequency: Maybe.fromNullable(x.freqperf),
|
|
49
|
+
benchmark: Maybe.fromNullable(x.benchmark),
|
|
50
|
+
description: sanitizedNonEmptyText(x.description),
|
|
51
|
+
feeScheduleIds: x.feeschedules,
|
|
52
|
+
effectiveFeeScheduleId: Maybe.fromNullable(x.effectivefeeschedule),
|
|
53
|
+
subscriptionIds: x.subscriptions,
|
|
54
|
+
outstanding: decimalFromNullable(x.outstanding),
|
|
55
|
+
}));
|
|
30
56
|
return {
|
|
31
|
-
shareclass
|
|
32
|
-
|
|
33
|
-
created: x.shareclass.created,
|
|
34
|
-
creator: Maybe.fromNullable(x.shareclass.creator),
|
|
35
|
-
updated: x.shareclass.updated,
|
|
36
|
-
updater: Maybe.fromNullable(x.shareclass.updater),
|
|
37
|
-
guid: x.shareclass.guid,
|
|
38
|
-
portfolio: x.shareclass.portfolio,
|
|
39
|
-
name: x.shareclass.name,
|
|
40
|
-
currency: x.shareclass.currency,
|
|
41
|
-
isin: sanitizedNonEmptyText(x.shareclass.isin),
|
|
42
|
-
bbgticker: sanitizedNonEmptyText(x.shareclass.bbgticker),
|
|
43
|
-
liquidity: sanitizedNonEmptyText(x.shareclass.liquidity),
|
|
44
|
-
jurisdiction: sanitizedNonEmptyText(x.shareclass.jurisdiction),
|
|
45
|
-
administrator: sanitizedNonEmptyText(x.shareclass.administrator),
|
|
46
|
-
minimumInvestment: Maybe.fromNullable(x.shareclass.mininvestment),
|
|
47
|
-
subscriptionRedemptionPeriod: sanitizedNonEmptyText(x.shareclass.subredperiod),
|
|
48
|
-
managementFeeFrequency: Maybe.fromNullable(x.shareclass.freqmngt),
|
|
49
|
-
performanceFeeFrequency: Maybe.fromNullable(x.shareclass.freqperf),
|
|
50
|
-
benchmark: Maybe.fromNullable(x.shareclass.benchmark),
|
|
51
|
-
description: sanitizedNonEmptyText(x.shareclass.description),
|
|
52
|
-
feeScheduleIds: x.shareclass.feeschedules,
|
|
53
|
-
effectiveFeeScheduleId: Maybe.fromNullable(x.shareclass.effectivefeeschedule),
|
|
54
|
-
subscriptionIds: x.shareclass.subscriptions,
|
|
55
|
-
outstanding: decimalFromNullable(x.shareclass.outstanding),
|
|
56
|
-
},
|
|
57
|
-
external: Maybe.fromNullable(x.external).map((ev) => ({
|
|
57
|
+
shareclass,
|
|
58
|
+
external: Maybe.fromNullable(s.external).map((ev) => ({
|
|
58
59
|
id: ev.id,
|
|
59
60
|
created: ev.created,
|
|
60
61
|
creator: Maybe.fromNullable(ev.updater),
|
|
@@ -82,19 +83,19 @@ export function toShareClassValue(x) {
|
|
|
82
83
|
perfstart: decimalFromNullable(ev.perfstart),
|
|
83
84
|
coefficient: decimalFromNullable(ev.coefficient),
|
|
84
85
|
})),
|
|
85
|
-
nav: unsafeDecimal(
|
|
86
|
-
navAdjusted: unsafeDecimal(
|
|
87
|
-
navAdjustedTotal: unsafeDecimal(
|
|
88
|
-
coefficient: unsafeDecimal(
|
|
89
|
-
gavRefccy: unsafeDecimal(
|
|
90
|
-
gavClsccy: unsafeDecimal(
|
|
91
|
-
sharecountPrev:
|
|
92
|
-
sharecountCurr:
|
|
93
|
-
sharecountDiff:
|
|
94
|
-
pxRefCcy: decimalFromNullable(
|
|
95
|
-
pxClsCcy: decimalFromNullable(
|
|
96
|
-
ytdExt: decimalFromNullable(
|
|
97
|
-
ytdInt: decimalFromNullable(
|
|
86
|
+
nav: unsafeDecimal(s.nav),
|
|
87
|
+
navAdjusted: unsafeDecimal(s.nav_adjusted),
|
|
88
|
+
navAdjustedTotal: unsafeDecimal(s.nav_adjusted_total),
|
|
89
|
+
coefficient: unsafeDecimal(s.coefficient),
|
|
90
|
+
gavRefccy: unsafeDecimal(s.gav_refccy),
|
|
91
|
+
gavClsccy: unsafeDecimal(s.gav_clsccy),
|
|
92
|
+
sharecountPrev: Maybe.fromNullable(s.sharecount_prev).map(unsafeDecimal),
|
|
93
|
+
sharecountCurr: Maybe.fromNullable(s.sharecount_curr).map(unsafeDecimal),
|
|
94
|
+
sharecountDiff: Maybe.fromNullable(s.sharecount_diff).map(unsafeDecimal),
|
|
95
|
+
pxRefCcy: decimalFromNullable(s.px_refccy),
|
|
96
|
+
pxClsCcy: decimalFromNullable(s.px_clsccy),
|
|
97
|
+
ytdExt: decimalFromNullable(s.ytdext),
|
|
98
|
+
ytdInt: decimalFromNullable(s.ytdint),
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
101
|
/**
|
|
@@ -7,7 +7,7 @@ export interface PortfolioValuationReport extends BaseValuationReport {
|
|
|
7
7
|
shareClassValues: PortfolioValuationReportShareClassValue[];
|
|
8
8
|
}
|
|
9
9
|
export interface PortfolioValuationReportShareClassValue {
|
|
10
|
-
shareclass: PortfolioValuationReportShareClass
|
|
10
|
+
shareclass: Maybe<PortfolioValuationReportShareClass>;
|
|
11
11
|
external: Maybe<PortfolioValuationReportExternalValue>;
|
|
12
12
|
nav: Decimal;
|
|
13
13
|
navAdjusted: Decimal;
|
|
@@ -15,9 +15,9 @@ export interface PortfolioValuationReportShareClassValue {
|
|
|
15
15
|
coefficient: Decimal;
|
|
16
16
|
gavRefccy: Decimal;
|
|
17
17
|
gavClsccy: Decimal;
|
|
18
|
-
sharecountPrev: Decimal
|
|
19
|
-
sharecountCurr: Decimal
|
|
20
|
-
sharecountDiff: Decimal
|
|
18
|
+
sharecountPrev: Maybe<Decimal>;
|
|
19
|
+
sharecountCurr: Maybe<Decimal>;
|
|
20
|
+
sharecountDiff: Maybe<Decimal>;
|
|
21
21
|
pxRefCcy: Maybe<Decimal>;
|
|
22
22
|
pxClsCcy: Maybe<Decimal>;
|
|
23
23
|
ytdExt: Maybe<Decimal>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decafhub/decaf-client-extras",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "DECAF Client Extras",
|
|
5
5
|
"author": "Teloscube Pte Ltd",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,39 +23,40 @@
|
|
|
23
23
|
"prepare": "npm run build && ./postinstall.sh"
|
|
24
24
|
},
|
|
25
25
|
"engines": {
|
|
26
|
-
"node": ">=
|
|
26
|
+
"node": ">=18"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@decafhub/decaf-client": "^0.
|
|
29
|
+
"@decafhub/decaf-client": "^0.5"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@telostat/prelude": "^0.
|
|
32
|
+
"@telostat/prelude": "^0.5.0",
|
|
33
|
+
"dayjs": "^1.11.10"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@commitlint/cli": "^
|
|
36
|
-
"@commitlint/config-conventional": "^
|
|
37
|
-
"@decafhub/decaf-client": "^0.
|
|
38
|
-
"@types/jest": "^29.5.
|
|
39
|
-
"@types/node": "^20.
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
41
|
-
"@typescript-eslint/parser": "^
|
|
42
|
-
"dotenv": "^16.
|
|
43
|
-
"eslint": "^8.
|
|
44
|
-
"eslint-config-prettier": "^
|
|
45
|
-
"eslint-config-standard": "^17.
|
|
46
|
-
"eslint-plugin-import": "^2.
|
|
47
|
-
"eslint-plugin-n": "^
|
|
48
|
-
"eslint-plugin-prettier": "^
|
|
36
|
+
"@commitlint/cli": "^18.4.3",
|
|
37
|
+
"@commitlint/config-conventional": "^18.4.3",
|
|
38
|
+
"@decafhub/decaf-client": "^0.5.0",
|
|
39
|
+
"@types/jest": "^29.5.10",
|
|
40
|
+
"@types/node": "^20.10.3",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^6.13.2",
|
|
42
|
+
"@typescript-eslint/parser": "^6.13.2",
|
|
43
|
+
"dotenv": "^16.3.1",
|
|
44
|
+
"eslint": "^8.55.0",
|
|
45
|
+
"eslint-config-prettier": "^9.1.0",
|
|
46
|
+
"eslint-config-standard": "^17.1.0",
|
|
47
|
+
"eslint-plugin-import": "^2.29.0",
|
|
48
|
+
"eslint-plugin-n": "^16.3.1",
|
|
49
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
49
50
|
"eslint-plugin-promise": "^6.1.1",
|
|
50
51
|
"eslint-plugin-standard": "^5.0.0",
|
|
51
|
-
"gh-pages": "^
|
|
52
|
+
"gh-pages": "^6.1.0",
|
|
52
53
|
"husky": "^8.0.3",
|
|
53
|
-
"jest": "^29.
|
|
54
|
-
"lint-staged": "^
|
|
55
|
-
"prettier": "^
|
|
56
|
-
"ts-jest": "^29.1.
|
|
57
|
-
"typedoc": "^0.
|
|
58
|
-
"typescript": "^5.
|
|
54
|
+
"jest": "^29.7.0",
|
|
55
|
+
"lint-staged": "^15.2.0",
|
|
56
|
+
"prettier": "^3.1.0",
|
|
57
|
+
"ts-jest": "^29.1.1",
|
|
58
|
+
"typedoc": "^0.25.4",
|
|
59
|
+
"typescript": "^5.3.2"
|
|
59
60
|
},
|
|
60
61
|
"lint-staged": {
|
|
61
62
|
"src/**/*.{ts,tsx}": [
|
|
@@ -38,7 +38,7 @@ export interface RemotePortfolioValuationReport extends RemoteBaseValuationRepor
|
|
|
38
38
|
* report.
|
|
39
39
|
*/
|
|
40
40
|
export interface RemoteValuationShareClassValue {
|
|
41
|
-
shareclass
|
|
41
|
+
shareclass?: RemoteValuationShareClass;
|
|
42
42
|
external?: RemoteValuationExternalValue;
|
|
43
43
|
nav: number;
|
|
44
44
|
nav_adjusted: number;
|
|
@@ -129,7 +129,7 @@ export declare function fetchRemotePortfolioValuationReport(client: DecafClient,
|
|
|
129
129
|
* @param x remote valuation report share class value object.
|
|
130
130
|
* @return Recompiled valuation report share class value object.
|
|
131
131
|
*/
|
|
132
|
-
export declare function toShareClassValue(
|
|
132
|
+
export declare function toShareClassValue(s: RemoteValuationShareClassValue): PortfolioValuationReportShareClassValue;
|
|
133
133
|
/**
|
|
134
134
|
* Attempts to re-compile the raw, remote portfolio valuation report and
|
|
135
135
|
* return it.
|
|
@@ -77,35 +77,36 @@ exports.fetchRemotePortfolioValuationReport = fetchRemotePortfolioValuationRepor
|
|
|
77
77
|
* @param x remote valuation report share class value object.
|
|
78
78
|
* @return Recompiled valuation report share class value object.
|
|
79
79
|
*/
|
|
80
|
-
function toShareClassValue(
|
|
80
|
+
function toShareClassValue(s) {
|
|
81
|
+
var shareclass = prelude_1.Maybe.fromNullable(s.shareclass).map(function (x) { return ({
|
|
82
|
+
id: x.id,
|
|
83
|
+
created: x.created,
|
|
84
|
+
creator: prelude_1.Maybe.fromNullable(x.creator),
|
|
85
|
+
updated: x.updated,
|
|
86
|
+
updater: prelude_1.Maybe.fromNullable(x.updater),
|
|
87
|
+
guid: x.guid,
|
|
88
|
+
portfolio: x.portfolio,
|
|
89
|
+
name: x.name,
|
|
90
|
+
currency: x.currency,
|
|
91
|
+
isin: (0, prelude_1.sanitizedNonEmptyText)(x.isin),
|
|
92
|
+
bbgticker: (0, prelude_1.sanitizedNonEmptyText)(x.bbgticker),
|
|
93
|
+
liquidity: (0, prelude_1.sanitizedNonEmptyText)(x.liquidity),
|
|
94
|
+
jurisdiction: (0, prelude_1.sanitizedNonEmptyText)(x.jurisdiction),
|
|
95
|
+
administrator: (0, prelude_1.sanitizedNonEmptyText)(x.administrator),
|
|
96
|
+
minimumInvestment: prelude_1.Maybe.fromNullable(x.mininvestment),
|
|
97
|
+
subscriptionRedemptionPeriod: (0, prelude_1.sanitizedNonEmptyText)(x.subredperiod),
|
|
98
|
+
managementFeeFrequency: prelude_1.Maybe.fromNullable(x.freqmngt),
|
|
99
|
+
performanceFeeFrequency: prelude_1.Maybe.fromNullable(x.freqperf),
|
|
100
|
+
benchmark: prelude_1.Maybe.fromNullable(x.benchmark),
|
|
101
|
+
description: (0, prelude_1.sanitizedNonEmptyText)(x.description),
|
|
102
|
+
feeScheduleIds: x.feeschedules,
|
|
103
|
+
effectiveFeeScheduleId: prelude_1.Maybe.fromNullable(x.effectivefeeschedule),
|
|
104
|
+
subscriptionIds: x.subscriptions,
|
|
105
|
+
outstanding: (0, prelude_1.decimalFromNullable)(x.outstanding),
|
|
106
|
+
}); });
|
|
81
107
|
return {
|
|
82
|
-
shareclass:
|
|
83
|
-
|
|
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: prelude_1.Maybe.fromNullable(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.decimalFromNullable)(x.shareclass.outstanding),
|
|
107
|
-
},
|
|
108
|
-
external: prelude_1.Maybe.fromNullable(x.external).map(function (ev) { return ({
|
|
108
|
+
shareclass: shareclass,
|
|
109
|
+
external: prelude_1.Maybe.fromNullable(s.external).map(function (ev) { return ({
|
|
109
110
|
id: ev.id,
|
|
110
111
|
created: ev.created,
|
|
111
112
|
creator: prelude_1.Maybe.fromNullable(ev.updater),
|
|
@@ -133,19 +134,19 @@ function toShareClassValue(x) {
|
|
|
133
134
|
perfstart: (0, prelude_1.decimalFromNullable)(ev.perfstart),
|
|
134
135
|
coefficient: (0, prelude_1.decimalFromNullable)(ev.coefficient),
|
|
135
136
|
}); }),
|
|
136
|
-
nav: (0, prelude_1.unsafeDecimal)(
|
|
137
|
-
navAdjusted: (0, prelude_1.unsafeDecimal)(
|
|
138
|
-
navAdjustedTotal: (0, prelude_1.unsafeDecimal)(
|
|
139
|
-
coefficient: (0, prelude_1.unsafeDecimal)(
|
|
140
|
-
gavRefccy: (0, prelude_1.unsafeDecimal)(
|
|
141
|
-
gavClsccy: (0, prelude_1.unsafeDecimal)(
|
|
142
|
-
sharecountPrev:
|
|
143
|
-
sharecountCurr:
|
|
144
|
-
sharecountDiff:
|
|
145
|
-
pxRefCcy: (0, prelude_1.decimalFromNullable)(
|
|
146
|
-
pxClsCcy: (0, prelude_1.decimalFromNullable)(
|
|
147
|
-
ytdExt: (0, prelude_1.decimalFromNullable)(
|
|
148
|
-
ytdInt: (0, prelude_1.decimalFromNullable)(
|
|
137
|
+
nav: (0, prelude_1.unsafeDecimal)(s.nav),
|
|
138
|
+
navAdjusted: (0, prelude_1.unsafeDecimal)(s.nav_adjusted),
|
|
139
|
+
navAdjustedTotal: (0, prelude_1.unsafeDecimal)(s.nav_adjusted_total),
|
|
140
|
+
coefficient: (0, prelude_1.unsafeDecimal)(s.coefficient),
|
|
141
|
+
gavRefccy: (0, prelude_1.unsafeDecimal)(s.gav_refccy),
|
|
142
|
+
gavClsccy: (0, prelude_1.unsafeDecimal)(s.gav_clsccy),
|
|
143
|
+
sharecountPrev: prelude_1.Maybe.fromNullable(s.sharecount_prev).map(prelude_1.unsafeDecimal),
|
|
144
|
+
sharecountCurr: prelude_1.Maybe.fromNullable(s.sharecount_curr).map(prelude_1.unsafeDecimal),
|
|
145
|
+
sharecountDiff: prelude_1.Maybe.fromNullable(s.sharecount_diff).map(prelude_1.unsafeDecimal),
|
|
146
|
+
pxRefCcy: (0, prelude_1.decimalFromNullable)(s.px_refccy),
|
|
147
|
+
pxClsCcy: (0, prelude_1.decimalFromNullable)(s.px_clsccy),
|
|
148
|
+
ytdExt: (0, prelude_1.decimalFromNullable)(s.ytdext),
|
|
149
|
+
ytdInt: (0, prelude_1.decimalFromNullable)(s.ytdint),
|
|
149
150
|
};
|
|
150
151
|
}
|
|
151
152
|
exports.toShareClassValue = toShareClassValue;
|
|
@@ -7,7 +7,7 @@ export interface PortfolioValuationReport extends BaseValuationReport {
|
|
|
7
7
|
shareClassValues: PortfolioValuationReportShareClassValue[];
|
|
8
8
|
}
|
|
9
9
|
export interface PortfolioValuationReportShareClassValue {
|
|
10
|
-
shareclass: PortfolioValuationReportShareClass
|
|
10
|
+
shareclass: Maybe<PortfolioValuationReportShareClass>;
|
|
11
11
|
external: Maybe<PortfolioValuationReportExternalValue>;
|
|
12
12
|
nav: Decimal;
|
|
13
13
|
navAdjusted: Decimal;
|
|
@@ -15,9 +15,9 @@ export interface PortfolioValuationReportShareClassValue {
|
|
|
15
15
|
coefficient: Decimal;
|
|
16
16
|
gavRefccy: Decimal;
|
|
17
17
|
gavClsccy: Decimal;
|
|
18
|
-
sharecountPrev: Decimal
|
|
19
|
-
sharecountCurr: Decimal
|
|
20
|
-
sharecountDiff: Decimal
|
|
18
|
+
sharecountPrev: Maybe<Decimal>;
|
|
19
|
+
sharecountCurr: Maybe<Decimal>;
|
|
20
|
+
sharecountDiff: Maybe<Decimal>;
|
|
21
21
|
pxRefCcy: Maybe<Decimal>;
|
|
22
22
|
pxClsCcy: Maybe<Decimal>;
|
|
23
23
|
ytdExt: Maybe<Decimal>;
|
package/src/index.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { buildDecafClient, DecafClient, gql } from '@decafhub/decaf-client';
|
|
2
|
-
import {
|
|
2
|
+
import { safeDiv, zero } from '@telostat/prelude';
|
|
3
3
|
import { fail } from 'assert';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
4
5
|
import { DecafPortfolioId, mkCurrencyCodeError } from './commons';
|
|
5
6
|
import { makeValuationReportHoldingsTree } from './reports/valuation/';
|
|
6
7
|
import {
|
|
@@ -54,7 +55,7 @@ describe('Main', () => {
|
|
|
54
55
|
test('get a remote portfolio report successfuly', async () => {
|
|
55
56
|
const eValue = await fetchRemotePortfolioValuationReport(client, {
|
|
56
57
|
portfolio: portfolioId,
|
|
57
|
-
date:
|
|
58
|
+
date: dayjs(new Date()).format('YYYY-MM-DD'),
|
|
58
59
|
dateType: 'settlement',
|
|
59
60
|
currency: mkCurrencyCodeError('EUR'),
|
|
60
61
|
});
|
|
@@ -72,7 +73,7 @@ describe('Main', () => {
|
|
|
72
73
|
test('get a portfolio report, check the tree', async () => {
|
|
73
74
|
const eValue = await fetchPortfolioValuationReport(client, {
|
|
74
75
|
portfolio: portfolioId,
|
|
75
|
-
date:
|
|
76
|
+
date: dayjs(new Date()).format('YYYY-MM-DD'),
|
|
76
77
|
dateType: 'settlement',
|
|
77
78
|
currency: mkCurrencyCodeError('EUR'),
|
|
78
79
|
});
|
|
@@ -67,7 +67,7 @@ export interface RemotePortfolioValuationReport extends RemoteBaseValuationRepor
|
|
|
67
67
|
* report.
|
|
68
68
|
*/
|
|
69
69
|
export interface RemoteValuationShareClassValue {
|
|
70
|
-
shareclass
|
|
70
|
+
shareclass?: RemoteValuationShareClass;
|
|
71
71
|
external?: RemoteValuationExternalValue;
|
|
72
72
|
nav: number;
|
|
73
73
|
nav_adjusted: number;
|
|
@@ -177,35 +177,37 @@ export function fetchRemotePortfolioValuationReport(
|
|
|
177
177
|
* @param x remote valuation report share class value object.
|
|
178
178
|
* @return Recompiled valuation report share class value object.
|
|
179
179
|
*/
|
|
180
|
-
export function toShareClassValue(
|
|
180
|
+
export function toShareClassValue(s: RemoteValuationShareClassValue): PortfolioValuationReportShareClassValue {
|
|
181
|
+
const shareclass = Maybe.fromNullable(s.shareclass).map((x) => ({
|
|
182
|
+
id: x.id,
|
|
183
|
+
created: x.created,
|
|
184
|
+
creator: Maybe.fromNullable(x.creator),
|
|
185
|
+
updated: x.updated,
|
|
186
|
+
updater: Maybe.fromNullable(x.updater),
|
|
187
|
+
guid: x.guid,
|
|
188
|
+
portfolio: x.portfolio,
|
|
189
|
+
name: x.name,
|
|
190
|
+
currency: x.currency,
|
|
191
|
+
isin: sanitizedNonEmptyText(x.isin),
|
|
192
|
+
bbgticker: sanitizedNonEmptyText(x.bbgticker),
|
|
193
|
+
liquidity: sanitizedNonEmptyText(x.liquidity),
|
|
194
|
+
jurisdiction: sanitizedNonEmptyText(x.jurisdiction),
|
|
195
|
+
administrator: sanitizedNonEmptyText(x.administrator),
|
|
196
|
+
minimumInvestment: Maybe.fromNullable(x.mininvestment),
|
|
197
|
+
subscriptionRedemptionPeriod: sanitizedNonEmptyText(x.subredperiod),
|
|
198
|
+
managementFeeFrequency: Maybe.fromNullable(x.freqmngt),
|
|
199
|
+
performanceFeeFrequency: Maybe.fromNullable(x.freqperf),
|
|
200
|
+
benchmark: Maybe.fromNullable(x.benchmark),
|
|
201
|
+
description: sanitizedNonEmptyText(x.description),
|
|
202
|
+
feeScheduleIds: x.feeschedules,
|
|
203
|
+
effectiveFeeScheduleId: Maybe.fromNullable(x.effectivefeeschedule),
|
|
204
|
+
subscriptionIds: x.subscriptions,
|
|
205
|
+
outstanding: decimalFromNullable(x.outstanding),
|
|
206
|
+
}));
|
|
207
|
+
|
|
181
208
|
return {
|
|
182
|
-
shareclass
|
|
183
|
-
|
|
184
|
-
created: x.shareclass.created,
|
|
185
|
-
creator: Maybe.fromNullable(x.shareclass.creator),
|
|
186
|
-
updated: x.shareclass.updated,
|
|
187
|
-
updater: Maybe.fromNullable(x.shareclass.updater),
|
|
188
|
-
guid: x.shareclass.guid,
|
|
189
|
-
portfolio: x.shareclass.portfolio,
|
|
190
|
-
name: x.shareclass.name,
|
|
191
|
-
currency: x.shareclass.currency,
|
|
192
|
-
isin: sanitizedNonEmptyText(x.shareclass.isin),
|
|
193
|
-
bbgticker: sanitizedNonEmptyText(x.shareclass.bbgticker),
|
|
194
|
-
liquidity: sanitizedNonEmptyText(x.shareclass.liquidity),
|
|
195
|
-
jurisdiction: sanitizedNonEmptyText(x.shareclass.jurisdiction),
|
|
196
|
-
administrator: sanitizedNonEmptyText(x.shareclass.administrator),
|
|
197
|
-
minimumInvestment: Maybe.fromNullable(x.shareclass.mininvestment),
|
|
198
|
-
subscriptionRedemptionPeriod: sanitizedNonEmptyText(x.shareclass.subredperiod),
|
|
199
|
-
managementFeeFrequency: Maybe.fromNullable(x.shareclass.freqmngt),
|
|
200
|
-
performanceFeeFrequency: Maybe.fromNullable(x.shareclass.freqperf),
|
|
201
|
-
benchmark: Maybe.fromNullable(x.shareclass.benchmark),
|
|
202
|
-
description: sanitizedNonEmptyText(x.shareclass.description),
|
|
203
|
-
feeScheduleIds: x.shareclass.feeschedules,
|
|
204
|
-
effectiveFeeScheduleId: Maybe.fromNullable(x.shareclass.effectivefeeschedule),
|
|
205
|
-
subscriptionIds: x.shareclass.subscriptions,
|
|
206
|
-
outstanding: decimalFromNullable(x.shareclass.outstanding),
|
|
207
|
-
},
|
|
208
|
-
external: Maybe.fromNullable(x.external).map((ev) => ({
|
|
209
|
+
shareclass,
|
|
210
|
+
external: Maybe.fromNullable(s.external).map((ev) => ({
|
|
209
211
|
id: ev.id,
|
|
210
212
|
created: ev.created,
|
|
211
213
|
creator: Maybe.fromNullable(ev.updater),
|
|
@@ -233,19 +235,19 @@ export function toShareClassValue(x: RemoteValuationShareClassValue): PortfolioV
|
|
|
233
235
|
perfstart: decimalFromNullable(ev.perfstart),
|
|
234
236
|
coefficient: decimalFromNullable(ev.coefficient),
|
|
235
237
|
})),
|
|
236
|
-
nav: unsafeDecimal(
|
|
237
|
-
navAdjusted: unsafeDecimal(
|
|
238
|
-
navAdjustedTotal: unsafeDecimal(
|
|
239
|
-
coefficient: unsafeDecimal(
|
|
240
|
-
gavRefccy: unsafeDecimal(
|
|
241
|
-
gavClsccy: unsafeDecimal(
|
|
242
|
-
sharecountPrev:
|
|
243
|
-
sharecountCurr:
|
|
244
|
-
sharecountDiff:
|
|
245
|
-
pxRefCcy: decimalFromNullable(
|
|
246
|
-
pxClsCcy: decimalFromNullable(
|
|
247
|
-
ytdExt: decimalFromNullable(
|
|
248
|
-
ytdInt: decimalFromNullable(
|
|
238
|
+
nav: unsafeDecimal(s.nav),
|
|
239
|
+
navAdjusted: unsafeDecimal(s.nav_adjusted),
|
|
240
|
+
navAdjustedTotal: unsafeDecimal(s.nav_adjusted_total),
|
|
241
|
+
coefficient: unsafeDecimal(s.coefficient),
|
|
242
|
+
gavRefccy: unsafeDecimal(s.gav_refccy),
|
|
243
|
+
gavClsccy: unsafeDecimal(s.gav_clsccy),
|
|
244
|
+
sharecountPrev: Maybe.fromNullable(s.sharecount_prev).map(unsafeDecimal),
|
|
245
|
+
sharecountCurr: Maybe.fromNullable(s.sharecount_curr).map(unsafeDecimal),
|
|
246
|
+
sharecountDiff: Maybe.fromNullable(s.sharecount_diff).map(unsafeDecimal),
|
|
247
|
+
pxRefCcy: decimalFromNullable(s.px_refccy),
|
|
248
|
+
pxClsCcy: decimalFromNullable(s.px_clsccy),
|
|
249
|
+
ytdExt: decimalFromNullable(s.ytdext),
|
|
250
|
+
ytdInt: decimalFromNullable(s.ytdint),
|
|
249
251
|
};
|
|
250
252
|
}
|
|
251
253
|
|
|
@@ -18,7 +18,7 @@ export interface PortfolioValuationReport extends BaseValuationReport {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface PortfolioValuationReportShareClassValue {
|
|
21
|
-
shareclass: PortfolioValuationReportShareClass
|
|
21
|
+
shareclass: Maybe<PortfolioValuationReportShareClass>;
|
|
22
22
|
external: Maybe<PortfolioValuationReportExternalValue>;
|
|
23
23
|
nav: Decimal;
|
|
24
24
|
navAdjusted: Decimal;
|
|
@@ -26,9 +26,9 @@ export interface PortfolioValuationReportShareClassValue {
|
|
|
26
26
|
coefficient: Decimal;
|
|
27
27
|
gavRefccy: Decimal;
|
|
28
28
|
gavClsccy: Decimal;
|
|
29
|
-
sharecountPrev: Decimal
|
|
30
|
-
sharecountCurr: Decimal
|
|
31
|
-
sharecountDiff: Decimal
|
|
29
|
+
sharecountPrev: Maybe<Decimal>;
|
|
30
|
+
sharecountCurr: Maybe<Decimal>;
|
|
31
|
+
sharecountDiff: Maybe<Decimal>;
|
|
32
32
|
pxRefCcy: Maybe<Decimal>;
|
|
33
33
|
pxClsCcy: Maybe<Decimal>;
|
|
34
34
|
ytdExt: Maybe<Decimal>;
|