@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
|
@@ -0,0 +1,20 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.makeValuationReportHoldingsTree = void 0;
|
|
18
|
+
var _machinery_1 = require("./-machinery");
|
|
19
|
+
Object.defineProperty(exports, "makeValuationReportHoldingsTree", { enumerable: true, get: function () { return _machinery_1.makeValuationReportHoldingsTree; } });
|
|
20
|
+
__exportStar(require("./-types"), exports);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Decimal, Maybe, SDate, SDateTime } from '@telostat/prelude';
|
|
2
|
+
import { ActionId, CurrencyCode, ExternalValuationId, OhlcSeriesId, PortfolioId, PrincipalId, ShareClassFeeScheduleId, ShareClassId } from '../../commons';
|
|
3
|
+
import { BaseValuationReport, ValuationReportPortfolio } from './-valuation-report-shared';
|
|
4
|
+
export interface PortfolioValuationReport extends BaseValuationReport {
|
|
5
|
+
portfolio: ValuationReportPortfolio;
|
|
6
|
+
subscriptions: Decimal;
|
|
7
|
+
shareClassValues: PortfolioValuationReportShareClassValue[];
|
|
8
|
+
}
|
|
9
|
+
export interface PortfolioValuationReportShareClassValue {
|
|
10
|
+
shareclass: PortfolioValuationReportShareClass;
|
|
11
|
+
external: Maybe<PortfolioValuationReportExternalValue>;
|
|
12
|
+
nav: Decimal;
|
|
13
|
+
navAdjusted: Decimal;
|
|
14
|
+
navAdjustedTotal: Decimal;
|
|
15
|
+
coefficient: Decimal;
|
|
16
|
+
gavRefccy: Decimal;
|
|
17
|
+
gavClsccy: Decimal;
|
|
18
|
+
sharecountPrev: Decimal;
|
|
19
|
+
sharecountCurr: Decimal;
|
|
20
|
+
sharecountDiff: Decimal;
|
|
21
|
+
pxRefCcy: Decimal;
|
|
22
|
+
pxClsCcy: Decimal;
|
|
23
|
+
ytdExt: Maybe<Decimal>;
|
|
24
|
+
ytdInt: Maybe<Decimal>;
|
|
25
|
+
}
|
|
26
|
+
export interface PortfolioValuationReportShareClass {
|
|
27
|
+
id: ShareClassId;
|
|
28
|
+
created: SDateTime;
|
|
29
|
+
creator: Maybe<PrincipalId>;
|
|
30
|
+
updated: SDateTime;
|
|
31
|
+
updater: Maybe<PrincipalId>;
|
|
32
|
+
guid: string;
|
|
33
|
+
portfolio: PortfolioId;
|
|
34
|
+
name: string;
|
|
35
|
+
currency: CurrencyCode;
|
|
36
|
+
isin: Maybe<string>;
|
|
37
|
+
bbgticker: Maybe<string>;
|
|
38
|
+
liquidity: Maybe<string>;
|
|
39
|
+
jurisdiction: Maybe<string>;
|
|
40
|
+
administrator: Maybe<string>;
|
|
41
|
+
minimumInvestment: Maybe<string>;
|
|
42
|
+
subscriptionRedemptionPeriod: Maybe<string>;
|
|
43
|
+
managementFeeFrequency: Maybe<number>;
|
|
44
|
+
performanceFeeFrequency: Maybe<number>;
|
|
45
|
+
benchmark: Maybe<OhlcSeriesId>;
|
|
46
|
+
description: Maybe<string>;
|
|
47
|
+
feeScheduleIds: ShareClassFeeScheduleId[];
|
|
48
|
+
effectiveFeeScheduleId: Maybe<ShareClassFeeScheduleId>;
|
|
49
|
+
subscriptionIds: ActionId[];
|
|
50
|
+
outstanding: Maybe<Decimal>;
|
|
51
|
+
}
|
|
52
|
+
export interface PortfolioValuationReportExternalValue {
|
|
53
|
+
id: ExternalValuationId;
|
|
54
|
+
created: SDateTime;
|
|
55
|
+
creator: Maybe<PrincipalId>;
|
|
56
|
+
updated: SDateTime;
|
|
57
|
+
updater: Maybe<PrincipalId>;
|
|
58
|
+
guid: string;
|
|
59
|
+
portfolio: PortfolioId;
|
|
60
|
+
shareclass: Maybe<ShareClassId>;
|
|
61
|
+
date: SDate;
|
|
62
|
+
ccy: CurrencyCode;
|
|
63
|
+
shares: Maybe<Decimal>;
|
|
64
|
+
price: Maybe<Decimal>;
|
|
65
|
+
nav: Maybe<Decimal>;
|
|
66
|
+
aum: Maybe<Decimal>;
|
|
67
|
+
hedgepnl: Maybe<Decimal>;
|
|
68
|
+
feemngt: Maybe<Decimal>;
|
|
69
|
+
feeperf: Maybe<Decimal>;
|
|
70
|
+
otheraccrued: Maybe<Decimal>;
|
|
71
|
+
totalaccrued: Maybe<Decimal>;
|
|
72
|
+
subred: Maybe<Decimal>;
|
|
73
|
+
perfdaily: Maybe<Decimal>;
|
|
74
|
+
perfweekly: Maybe<Decimal>;
|
|
75
|
+
perfmonthly: Maybe<Decimal>;
|
|
76
|
+
perfytd: Maybe<Decimal>;
|
|
77
|
+
perfstart: Maybe<Decimal>;
|
|
78
|
+
coefficient: Maybe<Decimal>;
|
|
79
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Decimal, Maybe, SDate, SDateTime } from '@telostat/prelude';
|
|
2
|
+
import { AccountId, ArtifactId, ArtifactTypeId, CurrencyCode, DateType, PortfolioId } from '../../commons';
|
|
3
|
+
/**
|
|
4
|
+
* Type definition for base valuation report.
|
|
5
|
+
*/
|
|
6
|
+
export interface BaseValuationReport {
|
|
7
|
+
asof: SDateTime;
|
|
8
|
+
date: SDate;
|
|
9
|
+
dateType: DateType;
|
|
10
|
+
currency: CurrencyCode;
|
|
11
|
+
accounts: ValuationReportAccounts;
|
|
12
|
+
holdings: ValuationReportHolding[];
|
|
13
|
+
accruals: ValuationReportAccrual[];
|
|
14
|
+
fxRates: ValuationReportFxRate[];
|
|
15
|
+
figures: {
|
|
16
|
+
investment: Decimal;
|
|
17
|
+
valuation: {
|
|
18
|
+
net: Decimal;
|
|
19
|
+
abs: Decimal;
|
|
20
|
+
};
|
|
21
|
+
accrued: Decimal;
|
|
22
|
+
liabilities: Decimal;
|
|
23
|
+
gav: Decimal;
|
|
24
|
+
nav: Decimal;
|
|
25
|
+
aum: Decimal;
|
|
26
|
+
pnl: Decimal;
|
|
27
|
+
pnlToInvestment?: Maybe<Decimal>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Type definition for account reference in valuation reports.
|
|
32
|
+
*/
|
|
33
|
+
export interface ValuationReportAccount {
|
|
34
|
+
id: AccountId;
|
|
35
|
+
guid: string;
|
|
36
|
+
name: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Type definition for portfolio reference in valuation reports.
|
|
40
|
+
*/
|
|
41
|
+
export interface ValuationReportPortfolio {
|
|
42
|
+
id: PortfolioId;
|
|
43
|
+
guid: string;
|
|
44
|
+
name: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Type definition for accounts which valuation report is compiled from.
|
|
48
|
+
*/
|
|
49
|
+
export interface ValuationReportAccounts {
|
|
50
|
+
custody: ValuationReportAccount[];
|
|
51
|
+
journal: ValuationReportAccount[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The definition for valuation report holding classification.
|
|
55
|
+
*/
|
|
56
|
+
export declare type ValuationReportHoldingClassification = ValuationReportHoldingClassificationNode[];
|
|
57
|
+
/**
|
|
58
|
+
* Type definition for valuation report holding classification node.
|
|
59
|
+
*/
|
|
60
|
+
export interface ValuationReportHoldingClassificationNode {
|
|
61
|
+
name: string;
|
|
62
|
+
order: string | number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Type definition for base valuation report holding (shared by
|
|
66
|
+
* [[ValuationReportHolding]] and [[ValuationReportChildHolding]]).
|
|
67
|
+
*/
|
|
68
|
+
export interface BaseValuationReportHolding {
|
|
69
|
+
artifact: ValuationReportArtifact;
|
|
70
|
+
quantity: Decimal;
|
|
71
|
+
investment: ValuationReportHoldingFiguresInvestment;
|
|
72
|
+
valuation: ValuationReportHoldingFiguresValuation;
|
|
73
|
+
valuePercentage: Maybe<Decimal>;
|
|
74
|
+
netExposurePercentage: Maybe<Decimal>;
|
|
75
|
+
absExposurePercentage: Maybe<Decimal>;
|
|
76
|
+
change: Maybe<Decimal>;
|
|
77
|
+
pnl: Decimal;
|
|
78
|
+
pnlToInvestment: Maybe<Decimal>;
|
|
79
|
+
opendate: SDate;
|
|
80
|
+
lastdate: SDate;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Type definition for valuation report holding investment figures.
|
|
84
|
+
*/
|
|
85
|
+
export interface ValuationReportHoldingFiguresInvestment {
|
|
86
|
+
px: ValuationReportFigureOrgRef;
|
|
87
|
+
txncosts: Maybe<ValuationReportFigureOrgRef>;
|
|
88
|
+
accrued: Maybe<ValuationReportFigureOrgRef>;
|
|
89
|
+
value: ValuationReportFigureOrgRef;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Type definition for valuation report holding valuation figures.
|
|
93
|
+
*/
|
|
94
|
+
export interface ValuationReportHoldingFiguresValuation {
|
|
95
|
+
px: ValuationReportFigureOrgRef;
|
|
96
|
+
accrued: Maybe<ValuationReportFigureOrgRef>;
|
|
97
|
+
value: {
|
|
98
|
+
net: ValuationReportFigureOrgRef;
|
|
99
|
+
abs: ValuationReportFigureOrgRef;
|
|
100
|
+
};
|
|
101
|
+
exposure: {
|
|
102
|
+
net: ValuationReportFigureOrgRef;
|
|
103
|
+
abs: ValuationReportFigureOrgRef;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Type definition for valuation report figure value that is reported both in
|
|
108
|
+
* original currency and reference currency.
|
|
109
|
+
*/
|
|
110
|
+
export interface ValuationReportFigureOrgRef {
|
|
111
|
+
org: Decimal;
|
|
112
|
+
ref: Decimal;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Type definition for a valuation holding.
|
|
116
|
+
*/
|
|
117
|
+
export interface ValuationReportHolding extends BaseValuationReportHolding {
|
|
118
|
+
classification: ValuationReportHoldingClassification;
|
|
119
|
+
accounts: ValuationReportAccount[];
|
|
120
|
+
children: Maybe<ValuationReportChildHolding[]>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Type definition for a valuation holding child.
|
|
124
|
+
*/
|
|
125
|
+
export interface ValuationReportChildHolding extends BaseValuationReportHolding {
|
|
126
|
+
account: ValuationReportAccount;
|
|
127
|
+
}
|
|
128
|
+
export declare function isValuationHolding(x: ValuationReportHolding | ValuationReportChildHolding): x is ValuationReportHolding;
|
|
129
|
+
export declare function isValuationChildHolding(x: ValuationReportHolding | ValuationReportChildHolding): x is ValuationReportChildHolding;
|
|
130
|
+
/**
|
|
131
|
+
* Valuation accrual.
|
|
132
|
+
*/
|
|
133
|
+
export interface ValuationReportAccrual {
|
|
134
|
+
name: string;
|
|
135
|
+
value: Decimal;
|
|
136
|
+
accounts: ValuationReportAccrualByAccount[];
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Valuation accrual by account.
|
|
140
|
+
*/
|
|
141
|
+
export interface ValuationReportAccrualByAccount {
|
|
142
|
+
account: ValuationReportAccount;
|
|
143
|
+
value: Decimal;
|
|
144
|
+
accruals: ValuationReportAccrualByCurrency[];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Valuation accrual by account by currency.
|
|
148
|
+
*/
|
|
149
|
+
export interface ValuationReportAccrualByCurrency {
|
|
150
|
+
artifact: ValuationReportArtifact;
|
|
151
|
+
ccy: CurrencyCode;
|
|
152
|
+
value: ValuationReportFigureOrgRef;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Type definition of the FINREA artifact type.
|
|
156
|
+
*/
|
|
157
|
+
export interface ValuationReportArtifactType {
|
|
158
|
+
id: ArtifactTypeId;
|
|
159
|
+
name: string;
|
|
160
|
+
order: number;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Type definition for the artifact as reported in the valuation.
|
|
164
|
+
*/
|
|
165
|
+
export interface ValuationReportArtifact {
|
|
166
|
+
id: ArtifactId;
|
|
167
|
+
guid: string;
|
|
168
|
+
type: ValuationReportArtifactType;
|
|
169
|
+
stype: Maybe<string>;
|
|
170
|
+
symbol: string;
|
|
171
|
+
name: Maybe<string>;
|
|
172
|
+
ccy: Maybe<CurrencyCode>;
|
|
173
|
+
quantity: Decimal;
|
|
174
|
+
country: Maybe<string>;
|
|
175
|
+
issuer: Maybe<string>;
|
|
176
|
+
sector: Maybe<string>;
|
|
177
|
+
mic: Maybe<string>;
|
|
178
|
+
ticker: Maybe<string>;
|
|
179
|
+
isin: Maybe<string>;
|
|
180
|
+
figi: Maybe<string>;
|
|
181
|
+
expiry: Maybe<SDate>;
|
|
182
|
+
underlyingId: Maybe<ArtifactId>;
|
|
183
|
+
}
|
|
184
|
+
export interface ValuationReportFxRate {
|
|
185
|
+
ccy1: CurrencyCode;
|
|
186
|
+
ccy2: CurrencyCode;
|
|
187
|
+
value: Decimal;
|
|
188
|
+
asof: SDate;
|
|
189
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isValuationChildHolding = exports.isValuationHolding = void 0;
|
|
4
|
+
function isValuationHolding(x) {
|
|
5
|
+
return 'accounts' in x;
|
|
6
|
+
}
|
|
7
|
+
exports.isValuationHolding = isValuationHolding;
|
|
8
|
+
function isValuationChildHolding(x) {
|
|
9
|
+
return 'account' in x;
|
|
10
|
+
}
|
|
11
|
+
exports.isValuationChildHolding = isValuationChildHolding;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { fetchConsolidatedValuationReport } from './-remote-valuation-report-consolidated';
|
|
2
|
+
export type { ConsolidatedValuationReportQuery } from './-remote-valuation-report-consolidated';
|
|
3
|
+
export { fetchPortfolioValuationReport } from './-remote-valuation-report-portfolio';
|
|
4
|
+
export type { PortfolioValuationReportQuery } from './-remote-valuation-report-portfolio';
|
|
5
|
+
export * from './-valuation-report-consolidated';
|
|
6
|
+
export * from './-valuation-report-holdings-tree';
|
|
7
|
+
export * from './-valuation-report-portfolio';
|
|
8
|
+
export * from './-valuation-report-shared';
|
|
@@ -0,0 +1,25 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.fetchPortfolioValuationReport = exports.fetchConsolidatedValuationReport = void 0;
|
|
18
|
+
var _remote_valuation_report_consolidated_1 = require("./-remote-valuation-report-consolidated");
|
|
19
|
+
Object.defineProperty(exports, "fetchConsolidatedValuationReport", { enumerable: true, get: function () { return _remote_valuation_report_consolidated_1.fetchConsolidatedValuationReport; } });
|
|
20
|
+
var _remote_valuation_report_portfolio_1 = require("./-remote-valuation-report-portfolio");
|
|
21
|
+
Object.defineProperty(exports, "fetchPortfolioValuationReport", { enumerable: true, get: function () { return _remote_valuation_report_portfolio_1.fetchPortfolioValuationReport; } });
|
|
22
|
+
__exportStar(require("./-valuation-report-consolidated"), exports);
|
|
23
|
+
__exportStar(require("./-valuation-report-holdings-tree"), exports);
|
|
24
|
+
__exportStar(require("./-valuation-report-portfolio"), exports);
|
|
25
|
+
__exportStar(require("./-valuation-report-shared"), exports);
|
package/shell.nix
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
with import (fetchTarball https://github.com/NixOS/nixpkgs/archive/22.05.tar.gz) { };
|
|
2
|
+
|
|
3
|
+
stdenv.mkDerivation {
|
|
4
|
+
name = "decaf-client-javascript-extras";
|
|
5
|
+
|
|
6
|
+
buildInputs = with pkgs; [
|
|
7
|
+
git
|
|
8
|
+
nodejs-16_x
|
|
9
|
+
yarn
|
|
10
|
+
|
|
11
|
+
figlet
|
|
12
|
+
lolcat
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
shellHook = ''
|
|
16
|
+
## Greet:
|
|
17
|
+
figlet -w 999 -f standard "DECAF CLIENT EXTRAS DEV SHELL" | lolcat -S 179
|
|
18
|
+
'';
|
|
19
|
+
|
|
20
|
+
DECAF_JS_SKIP_POSTINSTALL = "TRUE";
|
|
21
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module provides currency related definitions.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Just, Maybe, mkPhantom, NewTypeWithPhantom, Nothing, unPhantom } from '@telostat/prelude';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Type encoding for currency code values.
|
|
11
|
+
*
|
|
12
|
+
* A currency code is (typically) defined as all-uppercase, three letters.
|
|
13
|
+
*/
|
|
14
|
+
export type CurrencyCode = NewTypeWithPhantom<'CurrencyCode', string>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Attempts to create a [[CurrencyCode]] value with the given currency code.
|
|
18
|
+
*
|
|
19
|
+
* This function returns a `Maybe` value. For the version that throws an
|
|
20
|
+
* error, see [[mkCurrencyCodeError]].
|
|
21
|
+
*
|
|
22
|
+
* @param x A currency code represented as string.
|
|
23
|
+
* @returns If the argument has leading or trailing spaces OR it is empty,
|
|
24
|
+
* `Nothing` is retured, `Just` [[CurrencyCode]] otherwise.
|
|
25
|
+
*/
|
|
26
|
+
export function mkCurrencyCode(x: string): Maybe<CurrencyCode> {
|
|
27
|
+
return x !== x.trim() || x === '' ? Nothing : Just(mkPhantom(x));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* (Unsafely) attempts to create a [[CurrencyCode]] value with the given
|
|
32
|
+
* currency code.
|
|
33
|
+
*
|
|
34
|
+
* This function may throw an error if the given argument is not a valid
|
|
35
|
+
* currency code. For the monadic version, see [[mkCurrencyCode]].
|
|
36
|
+
*
|
|
37
|
+
* @param x A currency code represented as string.
|
|
38
|
+
* @returns If the argument has leading or trailing spaces OR it is empty, an
|
|
39
|
+
* error is thrown, [[CurrencyCode]] is returned otherwise.
|
|
40
|
+
*/
|
|
41
|
+
export function mkCurrencyCodeError(x: string): CurrencyCode {
|
|
42
|
+
return mkCurrencyCode(x).orDefaultLazy(() => {
|
|
43
|
+
throw new Error(`Invalid currency code: "${x}"`);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Return the currency code as a string value.
|
|
49
|
+
*
|
|
50
|
+
* @param x [[CurrencyCode]] to be extracted string from.
|
|
51
|
+
* @returns Currency code as a string.
|
|
52
|
+
*/
|
|
53
|
+
export function unCurrencyCode(x: CurrencyCode): string {
|
|
54
|
+
return unPhantom(x);
|
|
55
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DECAF FINREA action date type type definition.
|
|
3
|
+
*/
|
|
4
|
+
export type DateType = 'commitment' | 'settlement';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Translation table for DECAF FINREA action date types.
|
|
8
|
+
*/
|
|
9
|
+
export const dateTypes: { label: string; value: DateType }[] = [
|
|
10
|
+
{ label: 'Trade Date', value: 'commitment' },
|
|
11
|
+
{ label: 'Value Date', value: 'settlement' },
|
|
12
|
+
];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { NewTypeWithPhantom } from '@telostat/prelude';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Type definition for identifiers with value spaces discriminated over the
|
|
5
|
+
* given phantom type.
|
|
6
|
+
*/
|
|
7
|
+
export type Id<P, V> = NewTypeWithPhantom<P, V>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Type definition for DECAF artifact identifiers.
|
|
11
|
+
*/
|
|
12
|
+
export type ArtifactId = NewTypeWithPhantom<'DecafArtifact', string | number>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Type definition for DECAF artifact type identifiers.
|
|
16
|
+
*/
|
|
17
|
+
export type ArtifactTypeId = NewTypeWithPhantom<'DecafArtifactType', string>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Type definition for DECAF share class identifiers.
|
|
21
|
+
*/
|
|
22
|
+
export type ShareClassId = NewTypeWithPhantom<'DecafShareClass', string | number>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Type definition for DECAF principal identifiers.
|
|
26
|
+
*/
|
|
27
|
+
export type PrincipalId = NewTypeWithPhantom<'DecafPrincipal', string | number>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Type definition for DECAF institution identifiers.
|
|
31
|
+
*/
|
|
32
|
+
export type InstitutionId = NewTypeWithPhantom<'DecafInstitution', string | number>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Type definition for DECAF team identifiers.
|
|
36
|
+
*/
|
|
37
|
+
export type TeamId = NewTypeWithPhantom<'DecafTeam', string | number>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Type definition for DECAF portfolio identifiers.
|
|
41
|
+
*/
|
|
42
|
+
export type PortfolioId = NewTypeWithPhantom<'DecafPortfolio', string | number>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Type definition for DECAF portfolio group identifiers.
|
|
46
|
+
*/
|
|
47
|
+
export type PortfolioGroupId = NewTypeWithPhantom<'DecafPortfolioGroup', string | number>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Type definition for DECAF account identifiers.
|
|
51
|
+
*/
|
|
52
|
+
export type AccountId = NewTypeWithPhantom<'DecafAccount', string | number>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Type definition for DECAF OHLC series identifiers.
|
|
56
|
+
*/
|
|
57
|
+
export type OhlcSeriesId = NewTypeWithPhantom<'DecafOhlcSeries', string | number>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Type definition for DECAF share class fee schedule identifiers.
|
|
61
|
+
*/
|
|
62
|
+
export type ShareClassFeeScheduleId = NewTypeWithPhantom<'DecafShareClassFeeSchedule', string | number>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Type definition for DECAF action identifiers.
|
|
66
|
+
*/
|
|
67
|
+
export type ActionId = NewTypeWithPhantom<'DecafAction', string | number>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Type definition for DECAF external valuation identifiers.
|
|
71
|
+
*/
|
|
72
|
+
export type ExternalValuationId = NewTypeWithPhantom<'DecafExternalValuation', string | number>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { buildDecafClient, DecafClient, gql } from '@decafhub/decaf-client';
|
|
2
|
+
import { mk, PDateTime } from '@telostat/prelude';
|
|
3
|
+
import { fail } from 'assert';
|
|
4
|
+
import { PortfolioId } from './commons';
|
|
5
|
+
import { fetchRemotePortfolioValuationReport } from './reports/valuation/-remote-valuation-report-portfolio';
|
|
6
|
+
|
|
7
|
+
const API_URL = process.env.TESTING_API_URL;
|
|
8
|
+
const API_KEY = process.env.TESTING_API_KEY;
|
|
9
|
+
const API_SECRET = process.env.TESTING_API_SECRET;
|
|
10
|
+
|
|
11
|
+
const FIRST_PORTFOLIO_QUERY = gql`
|
|
12
|
+
query GetFirstPortfolio {
|
|
13
|
+
portfolio(limit: 1) {
|
|
14
|
+
id
|
|
15
|
+
name
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
describe('Main', () => {
|
|
21
|
+
let client: DecafClient;
|
|
22
|
+
let portfolioId: PortfolioId;
|
|
23
|
+
|
|
24
|
+
beforeAll(() => {
|
|
25
|
+
jest.resetModules();
|
|
26
|
+
if (!API_URL || !API_KEY || !API_SECRET) {
|
|
27
|
+
throw new Error('Environment variables TESTING_API_URL, TESTING_API_KEY, TESTING_API_SECRET must be set');
|
|
28
|
+
}
|
|
29
|
+
client = buildDecafClient(API_URL, {
|
|
30
|
+
key: API_KEY,
|
|
31
|
+
secret: API_SECRET,
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('build a valid and authenticated decaf client', async () => {
|
|
36
|
+
const { status } = await client.barista.head('/me/');
|
|
37
|
+
expect(status).toBe(200);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('take the first portfolio', async () => {
|
|
41
|
+
try {
|
|
42
|
+
const { data } = await client.microlot.query({ query: FIRST_PORTFOLIO_QUERY });
|
|
43
|
+
portfolioId = data?.portfolio?.[0].id;
|
|
44
|
+
expect(portfolioId).toBeDefined();
|
|
45
|
+
} catch (e) {
|
|
46
|
+
fail('Error while fetching the first portfolio');
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('get a remote portfolio report successfuly', async () => {
|
|
51
|
+
const eValue = await fetchRemotePortfolioValuationReport(client, {
|
|
52
|
+
portfolio: portfolioId,
|
|
53
|
+
date: PDateTime(new Date()).format('YYYY-MM-DD'),
|
|
54
|
+
dateType: 'settlement',
|
|
55
|
+
currency: mk('EUR'),
|
|
56
|
+
});
|
|
57
|
+
eValue.caseOf({
|
|
58
|
+
Left: (e) => fail('Error while fetching the remote portfolio report: ' + e.msg),
|
|
59
|
+
Right: (value) => {
|
|
60
|
+
console.log(
|
|
61
|
+
`Success! remote valuation for portfolio ID ${value.portfolio.id} is reported at ${value.reported}`
|
|
62
|
+
);
|
|
63
|
+
expect(value).toBeDefined();
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as valuation from './valuation';
|