@pgnio/helios-mcp 0.0.0-stage → 0.2.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/README.md +44 -2
- package/dist/chunk-NWGWXYTS.mjs +2964 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +2946 -0
- package/dist/cli.mjs +24 -0
- package/dist/index.d.mts +2137 -0
- package/dist/index.d.ts +2137 -0
- package/dist/index.js +3021 -0
- package/dist/index.mjs +52 -0
- package/docs/ai-agent-indicators/00_index.txt +210 -0
- package/docs/ai-agent-indicators/activity_ratio.txt +166 -0
- package/docs/ai-agent-indicators/activity_zscore.txt +166 -0
- package/docs/ai-agent-indicators/bayesian_overbought.txt +134 -0
- package/docs/ai-agent-indicators/directional_efficiency.txt +134 -0
- package/docs/ai-agent-indicators/hfi.txt +172 -0
- package/docs/ai-agent-indicators/hfi_weights.txt +124 -0
- package/docs/ai-agent-indicators/hmi.txt +305 -0
- package/docs/ai-agent-indicators/hmi_velocity.txt +155 -0
- package/docs/ai-agent-indicators/hurst_exponent.txt +136 -0
- package/docs/ai-agent-indicators/macd_divergence.txt +133 -0
- package/docs/ai-agent-indicators/macd_histogram.txt +145 -0
- package/docs/ai-agent-indicators/macd_signal.txt +119 -0
- package/docs/ai-agent-indicators/market_structure.txt +201 -0
- package/docs/ai-agent-indicators/poc.txt +131 -0
- package/docs/ai-agent-indicators/poc_distance.txt +129 -0
- package/docs/ai-agent-indicators/regime.txt +225 -0
- package/docs/ai-agent-indicators/rsi_divergence.txt +145 -0
- package/docs/ai-agent-indicators/squeeze_duration.txt +115 -0
- package/docs/ai-agent-indicators/squeeze_energy.txt +128 -0
- package/docs/ai-agent-indicators/support_resistance.txt +169 -0
- package/docs/ai-agent-indicators/tf_alignment.txt +165 -0
- package/docs/ai-agent-indicators/trend_interpretation.txt +98 -0
- package/docs/ai-agent-indicators/trend_strength.txt +134 -0
- package/docs/ai-agent-indicators/value_area_position.txt +142 -0
- package/docs/ai-agent-indicators/volatility_clustering.txt +160 -0
- package/docs/ai-agent-indicators/volatility_squeeze.txt +169 -0
- package/docs/ai-agent-indicators/volume_change_point.txt +151 -0
- package/docs/ai-agent-indicators/vwap.txt +133 -0
- package/docs/ai-agent-indicators/vwap_zscore.txt +154 -0
- package/docs/ai-agent-indicators/weighted_rsi.txt +148 -0
- package/docs/ai-agent-mcp/00_index.txt +110 -0
- package/docs/ai-agent-mcp/01_auth/00_overview.txt +51 -0
- package/docs/ai-agent-mcp/01_auth/01_tools.txt +94 -0
- package/docs/ai-agent-mcp/01_auth/02_data_contracts.txt +38 -0
- package/docs/ai-agent-mcp/01_auth/03_decision_rules.txt +25 -0
- package/docs/ai-agent-mcp/01_auth/04_failures_and_recovery.txt +46 -0
- package/docs/ai-agent-mcp/02_account/00_overview.txt +29 -0
- package/docs/ai-agent-mcp/02_account/01_tools.txt +67 -0
- package/docs/ai-agent-mcp/02_account/02_data_contracts.txt +34 -0
- package/docs/ai-agent-mcp/02_account/03_decision_rules.txt +17 -0
- package/docs/ai-agent-mcp/02_account/04_failures_and_recovery.txt +17 -0
- package/docs/ai-agent-mcp/03_market/00_overview.txt +27 -0
- package/docs/ai-agent-mcp/03_market/01_tools.txt +102 -0
- package/docs/ai-agent-mcp/03_market/02_data_contracts.txt +39 -0
- package/docs/ai-agent-mcp/03_market/03_decision_rules.txt +22 -0
- package/docs/ai-agent-mcp/03_market/04_failures_and_recovery.txt +18 -0
- package/docs/ai-agent-mcp/04_trading/00_overview.txt +25 -0
- package/docs/ai-agent-mcp/04_trading/01_tools.txt +123 -0
- package/docs/ai-agent-mcp/04_trading/02_data_contracts.txt +42 -0
- package/docs/ai-agent-mcp/04_trading/03_decision_rules.txt +30 -0
- package/docs/ai-agent-mcp/04_trading/04_failures_and_recovery.txt +25 -0
- package/docs/ai-agent-mcp/05_ledger/00_overview.txt +31 -0
- package/docs/ai-agent-mcp/05_ledger/01_tools.txt +80 -0
- package/docs/ai-agent-mcp/05_ledger/02_data_contracts.txt +46 -0
- package/docs/ai-agent-mcp/05_ledger/03_decision_rules.txt +44 -0
- package/docs/ai-agent-mcp/05_ledger/04_failures_and_recovery.txt +24 -0
- package/package.json +66 -3
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
INDICATOR: BAYESIAN_OVERBOUGHT — BAYESIAN P(OVERBOUGHT)
|
|
3
|
+
================================================================================
|
|
4
|
+
id: bayesian_overbought
|
|
5
|
+
data_field: indicators.bayesian_overbought
|
|
6
|
+
type: NUMERIC
|
|
7
|
+
range: 0.0 to 1.0
|
|
8
|
+
precision: 3 decimal places
|
|
9
|
+
update_rate: per_tick
|
|
10
|
+
latency_profile: COINCIDENT
|
|
11
|
+
|
|
12
|
+
--------------------------------------------------------------------------------
|
|
13
|
+
CONSTRUCT
|
|
14
|
+
--------------------------------------------------------------------------------
|
|
15
|
+
bayesian_overbought is the Bayesian posterior probability that the current
|
|
16
|
+
weighted RSI reading is at the upper extreme of its recent history.
|
|
17
|
+
|
|
18
|
+
Method: Beta-Binomial with empirical percentile counting
|
|
19
|
+
- Prior: Beta(1, 1) — uniform, no initial knowledge
|
|
20
|
+
- Window: 60 most recent weighted_rsi observations
|
|
21
|
+
- countLower = number of history values ≤ current value
|
|
22
|
+
- P(overbought) = (1 + countLower) / (2 + historyLength)
|
|
23
|
+
(Laplace smoothing prevents 0 or 1 as exact outputs)
|
|
24
|
+
|
|
25
|
+
Edge case: IF fewer than 10 observations are in the history buffer:
|
|
26
|
+
Returns value / 100 (raw weighted_rsi converted to 0-1 scale).
|
|
27
|
+
This is an approximation with no statistical basis.
|
|
28
|
+
|
|
29
|
+
The output contextualizes the current RSI reading against recent history:
|
|
30
|
+
an absolute RSI of 72 may be perfectly normal for a trending asset
|
|
31
|
+
(bayesian = 0.5) or extremely rare (bayesian = 0.95).
|
|
32
|
+
|
|
33
|
+
At exactly 0.5: current RSI is at the median of recent history.
|
|
34
|
+
Above 0.5: current RSI is higher than median recent history.
|
|
35
|
+
Below 0.5: current RSI is lower than median recent history.
|
|
36
|
+
|
|
37
|
+
--------------------------------------------------------------------------------
|
|
38
|
+
RANGE INTERPRETATION
|
|
39
|
+
--------------------------------------------------------------------------------
|
|
40
|
+
value > 0.9
|
|
41
|
+
Extremely overbought in historical context. The current weighted_rsi is
|
|
42
|
+
at the 90th percentile or higher of the last 60 readings. This level of
|
|
43
|
+
RSI has been rare for this asset recently. Associated with short-TF
|
|
44
|
+
momentum exhaustion risk.
|
|
45
|
+
|
|
46
|
+
value > 0.8 AND value <= 0.9
|
|
47
|
+
Overbought. RSI is at the 80th percentile of recent readings. Momentum
|
|
48
|
+
is historically stretched. Not a reversal signal, but upside continuation
|
|
49
|
+
becomes progressively harder to sustain statistically.
|
|
50
|
+
|
|
51
|
+
value >= 0.4 AND value <= 0.6
|
|
52
|
+
Historically normal range. Current RSI is near the median of recent
|
|
53
|
+
observations. No extreme condition present.
|
|
54
|
+
|
|
55
|
+
value < 0.2 AND value >= 0.1
|
|
56
|
+
Oversold. RSI is at the 20th percentile of recent readings. Downside
|
|
57
|
+
momentum is historically stretched.
|
|
58
|
+
|
|
59
|
+
value < 0.1
|
|
60
|
+
Extremely oversold in historical context. Mirror of > 0.9.
|
|
61
|
+
|
|
62
|
+
# Note: values will NOT be exactly 0.0 or 1.0 due to Laplace smoothing.
|
|
63
|
+
|
|
64
|
+
--------------------------------------------------------------------------------
|
|
65
|
+
BOOTSTRAP PERIOD WARNING
|
|
66
|
+
--------------------------------------------------------------------------------
|
|
67
|
+
IF fewer than 10 observations have been seen since the indicator started
|
|
68
|
+
→ Bayesian estimate replaced with value/100.
|
|
69
|
+
Do not use. Wait for >= 10 observations for meaningful output.
|
|
70
|
+
→ You can infer this state from startup or data reset conditions.
|
|
71
|
+
|
|
72
|
+
--------------------------------------------------------------------------------
|
|
73
|
+
INDICATOR RELATIONSHIPS
|
|
74
|
+
--------------------------------------------------------------------------------
|
|
75
|
+
indicators.weighted_rsi | REQUIRED_COMPANION
|
|
76
|
+
bayesian_overbought is computed FROM weighted_rsi.
|
|
77
|
+
Evaluate weighted_rsi first, then frame it with bayesian_overbought.
|
|
78
|
+
They are a pair — neither is sufficient alone.
|
|
79
|
+
|
|
80
|
+
indicators.rsi_divergence | CONTEXT
|
|
81
|
+
IF bayesian_overbought > 0.85 AND rsi_divergence = BEARISH_DIVERGENCE
|
|
82
|
+
→ Overbought by historical standards AND price is making higher highs
|
|
83
|
+
while RSI peaks are lower. Dual overbought condition.
|
|
84
|
+
IF bayesian_overbought < 0.15 AND rsi_divergence = BULLISH_DIVERGENCE
|
|
85
|
+
→ Oversold by historical standards AND price making lower lows while
|
|
86
|
+
RSI troughs are improving. Dual oversold condition.
|
|
87
|
+
|
|
88
|
+
indicators.vwap_zscore | COMPANION
|
|
89
|
+
vwap_zscore measures price deviation from institutional cost basis.
|
|
90
|
+
bayesian_overbought measures RSI percentile (momentum deviation).
|
|
91
|
+
IF bayesian_overbought > 0.88 AND vwap_zscore > 2.0
|
|
92
|
+
→ Momentum AND price are both historically stretched upward simultaneously.
|
|
93
|
+
IF bayesian_overbought < 0.12 AND vwap_zscore < -2.0
|
|
94
|
+
→ Momentum AND price are both historically stretched downward simultaneously.
|
|
95
|
+
|
|
96
|
+
indicators.regime | CONTEXT
|
|
97
|
+
During EXHAUST_UP regime, expect bayesian_overbought to be elevated.
|
|
98
|
+
During CASCADE/PARABOLIC, bayesian_overbought may STAY elevated for many
|
|
99
|
+
ticks. Do not treat sustained elevated bayesian_ob as a reversal trigger
|
|
100
|
+
in trending regimes.
|
|
101
|
+
|
|
102
|
+
--------------------------------------------------------------------------------
|
|
103
|
+
DEPENDENCY ORDER
|
|
104
|
+
--------------------------------------------------------------------------------
|
|
105
|
+
1 If < 10 observations (bootstrap period): discard.
|
|
106
|
+
2 Read weighted_rsi range bucket.
|
|
107
|
+
3 Frame weighted_rsi using bayesian_overbought percentile.
|
|
108
|
+
4 Compound with vwap_zscore and regime for full overbought assessment.
|
|
109
|
+
|
|
110
|
+
--------------------------------------------------------------------------------
|
|
111
|
+
INVALIDATION CONDITIONS
|
|
112
|
+
--------------------------------------------------------------------------------
|
|
113
|
+
IF fewer than 10 observations in history
|
|
114
|
+
→ Not statistically valid. Discard.
|
|
115
|
+
|
|
116
|
+
IF market has undergone a major structural change very recently
|
|
117
|
+
(e.g., a crash/spike that reset price level significantly)
|
|
118
|
+
→ The 60-observation window may contain pre-event RSI values that
|
|
119
|
+
make the current percentile unreliable. Allow 60 ticks for window
|
|
120
|
+
to refresh.
|
|
121
|
+
|
|
122
|
+
--------------------------------------------------------------------------------
|
|
123
|
+
ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
|
|
124
|
+
--------------------------------------------------------------------------------
|
|
125
|
+
IF bayesian_overbought > 0.9 is used alone as a short trigger
|
|
126
|
+
→ INCOMPLETE. High bayesian OB means RSI is historically stretched.
|
|
127
|
+
But in trending markets, this can remain elevated. Require
|
|
128
|
+
confirmation from rsi_divergence or hmi_velocity deceleration
|
|
129
|
+
before inferring a momentum reversal risk.
|
|
130
|
+
|
|
131
|
+
IF bayesian_overbought = 0.5 is interpreted as "neutral market"
|
|
132
|
+
→ INCORRECT SCOPE. bayesian_overbought only describes the RSI reading
|
|
133
|
+
relative to recent RSI history. A value of 0.5 simply means RSI is
|
|
134
|
+
at its recent median — the broader market could be strongly trending.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
INDICATOR: DIRECTIONAL_EFFICIENCY
|
|
3
|
+
================================================================================
|
|
4
|
+
id: directional_efficiency
|
|
5
|
+
data_field: indicators.directional_efficiency
|
|
6
|
+
type: NUMERIC
|
|
7
|
+
range: -1.0 to 1.0
|
|
8
|
+
precision: 3 decimal places
|
|
9
|
+
update_rate: per_tick
|
|
10
|
+
latency_profile: COINCIDENT
|
|
11
|
+
|
|
12
|
+
--------------------------------------------------------------------------------
|
|
13
|
+
CONSTRUCT
|
|
14
|
+
--------------------------------------------------------------------------------
|
|
15
|
+
Directional efficiency is a Kaufman-style efficiency ratio measuring how
|
|
16
|
+
cleanly price is moving in a single direction across all timeframes — as
|
|
17
|
+
opposed to zigzagging back and forth.
|
|
18
|
+
|
|
19
|
+
Formula:
|
|
20
|
+
For each TF, normalize by expected magnitude using TF_NORM divisors:
|
|
21
|
+
1m:1 3m:1.5 5m:2 15m:3.5 30m:5 1h:7 2h:10 4h:13 6h:15 8h:17 12h:19 24h:20
|
|
22
|
+
|
|
23
|
+
netChange = Σ(change[tf] / TF_NORM[tf]) (sum preserves sign)
|
|
24
|
+
totalMovement = Σ(|change[tf]| / TF_NORM[tf]) (sum of absolute values)
|
|
25
|
+
|
|
26
|
+
value = clamp(netChange / totalMovement, -1.0, 1.0)
|
|
27
|
+
|
|
28
|
+
Interpretation:
|
|
29
|
+
If all TFs move in the same direction: netChange = totalMovement → value = +1 or -1
|
|
30
|
+
If TFs perfectly cancel out: netChange = 0 → value = 0
|
|
31
|
+
Most readings fall between -0.7 and +0.7 in practice.
|
|
32
|
+
|
|
33
|
+
Per-cluster sub-breakdowns are also computed (micro, short, medium, macro) using
|
|
34
|
+
the same formula on each cluster's TF subset. These are available for agents
|
|
35
|
+
needing cluster-level efficiency.
|
|
36
|
+
|
|
37
|
+
--------------------------------------------------------------------------------
|
|
38
|
+
RANGE INTERPRETATION
|
|
39
|
+
--------------------------------------------------------------------------------
|
|
40
|
+
value >= 0.7
|
|
41
|
+
Highly efficient upward movement. Timeframes are not cancelling each other
|
|
42
|
+
out — the net directional movement is at least 70% of total movement.
|
|
43
|
+
Low noise, clean trend. Price is moving in one direction with minimal
|
|
44
|
+
countertrend interference.
|
|
45
|
+
|
|
46
|
+
value >= 0.4 AND value < 0.7
|
|
47
|
+
Moderately efficient upward movement. Meaningful net directional movement
|
|
48
|
+
but with some countertrend noise from opposing TFs. A trend is present
|
|
49
|
+
and tradeable but with more chop than pure efficiency readings.
|
|
50
|
+
|
|
51
|
+
value > -0.4 AND value < 0.4
|
|
52
|
+
Choppy / inefficient. The countertrend movement across TFs is nearly as
|
|
53
|
+
large as the directional movement. Net direction is weak or absent. Price
|
|
54
|
+
is not moving cleanly in either direction. Directional trades have reduced
|
|
55
|
+
edge in this state.
|
|
56
|
+
|
|
57
|
+
value > -0.7 AND value <= -0.4
|
|
58
|
+
Moderately efficient downward movement. Mirror of 0.4 to 0.7 upside range.
|
|
59
|
+
|
|
60
|
+
value <= -0.7
|
|
61
|
+
Highly efficient downward movement. Mirror of >= 0.7 upside range. Clean
|
|
62
|
+
sustained downtrend with minimal upside interference.
|
|
63
|
+
|
|
64
|
+
--------------------------------------------------------------------------------
|
|
65
|
+
INDICATOR RELATIONSHIPS
|
|
66
|
+
--------------------------------------------------------------------------------
|
|
67
|
+
indicators.tf_alignment | COMPANION
|
|
68
|
+
tf_alignment measures breadth of alignment with macro.
|
|
69
|
+
directional_efficiency measures cleanliness of net directional movement.
|
|
70
|
+
These are independent — an asset can have high alignment with low efficiency
|
|
71
|
+
(many TFs go same direction but weakly, with noise) or high efficiency with
|
|
72
|
+
moderate alignment (few TFs but very clean).
|
|
73
|
+
|
|
74
|
+
IF tf_alignment >= 70 AND directional_efficiency >= 0.6
|
|
75
|
+
→ Both breadth and cleanliness confirm direction. Strong trending signal.
|
|
76
|
+
|
|
77
|
+
IF tf_alignment >= 70 AND directional_efficiency < 0.3
|
|
78
|
+
→ Broad alignment but noisy movement. Trend is directionless despite
|
|
79
|
+
TF consensus. Could be a chop period within a trending structure.
|
|
80
|
+
|
|
81
|
+
indicators.hmi | CONTEXT
|
|
82
|
+
directional_efficiency provides the quality dimension missing from hmi.
|
|
83
|
+
hmi can be high even with some countertrend noise; efficiency flags that.
|
|
84
|
+
|
|
85
|
+
IF hmi >= 50 AND directional_efficiency <= 0.3
|
|
86
|
+
→ hmi is reading momentum but prices are still moving inefficiently.
|
|
87
|
+
Wait for efficiency to improve before treating hmi as high quality.
|
|
88
|
+
|
|
89
|
+
indicators.regime | CONTEXT
|
|
90
|
+
CASCADE and TREND regimes imply high directional_efficiency.
|
|
91
|
+
SPIKE regimes often show high efficiency in one cluster (micro) but
|
|
92
|
+
low efficiency overall — the per-cluster efficiency breakdowns are
|
|
93
|
+
useful to distinguish spike vs cascade.
|
|
94
|
+
|
|
95
|
+
indicators.hurst_exponent | COMPANION
|
|
96
|
+
hurst_exponent measures persistence (trending vs mean-reverting tendency).
|
|
97
|
+
directional_efficiency measures current net directional movement.
|
|
98
|
+
IF hurst >= 0.6 AND directional_efficiency >= 0.5
|
|
99
|
+
→ Both statistical persistence and current price efficiency confirm
|
|
100
|
+
trending conditions.
|
|
101
|
+
|
|
102
|
+
--------------------------------------------------------------------------------
|
|
103
|
+
DEPENDENCY ORDER
|
|
104
|
+
--------------------------------------------------------------------------------
|
|
105
|
+
1 Regime: in CHOP/CONSOL, efficiency near zero is expected.
|
|
106
|
+
2 Read value and range bucket.
|
|
107
|
+
3 Cross-reference with tf_alignment for breadth vs quality divergence.
|
|
108
|
+
4 Check per-cluster efficiency if spike vs cascade distinction is needed.
|
|
109
|
+
|
|
110
|
+
--------------------------------------------------------------------------------
|
|
111
|
+
INVALIDATION CONDITIONS
|
|
112
|
+
--------------------------------------------------------------------------------
|
|
113
|
+
IF activity_ratio < 0.5
|
|
114
|
+
→ Low-volume TF changes produce unreliable efficiency ratios.
|
|
115
|
+
Discard.
|
|
116
|
+
|
|
117
|
+
IF all TF changes are near zero (totalMovement < 0.01 after normalization)
|
|
118
|
+
→ Division by near-zero is guarded internally but the result (near 0)
|
|
119
|
+
carries no information. Treat as INDETERMINATE.
|
|
120
|
+
|
|
121
|
+
--------------------------------------------------------------------------------
|
|
122
|
+
ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
|
|
123
|
+
--------------------------------------------------------------------------------
|
|
124
|
+
IF directional_efficiency is used as a reversal indicator
|
|
125
|
+
→ INCORRECT USE. Low efficiency means price is moving without clear
|
|
126
|
+
direction — it does NOT predict a reversal. It predicts continued
|
|
127
|
+
choppiness. Reversal signals come from regime and hmi_velocity.
|
|
128
|
+
|
|
129
|
+
IF efficiency is used without checking whether it applies to the full stack
|
|
130
|
+
or a single cluster
|
|
131
|
+
→ CLARIFY: The top-level value is across all 12 TFs. Per-cluster
|
|
132
|
+
(micro, short, medium, macro) efficiency is a separate sub-field.
|
|
133
|
+
A SPIKE_UP will show high micro efficiency but low overall efficiency.
|
|
134
|
+
Make sure you are reading the correct field.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
INDICATOR: HFI — HELIOS FLOW INDEX
|
|
3
|
+
================================================================================
|
|
4
|
+
id: hfi
|
|
5
|
+
data_field: indicators.hfi
|
|
6
|
+
type: NUMERIC
|
|
7
|
+
range: -100.0 to +100.0
|
|
8
|
+
precision: 2 decimal places
|
|
9
|
+
update_rate: per_tick
|
|
10
|
+
latency_profile: COINCIDENT (EWMA smoothed, alpha=0.3)
|
|
11
|
+
|
|
12
|
+
--------------------------------------------------------------------------------
|
|
13
|
+
CONSTRUCT
|
|
14
|
+
--------------------------------------------------------------------------------
|
|
15
|
+
HFI (Helios Flow Index) is a composite derivatives market sentiment indicator
|
|
16
|
+
synthesizing three components: funding rate behavior, open interest dynamics,
|
|
17
|
+
and cumulative volume delta (CVD). Each component's weight is dynamically
|
|
18
|
+
adjusted via Bayesian inverse-variance weighting.
|
|
19
|
+
|
|
20
|
+
COMPONENTS:
|
|
21
|
+
|
|
22
|
+
1. FUNDING COMPONENT
|
|
23
|
+
recent = average funding rate over last 10 candles
|
|
24
|
+
baseline = average funding rate over candles 10-20 back
|
|
25
|
+
std = rolling standard deviation of funding rate changes
|
|
26
|
+
fundingScore = clamp((recent - baseline) / std, -3, 3) × 33.33
|
|
27
|
+
Interpretation: is the funding rate rising or falling vs recent baseline?
|
|
28
|
+
Rising funding = longs paying more premium = long-heavy positioning.
|
|
29
|
+
|
|
30
|
+
2. OI COMPONENT
|
|
31
|
+
recent = average OI over last 5 candles
|
|
32
|
+
baseline = average OI over candles 25-35 back
|
|
33
|
+
oiChanges = sequential OI changes within baseline window
|
|
34
|
+
oiScore = clamp(((recent - baseline) / baseline) / std(oiChanges), -3, 3) × 33.33
|
|
35
|
+
Interpretation: is OI growing or shrinking vs baseline?
|
|
36
|
+
Rising OI with price up = new long positions (conviction).
|
|
37
|
+
Rising OI with price down = new short positions (conviction).
|
|
38
|
+
(OI direction must be combined with price direction for full context.)
|
|
39
|
+
|
|
40
|
+
3. CVD COMPONENT
|
|
41
|
+
volDelta[i] = volBuy[i] - volSell[i] for each of last 20 candles
|
|
42
|
+
cvdSlope = regression slope of volDelta sequence
|
|
43
|
+
meanAbsCVD = mean absolute value of volDelta
|
|
44
|
+
cvdScore = clamp(cvdSlope / meanAbsCVD, -3, 3) × 33.33
|
|
45
|
+
Interpretation: is buying pressure vs selling pressure trending up or down?
|
|
46
|
+
Rising CVD slope = buyers are increasingly dominating vs sellers.
|
|
47
|
+
|
|
48
|
+
BAYESIAN WEIGHT MODULATION:
|
|
49
|
+
Default weights: funding=0.40, OI=0.30, CVD=0.30
|
|
50
|
+
|
|
51
|
+
Each component's weight is adjusted by:
|
|
52
|
+
componentAccuracy ∈ [0, 1] (how stable/consistent recent component signal is)
|
|
53
|
+
adjustedWeight = defaultWeight × (0.5 + componentAccuracy)
|
|
54
|
+
Result maps [0,1] accuracy → [0.5, 1.5] multiplier on the default weight.
|
|
55
|
+
All weights re-normalized to sum=1.0.
|
|
56
|
+
|
|
57
|
+
GRANGER CAUSALITY BOOST for OI:
|
|
58
|
+
5 lagged correlations between OI changes and CVD changes computed.
|
|
59
|
+
IF maxLagCorrelation > 0.2:
|
|
60
|
+
OI weight boosted by × (1 + correlation × 0.5)
|
|
61
|
+
Reasoning: when OI changes are causally leading CVD, OI signal has higher
|
|
62
|
+
predictive value for order flow direction.
|
|
63
|
+
|
|
64
|
+
PRECISION_BLEND = 0.4:
|
|
65
|
+
Final weights = 0.4 × bayesianWeights + 0.6 × defaultWeights
|
|
66
|
+
(Prevents extreme weight concentration; defaults anchored at 40% influence.)
|
|
67
|
+
|
|
68
|
+
FINAL COMPOSITE:
|
|
69
|
+
rawHFI = Σ(componentScore × finalWeight) for funding, OI, CVD
|
|
70
|
+
smoothedHFI = 0.3 × rawHFI + 0.7 × prevSmoothedHFI (EWMA alpha=0.3)
|
|
71
|
+
value = clamp(smoothedHFI, -100, 100)
|
|
72
|
+
|
|
73
|
+
--------------------------------------------------------------------------------
|
|
74
|
+
RANGE INTERPRETATION
|
|
75
|
+
--------------------------------------------------------------------------------
|
|
76
|
+
value >= 40
|
|
77
|
+
Strong positive derivatives flow. Funding is rising, OI is growing, CVD
|
|
78
|
+
is trending upward — positioning and order flow are aligned in a bullish
|
|
79
|
+
direction. The derivatives market is expressing confidence in upside.
|
|
80
|
+
Associated with genuine accumulation phases or momentum breakout conditions.
|
|
81
|
+
|
|
82
|
+
value >= 15 AND value < 40
|
|
83
|
+
Moderate positive derivatives flow. Some combination of positive funding,
|
|
84
|
+
OI, and CVD conditions. Constructive but not extreme. Watch component
|
|
85
|
+
weights (hfi_weights) to understand which component is dominant.
|
|
86
|
+
|
|
87
|
+
value >= -15 AND value < 15
|
|
88
|
+
Neutral derivatives flow. No dominant directional signal from the
|
|
89
|
+
combined funding/OI/CVD stack. Non-committal positioning.
|
|
90
|
+
|
|
91
|
+
value >= -40 AND value < -15
|
|
92
|
+
Moderate negative derivatives flow. Mixed-to-bearish positioning signals
|
|
93
|
+
from the derivatives stack.
|
|
94
|
+
|
|
95
|
+
value < -40
|
|
96
|
+
Strong negative derivatives flow. Funding is falling/negative, OI is
|
|
97
|
+
declining or dominated by shorts, CVD trending downward. The derivatives
|
|
98
|
+
market is expressing confidence in downside.
|
|
99
|
+
|
|
100
|
+
--------------------------------------------------------------------------------
|
|
101
|
+
INDICATOR RELATIONSHIPS
|
|
102
|
+
--------------------------------------------------------------------------------
|
|
103
|
+
indicators.hfi_weights | REQUIRED_COMPANION
|
|
104
|
+
Read hfi_weights alongside hfi. The composite value can be
|
|
105
|
+
misleading if one component is dominant and the others are suppressed.
|
|
106
|
+
IF hfi = 60 AND weights = {funding:0.85, oi:0.10, cvd:0.05}
|
|
107
|
+
→ The HFI value is almost entirely driven by funding. OI and CVD
|
|
108
|
+
are not confirming. Lower confidence than if all weights balanced.
|
|
109
|
+
|
|
110
|
+
indicators.hmi | CROSS_VALIDATE
|
|
111
|
+
HMI operates on price timeframe alignment.
|
|
112
|
+
HFI operates on derivatives positioning signals.
|
|
113
|
+
These are independent domains.
|
|
114
|
+
|
|
115
|
+
IF hmi >= 50 AND hfi >= 30
|
|
116
|
+
→ Price stack and derivatives positioning agree upside. Both confirm.
|
|
117
|
+
IF hmi >= 50 AND hfi < -20
|
|
118
|
+
→ Price trending up but derivatives showing bearish positioning.
|
|
119
|
+
Potential divergence: price may run ahead of positioning, or
|
|
120
|
+
derivatives market is fading the price move (distribution phase).
|
|
121
|
+
IF hmi < -30 AND hfi > 20
|
|
122
|
+
→ Price trending down but positive funding/OI. Could indicate
|
|
123
|
+
shorts are being squeezed even in a downtrend.
|
|
124
|
+
|
|
125
|
+
indicators.regime | CONTEXT
|
|
126
|
+
During REVERSAL regime: if HFI is also turning positive, both confirm
|
|
127
|
+
a potential upside structural shift.
|
|
128
|
+
During EXHAUST_UP: if HFI turns negative, the exhaustion signal is
|
|
129
|
+
being confirmed by derivatives market positioning.
|
|
130
|
+
|
|
131
|
+
indicators.activity_ratio | GATE
|
|
132
|
+
IF activity_ratio < 0.5: funding, OI, and CVD signals are based on low
|
|
133
|
+
volume. Components computed from sparse data are less reliable.
|
|
134
|
+
|
|
135
|
+
--------------------------------------------------------------------------------
|
|
136
|
+
DEPENDENCY ORDER
|
|
137
|
+
--------------------------------------------------------------------------------
|
|
138
|
+
1 Read hfi value (range and direction).
|
|
139
|
+
2 Read hfi_weights to understand which components are dominant.
|
|
140
|
+
3 Cross-validate with hmi direction.
|
|
141
|
+
4 Note divergences between hmi and hfi — price/derivatives separation is a
|
|
142
|
+
meaningful transitional signal.
|
|
143
|
+
5 Activity_ratio gate: low volume degrades CVD component reliability.
|
|
144
|
+
|
|
145
|
+
--------------------------------------------------------------------------------
|
|
146
|
+
INVALIDATION CONDITIONS
|
|
147
|
+
--------------------------------------------------------------------------------
|
|
148
|
+
IF funding rate data is unavailable (Hyperliquid API outage, new listing)
|
|
149
|
+
→ Funding component weight collapses. The other 2 components remain.
|
|
150
|
+
Check hfi_weights.funding for near-zero to detect this.
|
|
151
|
+
|
|
152
|
+
IF activity_ratio < 0.5
|
|
153
|
+
→ CVD computed from low-volume candles is unreliable. CVD component weight
|
|
154
|
+
should be treated with skepticism.
|
|
155
|
+
|
|
156
|
+
IF asset is newly listed (< 24h)
|
|
157
|
+
→ OI baseline (using candles 25-35 back) is not established.
|
|
158
|
+
OI component is in warm-up. Check hfi_weights.oi for near-zero.
|
|
159
|
+
|
|
160
|
+
--------------------------------------------------------------------------------
|
|
161
|
+
ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
|
|
162
|
+
--------------------------------------------------------------------------------
|
|
163
|
+
IF hfi direction is used as a proxy for immediate price direction
|
|
164
|
+
→ INCORRECT SCOPE. HFI measures sentiment in the DERIVATIVES market
|
|
165
|
+
(funding, OI, CVD). Derivatives can lead price, lag price, or diverge
|
|
166
|
+
from it. HFI is a positioning indicator, not a price direction indicator.
|
|
167
|
+
Cross-validate with price-based indicators (hmi, regime).
|
|
168
|
+
|
|
169
|
+
IF hfi_weights are not checked when extreme hfi values are observed
|
|
170
|
+
→ INCOMPLETE. An hfi of 70 driven entirely by one component is
|
|
171
|
+
structurally weaker than one with balanced component weights.
|
|
172
|
+
Weight inspection is mandatory for high-value HFI readings.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
INDICATOR: HFI_WEIGHTS — HFI COMPONENT WEIGHTS
|
|
3
|
+
================================================================================
|
|
4
|
+
id: hfi_weights
|
|
5
|
+
data_field: indicators.hfi_weights
|
|
6
|
+
type: OBJECT (three numeric fields)
|
|
7
|
+
fields: { funding: number, oi: number, cvd: number }
|
|
8
|
+
range: Each field [0.0, 1.0]; all three sum = 1.0
|
|
9
|
+
precision: 3 decimal places per field
|
|
10
|
+
update_rate: per_tick
|
|
11
|
+
latency_profile: COINCIDENT (dynamically updated with HFI computation)
|
|
12
|
+
|
|
13
|
+
--------------------------------------------------------------------------------
|
|
14
|
+
CONSTRUCT
|
|
15
|
+
--------------------------------------------------------------------------------
|
|
16
|
+
hfi_weights exposes the real-time Bayesian component weights used in the HFI
|
|
17
|
+
computation. These weights reflect how much of the current hfi value is driven
|
|
18
|
+
by each of the three data sources.
|
|
19
|
+
|
|
20
|
+
Default starting weights before Bayesian adjustment:
|
|
21
|
+
funding: 0.40
|
|
22
|
+
oi: 0.30
|
|
23
|
+
cvd: 0.30
|
|
24
|
+
|
|
25
|
+
The Bayesian update process (described in hfi.txt) can shift these significantly.
|
|
26
|
+
The PRECISION_BLEND parameter ensures defaults retain 60% influence (preventing
|
|
27
|
+
extreme concentration), so practical ranges:
|
|
28
|
+
funding range: approximately 0.20 to 0.60
|
|
29
|
+
oi range: approximately 0.10 to 0.50
|
|
30
|
+
cvd range: approximately 0.10 to 0.50
|
|
31
|
+
|
|
32
|
+
Granger causality (OI → CVD lead correlation) can boost OI weight specifically
|
|
33
|
+
when OI changes are empirically leading CVD changes.
|
|
34
|
+
|
|
35
|
+
--------------------------------------------------------------------------------
|
|
36
|
+
WEIGHT INTERPRETATION
|
|
37
|
+
--------------------------------------------------------------------------------
|
|
38
|
+
funding > 0.55
|
|
39
|
+
HFI is predominantly driven by funding rate dynamics.
|
|
40
|
+
OI and CVD are contributing minimally. The composite reflects whether
|
|
41
|
+
long/short carry is increasing or decreasing — but is not confirming
|
|
42
|
+
from an OI or CVD perspective.
|
|
43
|
+
|
|
44
|
+
oi > 0.50
|
|
45
|
+
HFI is heavily driven by OI changes. Often co-occurs with high
|
|
46
|
+
Granger causality correlation (OI is successfully leading CVD).
|
|
47
|
+
This configuration is associated with aggressive position-building
|
|
48
|
+
phases where OI expansion is the most reliable signal.
|
|
49
|
+
|
|
50
|
+
cvd > 0.50
|
|
51
|
+
HFI is heavily driven by CVD (cumulative buy-minus-sell volume).
|
|
52
|
+
Funding and OI are contributing less. Pure order flow signal is dominant.
|
|
53
|
+
|
|
54
|
+
Weights balanced (all three within 0.25-0.40)
|
|
55
|
+
All three components are contributing approximately equally.
|
|
56
|
+
This is the healthiest HFI configuration — all derivatives signals
|
|
57
|
+
agree on direction. No single component should be dismissed.
|
|
58
|
+
|
|
59
|
+
Any weight < 0.10
|
|
60
|
+
That component is effectively disabled by Bayesian precision collapse.
|
|
61
|
+
Its recent data has been too noisy/divergent from the others.
|
|
62
|
+
Treat the HFI composite as two-component for the current period.
|
|
63
|
+
|
|
64
|
+
--------------------------------------------------------------------------------
|
|
65
|
+
USE WITH HFI — COMPOUND ASSESSMENT
|
|
66
|
+
--------------------------------------------------------------------------------
|
|
67
|
+
IF hfi >= 40 AND all weights balanced (all between 0.25 and 0.45)
|
|
68
|
+
→ Maximum confidence HFI reading. Funding, OI, and CVD all agree.
|
|
69
|
+
→ Strongest combined derivatives bullish signal.
|
|
70
|
+
|
|
71
|
+
IF hfi >= 40 AND funding > 0.60 AND (oi < 0.15 OR cvd < 0.15)
|
|
72
|
+
→ HFI driven by funding alone. No OI or CVD confirmation.
|
|
73
|
+
→ Funding can rise in short-driven markets too (shorts pay funding if
|
|
74
|
+
perpetual price < spot). Lower confidence in HFI direction.
|
|
75
|
+
|
|
76
|
+
IF hfi is near zero BUT one component weight is dominant
|
|
77
|
+
→ The dominant component is likely showing a clear signal that is being
|
|
78
|
+
cancelled by opposite signals from the other components.
|
|
79
|
+
→ Read the dominant component separately if its specific data is available.
|
|
80
|
+
|
|
81
|
+
IF any weight is near zero
|
|
82
|
+
→ That data source has degraded reliability right now. Proceed as if
|
|
83
|
+
HFI is a two-component indicator for this tick.
|
|
84
|
+
|
|
85
|
+
--------------------------------------------------------------------------------
|
|
86
|
+
INDICATOR RELATIONSHIPS
|
|
87
|
+
--------------------------------------------------------------------------------
|
|
88
|
+
indicators.hfi | REQUIRED_COMPANION
|
|
89
|
+
hfi_weights only has meaning alongside the hfi value.
|
|
90
|
+
Evaluate together — weights without the composite value are context-
|
|
91
|
+
free; composite without weights may be misleading.
|
|
92
|
+
|
|
93
|
+
--------------------------------------------------------------------------------
|
|
94
|
+
DEPENDENCY ORDER
|
|
95
|
+
--------------------------------------------------------------------------------
|
|
96
|
+
1 Read hfi composite value.
|
|
97
|
+
2 Read hfi_weights fields: funding, oi, cvd.
|
|
98
|
+
3 Identify dominant component (highest weight).
|
|
99
|
+
4 Check if any weight < 0.10 (that component is degraded).
|
|
100
|
+
5 Apply balanced/concentrated interpretation.
|
|
101
|
+
|
|
102
|
+
--------------------------------------------------------------------------------
|
|
103
|
+
INVALIDATION CONDITIONS
|
|
104
|
+
--------------------------------------------------------------------------------
|
|
105
|
+
IF sum(funding + oi + cvd) != 1.0 (approximately)
|
|
106
|
+
→ Data integrity issue. Components should always sum to 1.
|
|
107
|
+
|
|
108
|
+
IF all three weights are exactly equal to defaults (funding=0.4, oi=0.3, cvd=0.3)
|
|
109
|
+
→ Bayesian updates have not yet converged (warm-up period). Treat as
|
|
110
|
+
unmodulated defaults. HFI composite is valid but weights carry no
|
|
111
|
+
extra information yet.
|
|
112
|
+
|
|
113
|
+
--------------------------------------------------------------------------------
|
|
114
|
+
ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
|
|
115
|
+
--------------------------------------------------------------------------------
|
|
116
|
+
IF hfi_weights are ignored and hfi value is used directly
|
|
117
|
+
→ INCOMPLETE EVALUATION. A high hfi driven by a single degraded component
|
|
118
|
+
is qualitatively different from a high hfi with balanced weights.
|
|
119
|
+
Inspect weights before drawing conclusions from extreme hfi readings.
|
|
120
|
+
|
|
121
|
+
IF individual weights are used to assess raw data source reliability
|
|
122
|
+
→ PRECISION_BLEND=0.4 means 60% of each final weight always reflects
|
|
123
|
+
the default allocation. No weight perfectly reflects raw Bayesian precision.
|
|
124
|
+
Weights indicate direction of influence, not absolute data reliability.
|