elemento-alpha-tools 1.3.11 → 1.3.13
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/dist/crud/ForecastManager.d.ts +41 -11
- package/dist/crud/ForecastManager.js +8 -7
- package/dist/crud/ForecastManager.js.map +1 -1
- package/dist/econometrics/OrdinaryLeastSquares.d.ts +14 -0
- package/dist/econometrics/OrdinaryLeastSquares.js +101 -0
- package/dist/econometrics/OrdinaryLeastSquares.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/timeSeries/TimeSeriesPipeline.d.ts +22 -0
- package/dist/timeSeries/TimeSeriesPipeline.js +100 -0
- package/dist/timeSeries/TimeSeriesPipeline.js.map +1 -0
- package/package.json +1 -1
- package/dist/crud/EquationsManager.d.ts +0 -51
- package/dist/crud/EquationsManager.js +0 -84
- package/dist/crud/EquationsManager.js.map +0 -1
|
@@ -1,30 +1,60 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from "axios";
|
|
2
2
|
import { CrudServiceManager, StandardIdRequestDefinition } from "itrm-tools";
|
|
3
|
+
export interface IForecastInput {
|
|
4
|
+
name: string;
|
|
5
|
+
raw: boolean;
|
|
6
|
+
transform: string | null;
|
|
7
|
+
delay?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface IForecastOutput {
|
|
10
|
+
name: string;
|
|
11
|
+
unit: string;
|
|
12
|
+
raw: boolean;
|
|
13
|
+
transform: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface IForecastData {
|
|
16
|
+
intercept?: number;
|
|
17
|
+
coefficients?: {
|
|
18
|
+
input: string;
|
|
19
|
+
beta: number;
|
|
20
|
+
}[];
|
|
21
|
+
standardError?: number;
|
|
22
|
+
rSquared?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface IForecastDetails {
|
|
25
|
+
inputs: {
|
|
26
|
+
size: number;
|
|
27
|
+
[variable: string]: IForecastInput | number;
|
|
28
|
+
};
|
|
29
|
+
outputs: {
|
|
30
|
+
[name: string]: IForecastOutput;
|
|
31
|
+
};
|
|
32
|
+
options?: {
|
|
33
|
+
useIntercept?: boolean;
|
|
34
|
+
};
|
|
35
|
+
data?: any;
|
|
36
|
+
}
|
|
3
37
|
export interface IForecast {
|
|
4
38
|
forecastId?: number;
|
|
39
|
+
name?: string;
|
|
5
40
|
assetId?: number;
|
|
41
|
+
businessId?: number;
|
|
6
42
|
typeId?: number;
|
|
7
|
-
|
|
8
|
-
value?: number;
|
|
9
|
-
fromDate?: number;
|
|
10
|
-
toDate?: number;
|
|
43
|
+
details?: IForecastDetails;
|
|
11
44
|
updatedAt?: string;
|
|
12
45
|
createdAt?: string;
|
|
13
46
|
config?: AxiosRequestConfig;
|
|
14
47
|
}
|
|
15
48
|
export interface IForecastSearchDetails {
|
|
16
49
|
forecastId?: number;
|
|
50
|
+
name?: string;
|
|
17
51
|
assetId?: number;
|
|
52
|
+
businessId?: number;
|
|
18
53
|
typeId?: number;
|
|
19
|
-
|
|
20
|
-
value?: number;
|
|
21
|
-
updatedAt?: string;
|
|
22
|
-
createdAt?: string;
|
|
23
|
-
config?: AxiosRequestConfig;
|
|
24
|
-
fromDate?: number;
|
|
25
|
-
toDate?: number;
|
|
54
|
+
details?: IForecastDetails;
|
|
26
55
|
limit?: number;
|
|
27
56
|
offset?: number;
|
|
57
|
+
config?: AxiosRequestConfig;
|
|
28
58
|
values?: IForecast[];
|
|
29
59
|
}
|
|
30
60
|
export declare class ForecastManager extends CrudServiceManager<IForecastSearchDetails, IForecast> {
|
|
@@ -16,10 +16,9 @@ class ForecastManager extends itrm_tools_1.CrudServiceManager {
|
|
|
16
16
|
super();
|
|
17
17
|
this.url = url;
|
|
18
18
|
}
|
|
19
|
-
;
|
|
20
19
|
find(details) {
|
|
21
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
return this.sendFinding(`${this.url}/forecast
|
|
21
|
+
return this.sendFinding(this.buildRequestUrl(`${this.url}/forecast`, details), details.config);
|
|
23
22
|
});
|
|
24
23
|
}
|
|
25
24
|
findById(id) {
|
|
@@ -28,7 +27,7 @@ class ForecastManager extends itrm_tools_1.CrudServiceManager {
|
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
29
|
buildRequestUrl(url, details) {
|
|
31
|
-
let suffix = `${details.assetId ? `&assetId=${details.assetId}` : ""}${details.
|
|
30
|
+
let suffix = `${details.assetId ? `&assetId=${details.assetId}` : ""}${details.businessId ? `&businessId=${details.businessId}` : ""}${details.typeId ? `&typeId=${details.typeId}` : ""}${details.name ? `&name=${details.name}` : ""}`;
|
|
32
31
|
return `${url}?${suffix.substring(1)}`;
|
|
33
32
|
}
|
|
34
33
|
count(details) {
|
|
@@ -62,10 +61,11 @@ class ForecastManager extends itrm_tools_1.CrudServiceManager {
|
|
|
62
61
|
create(details) {
|
|
63
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
63
|
return this.sendCreation(`${this.url}/forecast`, {
|
|
64
|
+
name: details.name,
|
|
65
65
|
assetId: details.assetId,
|
|
66
|
+
businessId: details.businessId,
|
|
66
67
|
typeId: details.typeId,
|
|
67
|
-
|
|
68
|
-
value: details.value,
|
|
68
|
+
details: details.details
|
|
69
69
|
}, details.config);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
@@ -78,10 +78,11 @@ class ForecastManager extends itrm_tools_1.CrudServiceManager {
|
|
|
78
78
|
modify(forecast) {
|
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
return this.sendModification(`${this.url}/forecast/${forecast.forecastId}`, {
|
|
81
|
+
name: forecast.name,
|
|
81
82
|
assetId: forecast.assetId,
|
|
83
|
+
businessId: forecast.businessId,
|
|
82
84
|
typeId: forecast.typeId,
|
|
83
|
-
|
|
84
|
-
value: forecast.value,
|
|
85
|
+
details: forecast.details
|
|
85
86
|
}, forecast.config);
|
|
86
87
|
});
|
|
87
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForecastManager.js","sourceRoot":"","sources":["../../src/crud/ForecastManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAA6E;
|
|
1
|
+
{"version":3,"file":"ForecastManager.js","sourceRoot":"","sources":["../../src/crud/ForecastManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAA6E;AAuD7E,MAAa,eAAgB,SAAQ,+BAAqD;IAGxF,YAAY,GAAW;QACrB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAEY,IAAI,CAAC,OAA+B;;YAC/C,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,GAAG,WAAW,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACjG,CAAC;KAAA;IAEY,QAAQ,CAAC,EAA+B;;YACnD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,GAAG,gBAAgB,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;QACzE,CAAC;KAAA;IAEO,eAAe,CAAC,GAAW,EAAE,OAA+B;QAClE,IAAI,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACzO,OAAO,GAAG,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,CAA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,GAAG,aAAa,QAAQ,CAAC,UAAU,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC9F,CAAC;KAAA;CACF;AAvED,0CAuEC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AlignedSeries } from '../timeSeries/TimeSeriesPipeline';
|
|
2
|
+
export interface RegressionResult {
|
|
3
|
+
intercept: number;
|
|
4
|
+
coefficients: number[];
|
|
5
|
+
rSquared: number;
|
|
6
|
+
standardError: number;
|
|
7
|
+
}
|
|
8
|
+
export interface OLSOptions {
|
|
9
|
+
useIntercept?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare class RegressionError extends Error {
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
export declare function fitOLS(aligned: AlignedSeries, options?: OLSOptions): RegressionResult;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegressionError = void 0;
|
|
4
|
+
exports.fitOLS = fitOLS;
|
|
5
|
+
class RegressionError extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'RegressionError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.RegressionError = RegressionError;
|
|
12
|
+
function identityRow(size, index) {
|
|
13
|
+
const row = new Array(size).fill(0);
|
|
14
|
+
row[index] = 1;
|
|
15
|
+
return row;
|
|
16
|
+
}
|
|
17
|
+
function transpose(matrix) {
|
|
18
|
+
const rows = matrix.length;
|
|
19
|
+
const cols = rows > 0 ? matrix[0].length : 0;
|
|
20
|
+
const result = Array.from({ length: cols }, () => new Array(rows).fill(0));
|
|
21
|
+
for (let i = 0; i < rows; i++) {
|
|
22
|
+
for (let j = 0; j < cols; j++)
|
|
23
|
+
result[j][i] = matrix[i][j];
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
function multiply(a, b) {
|
|
28
|
+
const rows = a.length, inner = b.length;
|
|
29
|
+
const cols = inner > 0 ? b[0].length : 0;
|
|
30
|
+
const result = Array.from({ length: rows }, () => new Array(cols).fill(0));
|
|
31
|
+
for (let i = 0; i < rows; i++) {
|
|
32
|
+
for (let k = 0; k < inner; k++) {
|
|
33
|
+
const factor = a[i][k];
|
|
34
|
+
for (let j = 0; j < cols; j++)
|
|
35
|
+
result[i][j] += factor * b[k][j];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
function invert(matrix) {
|
|
41
|
+
const size = matrix.length;
|
|
42
|
+
const augmented = matrix.map((row, i) => [...row, ...identityRow(size, i)]);
|
|
43
|
+
let singular = false;
|
|
44
|
+
for (let pivot = 0; pivot < size; pivot++) {
|
|
45
|
+
if (!singular) {
|
|
46
|
+
let best = pivot;
|
|
47
|
+
for (let row = pivot + 1; row < size; row++) {
|
|
48
|
+
if (Math.abs(augmented[row][pivot]) > Math.abs(augmented[best][pivot]))
|
|
49
|
+
best = row;
|
|
50
|
+
}
|
|
51
|
+
const pivotValue = augmented[best][pivot];
|
|
52
|
+
if (Math.abs(pivotValue) < 1e-12) {
|
|
53
|
+
singular = true;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
[augmented[pivot], augmented[best]] = [augmented[best], augmented[pivot]];
|
|
57
|
+
for (let col = 0; col < 2 * size; col++)
|
|
58
|
+
augmented[pivot][col] /= pivotValue;
|
|
59
|
+
for (let row = 0; row < size; row++) {
|
|
60
|
+
if (row !== pivot) {
|
|
61
|
+
const factor = augmented[row][pivot];
|
|
62
|
+
for (let col = 0; col < 2 * size; col++)
|
|
63
|
+
augmented[row][col] -= factor * augmented[pivot][col];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (singular)
|
|
70
|
+
throw new RegressionError('Cannot solve regression: variables are collinear or degenerate');
|
|
71
|
+
return augmented.map(row => row.slice(size));
|
|
72
|
+
}
|
|
73
|
+
function fitOLS(aligned, options = {}) {
|
|
74
|
+
const useIntercept = options.useIntercept !== false;
|
|
75
|
+
const { y, x } = aligned;
|
|
76
|
+
const observations = y.length;
|
|
77
|
+
const predictors = x.length > 0 ? x[0].length : 0;
|
|
78
|
+
const parameters = predictors + (useIntercept ? 1 : 0);
|
|
79
|
+
if (observations >= parameters + 1) {
|
|
80
|
+
const design = x.map(row => (useIntercept ? [1, ...row] : [...row]));
|
|
81
|
+
const designT = transpose(design);
|
|
82
|
+
const inverse = invert(multiply(designT, design));
|
|
83
|
+
const projected = multiply(designT, y.map(value => [value]));
|
|
84
|
+
const beta = multiply(inverse, projected).map(row => row[0]);
|
|
85
|
+
const predictions = design.map(row => row.reduce((sum, value, i) => sum + value * beta[i], 0));
|
|
86
|
+
const mean = y.reduce((sum, value) => sum + value, 0) / observations;
|
|
87
|
+
const totalSum = useIntercept
|
|
88
|
+
? y.reduce((sum, value) => sum + Math.pow((value - mean), 2), 0)
|
|
89
|
+
: y.reduce((sum, value) => sum + Math.pow(value, 2), 0);
|
|
90
|
+
const residualSum = y.reduce((sum, value, i) => sum + Math.pow((value - predictions[i]), 2), 0);
|
|
91
|
+
const degreesOfFreedom = observations - parameters;
|
|
92
|
+
return {
|
|
93
|
+
intercept: useIntercept ? beta[0] : 0,
|
|
94
|
+
coefficients: useIntercept ? beta.slice(1) : beta,
|
|
95
|
+
rSquared: totalSum > 0 ? 1 - residualSum / totalSum : 0,
|
|
96
|
+
standardError: degreesOfFreedom > 0 ? Math.sqrt(residualSum / degreesOfFreedom) : 0
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
throw new RegressionError(`Regression needs more observations than parameters: got ${observations} rows for ${parameters} parameters`);
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=OrdinaryLeastSquares.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrdinaryLeastSquares.js","sourceRoot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YACL,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACrC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;YACjD,QAAQ,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YACvD,aAAa,EAAE,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;SACpF,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,eAAe,CAAC,2DAA2D,YAAY,aAAa,UAAU,aAAa,CAAC,CAAC;AACzI,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,14 +6,13 @@ export { IConfig as IConfig, IConfigSearchDetails as IConfigSearchDetails, Confi
|
|
|
6
6
|
export { IAvailablePlatform as IAvailablePlatform, IAvailablePlatformSearchDetails as IAvailablePlatformSearchDetails, AvailablePlatformManager as AvailablePlataformManager } from './crud/AvailablePlataformManager';
|
|
7
7
|
export { IBusiness as IBusiness, IBusinessSearchDetails as IBusinessSearchDetails, BusinessManager as BusinessManager } from './crud/BusinessManager';
|
|
8
8
|
export { IComponent as IComponent, IComponentSearchDetails as IComponentSearchDetails, IComponentDetails as IComponentDetails, IComponentServiceDetails as IComponentServiceDetails, ComponentManager as ComponentManager } from './crud/ComponentManager';
|
|
9
|
-
export { IForecast
|
|
9
|
+
export { IForecast, IForecastInput, IForecastOutput, IForecastData, IForecastDetails, IForecastSearchDetails, ForecastManager } from './crud/ForecastManager';
|
|
10
10
|
export { IIntermediary as IIntermediary, IIntermediarySearchDetails as IIntermediarySearchDetails, IntermediaryManager as IntermediaryManager } from "./crud/Intermediaries";
|
|
11
11
|
export { IIntermediaryData as IIntermediaryData, IIntermediaryDataDetails as IIntermediaryDataDetails, IntermediaryDataManager as IntermediaryDataManager } from "./crud/IntermediaryDataManager";
|
|
12
12
|
export { IMarketData as IMarketData, IMarketDataSearchDetails as IMarketDataSearchDetails, MarketDataManager as MarketDataManager } from './crud/MarketDataManager';
|
|
13
13
|
export { IOptimization as IOptimization, IOptimizationSearchDetails as IOptimizationSearchDetails, OptimizationManager as OptimizationManager } from './crud/OptimizationManager';
|
|
14
14
|
export { IPlatform as IPlatform, IPlatformSearchDetails as IPlatformSearchDetails, IPlatformDetails as IPlatformDetails, PlatformManager as PlatformManager } from "./crud/PlatformManager";
|
|
15
15
|
export { IPortfolioBenchmark as IPortfolioBenchmark, IPortfolioBenchmarkSearchDetails as IPortfolioBenchmarkSearchDetails, PortfolioBenchmarkManager as PortfolioBenchmarkManager } from './crud/PortfolioBenchmarkManager';
|
|
16
|
-
export { IEquation, IEquationTerm, IEquationDetails, EquationTreatment, IEquationSearchDetails, EquationsManager } from './crud/EquationsManager';
|
|
17
16
|
export { IRole as IRole, IRoleSearchDetails as IRoleSearchDetails, RoleManager as RoleManager } from "./crud/RoleManager";
|
|
18
17
|
export { ISource as ISource, ISourceSearchDetails as ISourceSearchDetails, SourcesManager as SourcesManager } from './crud/SourcesManager';
|
|
19
18
|
export { IStatus as IStatus, IStatusSearchDetails as IStatusSearchDetails, StatusManager as StatusManager } from "./crud/StatusManager";
|
|
@@ -30,6 +29,8 @@ export { ReturnGoal as ReturnGoal } from "./optimization/search/portfolio/goals/
|
|
|
30
29
|
export { VolatilityGoal as VolatilityGoal } from "./optimization/search/portfolio/goals/VolatilityGoal";
|
|
31
30
|
export { PortfolioSearch as PortfolioSearch } from "./optimization/search/portfolio/SPEA2PortfolioSearch";
|
|
32
31
|
export { computeAssetMetrics as computeAssetMetrics, AssetMetrics as AssetMetrics } from "./optimization/assetsMetricsCalculator/AssetMetricsCalculator";
|
|
32
|
+
export { monthEndCloses, monthlyReturns, applyTreatment, applyDelay, alignByMonth, MissingMonthsError, MonthlyPoint, RawPoint, AlignedSeries } from "./timeSeries/TimeSeriesPipeline";
|
|
33
|
+
export { fitOLS, RegressionResult, RegressionError, OLSOptions } from "./econometrics/OrdinaryLeastSquares";
|
|
33
34
|
export { applyLoginMocks as applyLoginMocks } from "./crud/test/LoginServiceMocks";
|
|
34
35
|
export { applyPlatformMocks as applyPlatformMocks } from "./crud/test/PlatformMocks";
|
|
35
36
|
export { applyRoleMocks as applyRoleMocks } from "./crud/test/RoleMocks";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyTypeMocks = exports.applyStatusMocks = exports.applyRoleMocks = exports.applyPlatformMocks = exports.applyLoginMocks = exports.computeAssetMetrics = exports.PortfolioSearch = exports.VolatilityGoal = exports.ReturnGoal = exports.RealOrder = exports.PortfolioXOver = exports.PortfolioMutation = exports.PopulationGenerator = exports.PortfolioIndividualBuilder = exports.PortfolioSpace = exports.UserManager = exports.UserCredentialsManager = exports.TypeManager = exports.StatusManager = exports.SourcesManager = exports.RoleManager = exports.
|
|
3
|
+
exports.applyTypeMocks = exports.applyStatusMocks = exports.applyRoleMocks = exports.applyPlatformMocks = exports.applyLoginMocks = exports.RegressionError = exports.fitOLS = exports.MissingMonthsError = exports.alignByMonth = exports.applyDelay = exports.applyTreatment = exports.monthlyReturns = exports.monthEndCloses = exports.computeAssetMetrics = exports.PortfolioSearch = exports.VolatilityGoal = exports.ReturnGoal = exports.RealOrder = exports.PortfolioXOver = exports.PortfolioMutation = exports.PopulationGenerator = exports.PortfolioIndividualBuilder = exports.PortfolioSpace = exports.UserManager = exports.UserCredentialsManager = exports.TypeManager = exports.StatusManager = exports.SourcesManager = exports.RoleManager = exports.PortfolioBenchmarkManager = exports.PlatformManager = exports.OptimizationManager = exports.MarketDataManager = exports.IntermediaryDataManager = exports.IntermediaryManager = exports.ForecastManager = exports.ComponentManager = exports.BusinessManager = exports.AvailablePlataformManager = exports.ConfigManager = exports.AssetsManager = exports.RoleServicePermissionsChecker = exports.ServiceSessionChecker = exports.ExpressLogableConfig = void 0;
|
|
4
4
|
var ExpressLogableConfig_1 = require("./ap\u00ED/ExpressLogableConfig");
|
|
5
5
|
Object.defineProperty(exports, "ExpressLogableConfig", { enumerable: true, get: function () { return ExpressLogableConfig_1.ExpressLogableConfig; } });
|
|
6
6
|
var ServiceSessionChecker_1 = require("./ap\u00ED/checkers/ServiceSessionChecker");
|
|
@@ -31,8 +31,6 @@ var PlatformManager_1 = require("./crud/PlatformManager");
|
|
|
31
31
|
Object.defineProperty(exports, "PlatformManager", { enumerable: true, get: function () { return PlatformManager_1.PlatformManager; } });
|
|
32
32
|
var PortfolioBenchmarkManager_1 = require("./crud/PortfolioBenchmarkManager");
|
|
33
33
|
Object.defineProperty(exports, "PortfolioBenchmarkManager", { enumerable: true, get: function () { return PortfolioBenchmarkManager_1.PortfolioBenchmarkManager; } });
|
|
34
|
-
var EquationsManager_1 = require("./crud/EquationsManager");
|
|
35
|
-
Object.defineProperty(exports, "EquationsManager", { enumerable: true, get: function () { return EquationsManager_1.EquationsManager; } });
|
|
36
34
|
var RoleManager_1 = require("./crud/RoleManager");
|
|
37
35
|
Object.defineProperty(exports, "RoleManager", { enumerable: true, get: function () { return RoleManager_1.RoleManager; } });
|
|
38
36
|
var SourcesManager_1 = require("./crud/SourcesManager");
|
|
@@ -65,6 +63,16 @@ var SPEA2PortfolioSearch_1 = require("./optimization/search/portfolio/SPEA2Portf
|
|
|
65
63
|
Object.defineProperty(exports, "PortfolioSearch", { enumerable: true, get: function () { return SPEA2PortfolioSearch_1.PortfolioSearch; } });
|
|
66
64
|
var AssetMetricsCalculator_1 = require("./optimization/assetsMetricsCalculator/AssetMetricsCalculator");
|
|
67
65
|
Object.defineProperty(exports, "computeAssetMetrics", { enumerable: true, get: function () { return AssetMetricsCalculator_1.computeAssetMetrics; } });
|
|
66
|
+
var TimeSeriesPipeline_1 = require("./timeSeries/TimeSeriesPipeline");
|
|
67
|
+
Object.defineProperty(exports, "monthEndCloses", { enumerable: true, get: function () { return TimeSeriesPipeline_1.monthEndCloses; } });
|
|
68
|
+
Object.defineProperty(exports, "monthlyReturns", { enumerable: true, get: function () { return TimeSeriesPipeline_1.monthlyReturns; } });
|
|
69
|
+
Object.defineProperty(exports, "applyTreatment", { enumerable: true, get: function () { return TimeSeriesPipeline_1.applyTreatment; } });
|
|
70
|
+
Object.defineProperty(exports, "applyDelay", { enumerable: true, get: function () { return TimeSeriesPipeline_1.applyDelay; } });
|
|
71
|
+
Object.defineProperty(exports, "alignByMonth", { enumerable: true, get: function () { return TimeSeriesPipeline_1.alignByMonth; } });
|
|
72
|
+
Object.defineProperty(exports, "MissingMonthsError", { enumerable: true, get: function () { return TimeSeriesPipeline_1.MissingMonthsError; } });
|
|
73
|
+
var OrdinaryLeastSquares_1 = require("./econometrics/OrdinaryLeastSquares");
|
|
74
|
+
Object.defineProperty(exports, "fitOLS", { enumerable: true, get: function () { return OrdinaryLeastSquares_1.fitOLS; } });
|
|
75
|
+
Object.defineProperty(exports, "RegressionError", { enumerable: true, get: function () { return OrdinaryLeastSquares_1.RegressionError; } });
|
|
68
76
|
var LoginServiceMocks_1 = require("./crud/test/LoginServiceMocks");
|
|
69
77
|
Object.defineProperty(exports, "applyLoginMocks", { enumerable: true, get: function () { return LoginServiceMocks_1.applyLoginMocks; } });
|
|
70
78
|
var PlatformMocks_1 = require("./crud/test/PlatformMocks");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wEAA0F;AAAjF,4HAAA,oBAAoB,OAAwB;AACrD,mFAAkM;AAA7F,8HAAA,qBAAqB,OAAyB;AACnJ,qGAA+H;AAAtH,+IAAA,6BAA6B,OAAiC;AACvE,sDAAwI;AAA7D,8GAAA,aAAa,OAAiB;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AAA7H,wIAAA,0BAA0B,OAA8B;AACjE,qFAA2G;AAAlG,0HAAA,mBAAmB,OAAuB;AACnD,+FAAmH;AAA1G,sHAAA,iBAAiB,OAAqB;AAC/C,yFAA0G;AAAjG,gHAAA,cAAc,OAAkB;AACzC,mDAA+D;AAAtD,sGAAA,SAAS,OAAa;AAC/B,+EAA4F;AAAnF,wGAAA,UAAU,OAAc;AACjC,uFAAwG;AAA/F,gHAAA,cAAc,OAAkB;AACzC,6FAA0G;AAAjG,uHAAA,eAAe,OAAmB;AAC3C,wGAAyJ;AAAhJ,6HAAA,mBAAmB,OAAuB;AACnD,sEAAsL;AAA7K,oHAAA,cAAc,OAAA;AAAE,oHAAA,cAAc,OAAA;AAAE,oHAAA,cAAc,OAAA;AAAE,gHAAA,UAAU,OAAA;AAAE,kHAAA,YAAY,OAAA;AAAE,wHAAA,kBAAkB,OAAA;AACrG,4EAA4G;AAAnG,8GAAA,MAAM,OAAA;AAAoB,uHAAA,eAAe,OAAA;AAElD,mEAAmF;AAA1E,oHAAA,eAAe,OAAmB;AAC3C,2DAAqF;AAA5E,mHAAA,kBAAkB,OAAsB;AACjD,mDAAyE;AAAhE,2GAAA,cAAc,OAAkB;AACzC,uDAA+E;AAAtE,+GAAA,gBAAgB,OAAoB;AAC7C,mDAAyE;AAAhE,2GAAA,cAAc,OAAkB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface MonthlyPoint {
|
|
2
|
+
month: number;
|
|
3
|
+
value: number;
|
|
4
|
+
}
|
|
5
|
+
export interface RawPoint {
|
|
6
|
+
date: number;
|
|
7
|
+
value: number;
|
|
8
|
+
}
|
|
9
|
+
export interface AlignedSeries {
|
|
10
|
+
months: number[];
|
|
11
|
+
y: number[];
|
|
12
|
+
x: number[][];
|
|
13
|
+
}
|
|
14
|
+
export declare class MissingMonthsError extends Error {
|
|
15
|
+
readonly months: number[];
|
|
16
|
+
constructor(months: number[]);
|
|
17
|
+
}
|
|
18
|
+
export declare function monthEndCloses(points: RawPoint[]): MonthlyPoint[];
|
|
19
|
+
export declare function monthlyReturns(closes: MonthlyPoint[]): MonthlyPoint[];
|
|
20
|
+
export declare function applyTreatment(closes: MonthlyPoint[], treatment: 'direct' | 'return'): MonthlyPoint[];
|
|
21
|
+
export declare function applyDelay(series: MonthlyPoint[], delay: number): MonthlyPoint[];
|
|
22
|
+
export declare function alignByMonth(target: MonthlyPoint[], variables: MonthlyPoint[][]): AlignedSeries;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MissingMonthsError = void 0;
|
|
4
|
+
exports.monthEndCloses = monthEndCloses;
|
|
5
|
+
exports.monthlyReturns = monthlyReturns;
|
|
6
|
+
exports.applyTreatment = applyTreatment;
|
|
7
|
+
exports.applyDelay = applyDelay;
|
|
8
|
+
exports.alignByMonth = alignByMonth;
|
|
9
|
+
class MissingMonthsError extends Error {
|
|
10
|
+
constructor(months) {
|
|
11
|
+
super(`Missing months in series: ${months.map(formatMonth).join(', ')}`);
|
|
12
|
+
this.name = 'MissingMonthsError';
|
|
13
|
+
this.months = months;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.MissingMonthsError = MissingMonthsError;
|
|
17
|
+
function formatMonth(month) {
|
|
18
|
+
return `${Math.floor(month / 100)}-${String(month % 100).padStart(2, '0')}`;
|
|
19
|
+
}
|
|
20
|
+
function toMonth(date) {
|
|
21
|
+
return Math.floor(date / 100);
|
|
22
|
+
}
|
|
23
|
+
function monthToIndex(month) {
|
|
24
|
+
const year = Math.floor(month / 100);
|
|
25
|
+
const monthOfYear = month % 100;
|
|
26
|
+
return year * 12 + (monthOfYear - 1);
|
|
27
|
+
}
|
|
28
|
+
function indexToMonth(index) {
|
|
29
|
+
const year = Math.floor(index / 12);
|
|
30
|
+
const monthOfYear = (index % 12) + 1;
|
|
31
|
+
return year * 100 + monthOfYear;
|
|
32
|
+
}
|
|
33
|
+
function missingMonths(series) {
|
|
34
|
+
const gaps = [];
|
|
35
|
+
for (let i = 1; i < series.length; i++) {
|
|
36
|
+
const previous = monthToIndex(series[i - 1].month);
|
|
37
|
+
const current = monthToIndex(series[i].month);
|
|
38
|
+
for (let idx = previous + 1; idx < current; idx++)
|
|
39
|
+
gaps.push(indexToMonth(idx));
|
|
40
|
+
}
|
|
41
|
+
return gaps;
|
|
42
|
+
}
|
|
43
|
+
function monthEndCloses(points) {
|
|
44
|
+
const latestByMonth = new Map();
|
|
45
|
+
for (const point of points) {
|
|
46
|
+
const month = toMonth(point.date);
|
|
47
|
+
const current = latestByMonth.get(month);
|
|
48
|
+
if (current === undefined || point.date > current.date)
|
|
49
|
+
latestByMonth.set(month, point);
|
|
50
|
+
}
|
|
51
|
+
return Array.from(latestByMonth.entries())
|
|
52
|
+
.map(([month, point]) => ({ month, value: point.value }))
|
|
53
|
+
.sort((a, b) => a.month - b.month);
|
|
54
|
+
}
|
|
55
|
+
function monthlyReturns(closes) {
|
|
56
|
+
const gaps = missingMonths(closes);
|
|
57
|
+
const returns = [];
|
|
58
|
+
for (let i = 1; i < closes.length; i++) {
|
|
59
|
+
returns.push({ month: closes[i].month, value: closes[i].value / closes[i - 1].value - 1 });
|
|
60
|
+
}
|
|
61
|
+
if (gaps.length > 0)
|
|
62
|
+
throw new MissingMonthsError(gaps);
|
|
63
|
+
return returns;
|
|
64
|
+
}
|
|
65
|
+
function applyTreatment(closes, treatment) {
|
|
66
|
+
return treatment === 'return' ? monthlyReturns(closes) : closes;
|
|
67
|
+
}
|
|
68
|
+
function applyDelay(series, delay) {
|
|
69
|
+
return series.map(point => ({ month: indexToMonth(monthToIndex(point.month) + delay), value: point.value }));
|
|
70
|
+
}
|
|
71
|
+
function alignByMonth(target, variables) {
|
|
72
|
+
const seriesList = [target, ...variables];
|
|
73
|
+
const populated = seriesList.every(series => series.length > 0);
|
|
74
|
+
const start = populated ? Math.max(...seriesList.map(series => monthToIndex(series[0].month))) : 0;
|
|
75
|
+
const end = populated ? Math.min(...seriesList.map(series => monthToIndex(series[series.length - 1].month))) : -1;
|
|
76
|
+
const targetByMonth = new Map(target.map(point => [point.month, point.value]));
|
|
77
|
+
const variablesByMonth = variables.map(series => new Map(series.map(point => [point.month, point.value])));
|
|
78
|
+
const months = [];
|
|
79
|
+
const y = [];
|
|
80
|
+
const x = [];
|
|
81
|
+
const missing = [];
|
|
82
|
+
for (let index = start; index <= end; index++) {
|
|
83
|
+
const month = indexToMonth(index);
|
|
84
|
+
const targetValue = targetByMonth.get(month);
|
|
85
|
+
const row = variablesByMonth.map(map => map.get(month));
|
|
86
|
+
const complete = targetValue !== undefined && row.every((value) => typeof value === 'number' && Number.isFinite(value));
|
|
87
|
+
if (complete) {
|
|
88
|
+
months.push(month);
|
|
89
|
+
y.push(targetValue);
|
|
90
|
+
x.push(row);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
missing.push(month);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (missing.length > 0)
|
|
97
|
+
throw new MissingMonthsError(missing);
|
|
98
|
+
return { months, y, x };
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=TimeSeriesPipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeSeriesPipeline.js","sourceRoot":"","sources":["../../src/timeSeries/TimeSeriesPipeline.ts"],"names":[],"mappings":";;;AAuDA,wCAUC;AAED,wCAQC;AAED,wCAEC;AAED,gCAEC;AAED,oCAgCC;AArGD,MAAa,kBAAmB,SAAQ,KAAK;IAE3C,YAAY,MAAgB;QAC1B,KAAK,CAAC,6BAA6B,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAPD,gDAOC;AAED,S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AAK,CAAC,CAAC;YACnB,CAAC,CAAC,IAAI,CAAC,WAAqB,CAAC,CAAC;YAC9B,CAAC,CAAC,IAAI,CAAC,GAAe,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAE9D,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { CrudServiceManager, StandardIdRequestDefinition } from 'itrm-tools';
|
|
3
|
-
export type EquationTreatment = 'direct' | 'return';
|
|
4
|
-
export interface IEquationTerm {
|
|
5
|
-
variableAssetId: number;
|
|
6
|
-
beta: number;
|
|
7
|
-
delay: number;
|
|
8
|
-
treatment: EquationTreatment;
|
|
9
|
-
}
|
|
10
|
-
export interface IEquationDetails {
|
|
11
|
-
error?: number;
|
|
12
|
-
method?: string;
|
|
13
|
-
estimatedAt?: number;
|
|
14
|
-
window?: {
|
|
15
|
-
fromDate?: number;
|
|
16
|
-
toDate?: number;
|
|
17
|
-
};
|
|
18
|
-
terms: IEquationTerm[];
|
|
19
|
-
}
|
|
20
|
-
export interface IEquation {
|
|
21
|
-
equationId?: number;
|
|
22
|
-
assetId?: number;
|
|
23
|
-
businessId?: number;
|
|
24
|
-
details?: IEquationDetails;
|
|
25
|
-
updatedAt?: string;
|
|
26
|
-
createdAt?: string;
|
|
27
|
-
config?: AxiosRequestConfig;
|
|
28
|
-
}
|
|
29
|
-
export interface IEquationSearchDetails {
|
|
30
|
-
equationId?: number;
|
|
31
|
-
assetId?: number;
|
|
32
|
-
businessId?: number;
|
|
33
|
-
details?: IEquationDetails;
|
|
34
|
-
limit?: number;
|
|
35
|
-
offset?: number;
|
|
36
|
-
config?: AxiosRequestConfig;
|
|
37
|
-
values?: IEquation[];
|
|
38
|
-
}
|
|
39
|
-
export declare class EquationsManager extends CrudServiceManager<IEquationSearchDetails, IEquation> {
|
|
40
|
-
private url;
|
|
41
|
-
constructor(url: string);
|
|
42
|
-
find(details: IEquationSearchDetails): Promise<IEquation | undefined>;
|
|
43
|
-
findById(id: StandardIdRequestDefinition): Promise<IEquation | undefined>;
|
|
44
|
-
count(details: IEquationSearchDetails): Promise<number>;
|
|
45
|
-
private buildRequestUrl;
|
|
46
|
-
findAll(details: IEquationSearchDetails): Promise<IEquation[] | undefined>;
|
|
47
|
-
create(details: IEquationSearchDetails): Promise<IEquation | undefined>;
|
|
48
|
-
createMany(details: IEquationSearchDetails): Promise<IEquation[] | undefined>;
|
|
49
|
-
modify(equation: IEquation): Promise<any>;
|
|
50
|
-
destroy(equation: IEquation): Promise<any>;
|
|
51
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.EquationsManager = void 0;
|
|
13
|
-
const itrm_tools_1 = require("itrm-tools");
|
|
14
|
-
class EquationsManager extends itrm_tools_1.CrudServiceManager {
|
|
15
|
-
constructor(url) {
|
|
16
|
-
super();
|
|
17
|
-
this.url = url;
|
|
18
|
-
}
|
|
19
|
-
find(details) {
|
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
return this.sendFinding(this.buildRequestUrl(`${this.url}/equations`, details), details.config);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
findById(id) {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
return this.sendFinding(`${this.url}/equations?id=${id.id}`, id.config);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
count(details) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
var _a;
|
|
32
|
-
let url = this.buildRequestUrl(`${this.url}/equations`, details);
|
|
33
|
-
return (_a = (yield this.sendCounting(url, details.config))) !== null && _a !== void 0 ? _a : 0;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
buildRequestUrl(url, details) {
|
|
37
|
-
let suffix = `${details.businessId ? `&businessId=${details.businessId}` : ''}${details.assetId ? `&assetId=${details.assetId}` : ''}${details.equationId ? `&equationId=${details.equationId}` : ''}`;
|
|
38
|
-
return `${url}?${suffix.substring(1)}`;
|
|
39
|
-
}
|
|
40
|
-
findAll(details) {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
var _a;
|
|
43
|
-
let equations = [];
|
|
44
|
-
let url = this.buildRequestUrl(`${this.url}/equations`, details);
|
|
45
|
-
if (details.limit) {
|
|
46
|
-
equations = (_a = (yield this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${details.limit}&offset=${details.offset}`, details.config))) !== null && _a !== void 0 ? _a : [];
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
let limit = 5000, offset = 0, isEmpty = false;
|
|
50
|
-
do {
|
|
51
|
-
let values = yield this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${limit}&offset=${offset}`, details.config);
|
|
52
|
-
if (values)
|
|
53
|
-
equations = equations.concat(values);
|
|
54
|
-
isEmpty = values == undefined || values.length == 0;
|
|
55
|
-
offset += limit;
|
|
56
|
-
} while (!isEmpty);
|
|
57
|
-
}
|
|
58
|
-
return equations;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
create(details) {
|
|
62
|
-
return this.sendCreation(`${this.url}/equations`, {
|
|
63
|
-
assetId: details.assetId,
|
|
64
|
-
businessId: details.businessId,
|
|
65
|
-
details: details.details
|
|
66
|
-
}, details.config);
|
|
67
|
-
}
|
|
68
|
-
createMany(details) {
|
|
69
|
-
var _a;
|
|
70
|
-
return this.sendCreationMany(`${this.url}/equations`, (_a = details.values) !== null && _a !== void 0 ? _a : [], details.config);
|
|
71
|
-
}
|
|
72
|
-
modify(equation) {
|
|
73
|
-
return this.sendModification(`${this.url}/equations/${equation.equationId}`, {
|
|
74
|
-
assetId: equation.assetId,
|
|
75
|
-
businessId: equation.businessId,
|
|
76
|
-
details: equation.details
|
|
77
|
-
}, equation.config);
|
|
78
|
-
}
|
|
79
|
-
destroy(equation) {
|
|
80
|
-
return this.sendDestruction(`${this.url}/equations/${equation.equationId}`, equation.config);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.EquationsManager = EquationsManager;
|
|
84
|
-
//# sourceMappingURL=EquationsManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EquationsManager.js","sourceRoot":"","sources":["../../src/crud/EquationsManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAA6E;AAwC7E,MAAa,gBAAiB,SAAQ,+BAAqD;IAGzF,YAAY,GAAW;QACrB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAEY,IAAI,CAAC,OAA+B;;YAC/C,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,GAAG,YAAY,EAAE,OAAO,CAAC,EAAE,OA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