aiden-shared-calculations-unified 1.0.99 → 1.0.100
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/calculations/core/Insights-total-long-per-stock.js +25 -48
- package/calculations/core/insights-daily-bought-vs-sold-count.js +1 -6
- package/calculations/core/insights-daily-ownership-delta.js +1 -6
- package/calculations/core/insights-sentimet-per-stock.js +2 -7
- package/calculations/core/insights-total-long-per-sector.js +1 -11
- package/calculations/core/insights-total-positions-held.js +1 -4
- package/package.json +1 -1
|
@@ -1,61 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
static getMetadata() {
|
|
12
|
-
return {
|
|
13
|
-
type: 'meta',
|
|
14
|
-
rootDataDependencies: ['insights'],
|
|
15
|
-
isHistorical: false,
|
|
1
|
+
class InsightsTotalPositionsHeld {
|
|
2
|
+
constructor() { this.totalPositions = 0; }
|
|
3
|
+
|
|
4
|
+
static getMetadata() {
|
|
5
|
+
return {
|
|
6
|
+
type: 'meta',
|
|
7
|
+
rootDataDependencies: ['insights'],
|
|
8
|
+
isHistorical: false,
|
|
16
9
|
userType: 'n/a',
|
|
17
|
-
category: '
|
|
18
|
-
};
|
|
10
|
+
category: 'Global-Platform-Metrics'
|
|
11
|
+
};
|
|
19
12
|
}
|
|
20
|
-
|
|
13
|
+
|
|
21
14
|
static getDependencies() { return []; }
|
|
22
|
-
|
|
23
|
-
static getSchema() {
|
|
24
|
-
return {
|
|
25
|
-
"type": "object",
|
|
26
|
-
"properties": {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
"required": ["total_long_exposure_weight", "total_positions_count"]
|
|
31
|
-
};
|
|
15
|
+
|
|
16
|
+
static getSchema() {
|
|
17
|
+
return {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": { "total_positions_count": { "type": "number" } },
|
|
20
|
+
"required": ["total_positions_count"]
|
|
21
|
+
};
|
|
32
22
|
}
|
|
33
|
-
|
|
23
|
+
|
|
34
24
|
process(context) {
|
|
35
25
|
const { insights: insightsHelper } = context.math;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
// FIX: Extract the 'today' array from the wrapper object
|
|
39
|
-
const insights = (rawInsights && Array.isArray(rawInsights.today))
|
|
40
|
-
? rawInsights.today
|
|
41
|
-
: (Array.isArray(rawInsights) ? rawInsights : []);
|
|
26
|
+
const insights = insightsHelper.getInsights(context); // FIXED: Direct call
|
|
42
27
|
|
|
43
28
|
if (insights.length === 0) return;
|
|
44
29
|
|
|
45
30
|
for (const insight of insights) {
|
|
46
|
-
this.totalPositions += insightsHelper.
|
|
31
|
+
this.totalPositions += insightsHelper.getTotalOwners(insight);
|
|
47
32
|
}
|
|
48
33
|
}
|
|
49
|
-
|
|
50
|
-
getResult() {
|
|
51
|
-
|
|
52
|
-
total_positions_count: this.totalPositions
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
reset() {
|
|
57
|
-
this.totalPositions = 0;
|
|
58
|
-
}
|
|
34
|
+
|
|
35
|
+
getResult() { return { total_positions_count: this.totalPositions }; }
|
|
36
|
+
reset() { this.totalPositions = 0; }
|
|
59
37
|
}
|
|
60
|
-
|
|
61
|
-
module.exports = InsightsTotalLongFigures;
|
|
38
|
+
module.exports = InsightsTotalPositionsHeld;
|
|
@@ -28,15 +28,10 @@ class InsightsDailyBoughtVsSoldCount {
|
|
|
28
28
|
|
|
29
29
|
process(context) {
|
|
30
30
|
const { insights: insightsHelper } = context.math;
|
|
31
|
-
const
|
|
31
|
+
const insights = insightsHelper.getInsights(context); // FIXED: Direct call
|
|
32
32
|
const { mappings } = context;
|
|
33
33
|
const tickerMap = mappings.instrumentToTicker || {};
|
|
34
34
|
|
|
35
|
-
// FIX: Extract the 'today' array from the wrapper object
|
|
36
|
-
const insights = (rawInsights && Array.isArray(rawInsights.today))
|
|
37
|
-
? rawInsights.today
|
|
38
|
-
: (Array.isArray(rawInsights) ? rawInsights : []);
|
|
39
|
-
|
|
40
35
|
if (insights.length === 0) return;
|
|
41
36
|
|
|
42
37
|
for (const insight of insights) {
|
|
@@ -28,15 +28,10 @@ class InsightsDailyOwnershipDelta {
|
|
|
28
28
|
|
|
29
29
|
process(context) {
|
|
30
30
|
const { insights: insightsHelper } = context.math;
|
|
31
|
-
const
|
|
31
|
+
const insights = insightsHelper.getInsights(context); // FIXED: Direct call
|
|
32
32
|
const { mappings } = context;
|
|
33
33
|
const tickerMap = mappings.instrumentToTicker || {};
|
|
34
34
|
|
|
35
|
-
// FIX: Extract the 'today' array from the wrapper object
|
|
36
|
-
const insights = (rawInsights && Array.isArray(rawInsights.today))
|
|
37
|
-
? rawInsights.today
|
|
38
|
-
: (Array.isArray(rawInsights) ? rawInsights : []);
|
|
39
|
-
|
|
40
35
|
if (insights.length === 0) return;
|
|
41
36
|
|
|
42
37
|
for (const insight of insights) {
|
|
@@ -28,15 +28,10 @@ class InsightsSentimentPerStock {
|
|
|
28
28
|
|
|
29
29
|
process(context) {
|
|
30
30
|
const { insights: insightsHelper } = context.math;
|
|
31
|
-
const
|
|
31
|
+
const insights = insightsHelper.getInsights(context); // FIXED: Direct call
|
|
32
32
|
const { mappings } = context;
|
|
33
33
|
const tickerMap = mappings.instrumentToTicker || {};
|
|
34
34
|
|
|
35
|
-
// FIX: Extract the 'today' array from the wrapper object
|
|
36
|
-
const insights = (rawInsights && Array.isArray(rawInsights.today))
|
|
37
|
-
? rawInsights.today
|
|
38
|
-
: (Array.isArray(rawInsights) ? rawInsights : []);
|
|
39
|
-
|
|
40
35
|
if (insights.length === 0) return;
|
|
41
36
|
|
|
42
37
|
for (const insight of insights) {
|
|
@@ -59,4 +54,4 @@ class InsightsSentimentPerStock {
|
|
|
59
54
|
async getResult() { return this.results; }
|
|
60
55
|
reset() { this.results = {}; }
|
|
61
56
|
}
|
|
62
|
-
module.exports = InsightsSentimentPerStock;
|
|
57
|
+
module.exports = InsightsSentimentPerStock;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Calculation (Pass 1) for long figures per sector.
|
|
3
|
-
* REFACTORED: Uses INSIGHTS DATA.
|
|
4
|
-
* TYPE: META
|
|
5
|
-
*/
|
|
6
1
|
class InsightsTotalLongPerSector {
|
|
7
2
|
constructor() {
|
|
8
3
|
this.sectorData = new Map();
|
|
@@ -34,15 +29,10 @@ class InsightsTotalLongPerSector {
|
|
|
34
29
|
|
|
35
30
|
process(context) {
|
|
36
31
|
const { insights: insightsHelper } = context.math;
|
|
37
|
-
const
|
|
32
|
+
const insights = insightsHelper.getInsights(context); // FIXED: Direct call
|
|
38
33
|
const { mappings } = context;
|
|
39
34
|
const sectorMap = mappings.instrumentToSector || {};
|
|
40
35
|
|
|
41
|
-
// FIX: Extract the 'today' array from the wrapper object
|
|
42
|
-
const insights = (rawInsights && Array.isArray(rawInsights.today))
|
|
43
|
-
? rawInsights.today
|
|
44
|
-
: (Array.isArray(rawInsights) ? rawInsights : []);
|
|
45
|
-
|
|
46
36
|
if (insights.length === 0) return;
|
|
47
37
|
|
|
48
38
|
for (const insight of insights) {
|
|
@@ -25,10 +25,7 @@ class InsightsTotalPositionsHeld {
|
|
|
25
25
|
const { insights: insightsHelper } = context.math;
|
|
26
26
|
const rawInsights = insightsHelper.getInsights(context);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
const insights = (rawInsights && Array.isArray(rawInsights.today))
|
|
30
|
-
? rawInsights.today
|
|
31
|
-
: (Array.isArray(rawInsights) ? rawInsights : []);
|
|
28
|
+
const insights = insightsHelper.getInsights(context); // FIXED: Direct call
|
|
32
29
|
|
|
33
30
|
if (insights.length === 0) return;
|
|
34
31
|
|