garch 1.2.2 → 1.2.4
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 +6 -3
- package/build/index.cjs +2 -0
- package/build/index.mjs +2 -0
- package/package.json +6 -1
- package/types.d.ts +9 -0
package/README.md
CHANGED
|
@@ -33,7 +33,8 @@ const result = predict(candles, '4h');
|
|
|
33
33
|
// {
|
|
34
34
|
// currentPrice: 97500,
|
|
35
35
|
// sigma: 0.012, // 1.2% per-period volatility
|
|
36
|
-
// move: 1177, // upward expected move (upper - current)
|
|
36
|
+
// move: 1177, // upward expected move (upper - current), in dollars
|
|
37
|
+
// movePercent: 1.21, // upward expected move, in percent (0–100)
|
|
37
38
|
// upperPrice: 98677, // P·exp(+σ) — ceiling
|
|
38
39
|
// lowerPrice: 96337, // P·exp(-σ) — floor
|
|
39
40
|
// modelType: 'egarch',
|
|
@@ -87,7 +88,8 @@ Higher confidence = wider corridor. `sigma` stays the same (it's the model's vol
|
|
|
87
88
|
interface PredictionResult {
|
|
88
89
|
currentPrice: number; // Reference price
|
|
89
90
|
sigma: number; // One-period volatility (decimal, e.g. 0.012 = 1.2%)
|
|
90
|
-
move: number; // Upward price move = upperPrice - currentPrice
|
|
91
|
+
move: number; // Upward price move = upperPrice - currentPrice (dollars)
|
|
92
|
+
movePercent: number; // Upward price move in percent (0–100), e.g. 1.21 = 1.21%
|
|
91
93
|
upperPrice: number; // P · exp(+z·σ)
|
|
92
94
|
lowerPrice: number; // P · exp(-z·σ)
|
|
93
95
|
modelType: 'garch' | 'egarch' | 'gjr-garch' | 'har-rv' | 'novas'; // Auto-selected model
|
|
@@ -108,7 +110,8 @@ const range = predictRange(candles, '4h', 5);
|
|
|
108
110
|
// {
|
|
109
111
|
// currentPrice: 97500,
|
|
110
112
|
// sigma: 0.027, // cumulative ~2.7% over 5 candles
|
|
111
|
-
// move: 2669, // upward expected move
|
|
113
|
+
// move: 2669, // upward expected move, in dollars
|
|
114
|
+
// movePercent: 2.74, // upward expected move, in percent (0–100)
|
|
112
115
|
// upperPrice: 100169, // P·exp(+z·σ)
|
|
113
116
|
// lowerPrice: 94901, // P·exp(-z·σ)
|
|
114
117
|
// modelType: 'egarch',
|
package/build/index.cjs
CHANGED
|
@@ -1793,6 +1793,7 @@ function predict(candles, interval, currentPrice, confidence = 0.6827) {
|
|
|
1793
1793
|
currentPrice,
|
|
1794
1794
|
sigma,
|
|
1795
1795
|
move: upperPrice - currentPrice,
|
|
1796
|
+
movePercent: (upperPrice / currentPrice - 1) * 100,
|
|
1796
1797
|
upperPrice,
|
|
1797
1798
|
lowerPrice,
|
|
1798
1799
|
reliable: checkReliable(fit),
|
|
@@ -1819,6 +1820,7 @@ function predictRange(candles, interval, steps, currentPrice, confidence = 0.682
|
|
|
1819
1820
|
currentPrice,
|
|
1820
1821
|
sigma,
|
|
1821
1822
|
move: upperPrice - currentPrice,
|
|
1823
|
+
movePercent: (upperPrice / currentPrice - 1) * 100,
|
|
1822
1824
|
upperPrice,
|
|
1823
1825
|
lowerPrice,
|
|
1824
1826
|
reliable: checkReliable(fit),
|
package/build/index.mjs
CHANGED
|
@@ -1791,6 +1791,7 @@ function predict(candles, interval, currentPrice, confidence = 0.6827) {
|
|
|
1791
1791
|
currentPrice,
|
|
1792
1792
|
sigma,
|
|
1793
1793
|
move: upperPrice - currentPrice,
|
|
1794
|
+
movePercent: (upperPrice / currentPrice - 1) * 100,
|
|
1794
1795
|
upperPrice,
|
|
1795
1796
|
lowerPrice,
|
|
1796
1797
|
reliable: checkReliable(fit),
|
|
@@ -1817,6 +1818,7 @@ function predictRange(candles, interval, steps, currentPrice, confidence = 0.682
|
|
|
1817
1818
|
currentPrice,
|
|
1818
1819
|
sigma,
|
|
1819
1820
|
move: upperPrice - currentPrice,
|
|
1821
|
+
movePercent: (upperPrice / currentPrice - 1) * 100,
|
|
1820
1822
|
upperPrice,
|
|
1821
1823
|
lowerPrice,
|
|
1822
1824
|
reliable: checkReliable(fit),
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "garch",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "GARCH and EGARCH volatility models for TypeScript",
|
|
5
|
+
"funding": {
|
|
6
|
+
"type": "individual",
|
|
7
|
+
"url": "http://paypal.me/tripolskypetr"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://backtest-kit.github.io/documents/article_07_ai_news_trading_signals.html",
|
|
5
10
|
"type": "module",
|
|
6
11
|
"main": "./build/index.cjs",
|
|
7
12
|
"module": "./build/index.mjs",
|
package/types.d.ts
CHANGED
|
@@ -498,12 +498,21 @@ declare function probit(confidence: number): number;
|
|
|
498
498
|
|
|
499
499
|
type CandleInterval = '1m' | '3m' | '5m' | '15m' | '30m' | '1h' | '2h' | '4h' | '6h' | '8h';
|
|
500
500
|
interface PredictionResult {
|
|
501
|
+
/** Reference price used to compute the corridor (last close or the value passed as `currentPrice`). */
|
|
501
502
|
currentPrice: number;
|
|
503
|
+
/** One-period (or cumulative) volatility estimate, as a decimal log-return standard deviation (e.g. `0.012` = 1.2%). */
|
|
502
504
|
sigma: number;
|
|
505
|
+
/** Upward expected move in price units: `upperPrice - currentPrice`. */
|
|
503
506
|
move: number;
|
|
507
|
+
/** Upward expected move in percent (0–100 scale, e.g. `1.21` means 1.21%). Equal to `(exp(z·σ) - 1) * 100`. */
|
|
508
|
+
movePercent: number;
|
|
509
|
+
/** Upper price band: `currentPrice · exp(+z·σ)`. */
|
|
504
510
|
upperPrice: number;
|
|
511
|
+
/** Lower price band: `currentPrice · exp(-z·σ)`. Always positive. */
|
|
505
512
|
lowerPrice: number;
|
|
513
|
+
/** Volatility model auto-selected by QLIKE. */
|
|
506
514
|
modelType: 'garch' | 'egarch' | 'gjr-garch' | 'har-rv' | 'novas';
|
|
515
|
+
/** `true` when the model converged, persistence < 0.999, and Ljung-Box p-value ≥ 0.05. */
|
|
507
516
|
reliable: boolean;
|
|
508
517
|
}
|
|
509
518
|
/**
|