ta-crypto 0.1.5 → 0.3.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/LICENSE +21 -21
- package/README.md +300 -157
- package/dist/api.d.ts +67 -0
- package/dist/api.js +241 -0
- package/dist/candles.d.ts +9 -0
- package/dist/candles.js +98 -0
- package/dist/core/math.d.ts +1 -0
- package/dist/core/math.js +8 -1
- package/dist/core/momentum.js +2 -4
- package/dist/core/trend.js +2 -4
- package/dist/core/volume.js +3 -7
- package/dist/crypto.d.ts +2 -0
- package/dist/crypto.js +2 -0
- package/dist/index.d.ts +70 -39
- package/dist/index.js +9 -21
- package/dist/indicators.d.ts +1 -0
- package/dist/indicators.js +1 -0
- package/dist/stateful.d.ts +15 -0
- package/dist/stateful.js +142 -0
- package/dist/types.d.ts +30 -2
- package/package.json +80 -55
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,157 +1,300 @@
|
|
|
1
|
-
# ta-crypto
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/ta-crypto)
|
|
4
|
-
[](https://github.com/TDamiao/ta-crypto/actions/workflows/ci.yml)
|
|
5
|
-
|
|
6
|
-
Technical analysis indicators for crypto markets in Node.js.
|
|
7
|
-
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
##
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- `
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
|
|
94
|
-
Crypto:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
Session VWAP
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
npm run
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
1
|
+
# ta-crypto
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/ta-crypto)
|
|
4
|
+
[](https://github.com/TDamiao/ta-crypto/actions/workflows/ci.yml)
|
|
5
|
+
|
|
6
|
+
Technical analysis indicators for crypto markets in Node.js.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm i ta-crypto
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { sma, rsi, macd, bbands, atr, vwapSession, toOHLCV } from "ta-crypto";
|
|
18
|
+
|
|
19
|
+
const candles = [
|
|
20
|
+
{ open: 100, high: 102, low: 99, close: 101, volume: 10, time: 1 },
|
|
21
|
+
{ open: 101, high: 103, low: 100, close: 102, volume: 12, time: 2 }
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const { high, low, close, volume } = toOHLCV(candles, 0);
|
|
25
|
+
const s = sma(close, 14);
|
|
26
|
+
const r = rsi(close, 14);
|
|
27
|
+
const m = macd(close);
|
|
28
|
+
const b = bbands(close, 20, 2);
|
|
29
|
+
const a = atr(high, low, close, 14);
|
|
30
|
+
const vs = vwapSession(high, low, close, volume, [1, 1]);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Stateful API (streaming)
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { createSMA, createEMA, createRSI, createVWAPSession } from "ta-crypto";
|
|
37
|
+
|
|
38
|
+
const sma14 = createSMA(14);
|
|
39
|
+
const ema14 = createEMA(14);
|
|
40
|
+
const rsi14 = createRSI(14);
|
|
41
|
+
const nextSma = sma14.next(101.25);
|
|
42
|
+
const nextEma = ema14.next(101.25);
|
|
43
|
+
const nextRsi = rsi14.next(101.25);
|
|
44
|
+
|
|
45
|
+
const vwap = createVWAPSession();
|
|
46
|
+
const nextVwap = vwap.next({
|
|
47
|
+
high: 102,
|
|
48
|
+
low: 99,
|
|
49
|
+
close: 101,
|
|
50
|
+
volume: 10,
|
|
51
|
+
sessionId: "2026-02-10-asia"
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Websocket-like streaming loop:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { createEMA, createRSI } from "ta-crypto";
|
|
59
|
+
|
|
60
|
+
const ema21 = createEMA(21);
|
|
61
|
+
const rsi14 = createRSI(14);
|
|
62
|
+
|
|
63
|
+
ws.on("message", (tick) => {
|
|
64
|
+
const price = Number(tick.last);
|
|
65
|
+
const e = ema21.next(price);
|
|
66
|
+
const r = rsi14.next(price);
|
|
67
|
+
if (e !== null && r !== null) {
|
|
68
|
+
// strategy signal path
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Examples
|
|
74
|
+
|
|
75
|
+
Real-world entry points live in `examples/`:
|
|
76
|
+
- `examples/rsi-strategy.ts`
|
|
77
|
+
- `examples/vwap-session.ts`
|
|
78
|
+
- `examples/funding-arbitrage.ts`
|
|
79
|
+
|
|
80
|
+
If you're using ta-crypto in production or experiments, feel free to add your example here.
|
|
81
|
+
|
|
82
|
+
## Compatibility
|
|
83
|
+
|
|
84
|
+
`ta-crypto` now ships golden tests (`test/fixtures/golden.json`) to lock behavior across releases.
|
|
85
|
+
|
|
86
|
+
Classic indicators:
|
|
87
|
+
|
|
88
|
+
| Indicator | Reference | Tolerance |
|
|
89
|
+
| --- | --- | --- |
|
|
90
|
+
| SMA, EMA, RSI | Golden baseline | 1e-10 |
|
|
91
|
+
| MACD, BBANDS | Golden baseline | 1e-10 |
|
|
92
|
+
| ATR, ADX | Golden baseline | 1e-10 |
|
|
93
|
+
|
|
94
|
+
Crypto indicators:
|
|
95
|
+
|
|
96
|
+
| Indicator | Reference | Tolerance |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| VWAP Session | Golden baseline | 1e-10 |
|
|
99
|
+
| Stateful VWAP Session parity | Batch VWAP Session | 1e-10 |
|
|
100
|
+
|
|
101
|
+
Streaming parity:
|
|
102
|
+
|
|
103
|
+
| Indicator | Reference | Tolerance |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
| Stateful RSI(14) | Batch RSI(14) | 1e-10 |
|
|
106
|
+
|
|
107
|
+
External parity:
|
|
108
|
+
|
|
109
|
+
Policy source: `scripts/compat-policy.json`
|
|
110
|
+
|
|
111
|
+
| Indicator | Burn-in | Tolerance | Blocking refs | Non-blocking refs |
|
|
112
|
+
| --- | --- | --- | --- | --- |
|
|
113
|
+
| SMA(14) | 14 | 1e-10 | TA-Lib, technicalindicators | pandas-ta |
|
|
114
|
+
| EMA(14) | 14 | 1e-10 | TA-Lib, technicalindicators | pandas-ta |
|
|
115
|
+
| RSI(14) | 28 | 5e-2 | TA-Lib, technicalindicators | pandas-ta |
|
|
116
|
+
| MACD(12,26,9) | 80 | 2e-2 | TA-Lib, technicalindicators | pandas-ta |
|
|
117
|
+
| BBANDS(20,2) | 20 | 1e-10 | TA-Lib, technicalindicators | pandas-ta |
|
|
118
|
+
| ATR(14) | 56 | 1.5e-1 | TA-Lib, technicalindicators | pandas-ta |
|
|
119
|
+
| ADX/+DI/-DI(14) | 90 | 1.5 | TA-Lib, technicalindicators | pandas-ta |
|
|
120
|
+
|
|
121
|
+
Warmup and alignment rules:
|
|
122
|
+
- References are left-padded to full series length before comparison.
|
|
123
|
+
- Comparison starts at indicator-specific burn-in and uses only overlapping non-null points.
|
|
124
|
+
- `TA-Lib` and `technicalindicators` are release-blocking checks in CI.
|
|
125
|
+
- `pandas-ta` is telemetry-only (warns when divergent or unavailable by environment).
|
|
126
|
+
|
|
127
|
+
Generate/review vectors:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm run generate:golden
|
|
131
|
+
npm run test:golden
|
|
132
|
+
npm run generate:compat
|
|
133
|
+
npm run test:compat:technicalindicators
|
|
134
|
+
# python deps: pip install -r scripts/requirements-compat.txt
|
|
135
|
+
npm run test:compat:python
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Note:
|
|
139
|
+
- CI uses Linux + Python 3.12 for full TA-Lib/pandas-ta coverage.
|
|
140
|
+
- On Windows, `pandas-ta` may be unavailable depending on upstream wheels; the script reports explicit skip in that case.
|
|
141
|
+
- `TA-Lib` and `technicalindicators` are strict release gates; `pandas-ta` runs as compatibility telemetry and reports warnings when it diverges by environment.
|
|
142
|
+
|
|
143
|
+
## Crypto Playbooks
|
|
144
|
+
|
|
145
|
+
Session VWAP reset:
|
|
146
|
+
- Provide one `sessionId` per candle.
|
|
147
|
+
- VWAP resets exactly when `sessionId` changes.
|
|
148
|
+
- Use exchange session boundaries (UTC day, funding window, or custom market session).
|
|
149
|
+
|
|
150
|
+
Funding APR:
|
|
151
|
+
- `fundingRateAPR(values, periodsPerYear)` annualizes periodic funding.
|
|
152
|
+
- `periodsPerYear` presets:
|
|
153
|
+
- `3/day` funding: `1095`
|
|
154
|
+
- `1/hour` funding: `8760`
|
|
155
|
+
- `1/8h` funding: `1095`
|
|
156
|
+
|
|
157
|
+
Volatility regime:
|
|
158
|
+
- `volatilityRegime(values, length, periodsPerYear, lowZ, highZ)` returns `-1`, `0`, `1`.
|
|
159
|
+
- Default thresholds: `lowZ = -0.5`, `highZ = 0.5`.
|
|
160
|
+
- Calibration approach: increase absolute thresholds for noisier low-timeframe pairs, reduce for smoother higher timeframes.
|
|
161
|
+
|
|
162
|
+
## Indicators
|
|
163
|
+
|
|
164
|
+
Overlap:
|
|
165
|
+
- `sma`, `ema`, `rma`, `hl2`, `hlc3`, `ohlc4`, `vwap`, `bbands`
|
|
166
|
+
|
|
167
|
+
Momentum:
|
|
168
|
+
- `rsi`, `macd`, `stoch`
|
|
169
|
+
|
|
170
|
+
Volatility:
|
|
171
|
+
- `trueRange`, `atr`, `natr`, `realizedVolatility`
|
|
172
|
+
|
|
173
|
+
Performance:
|
|
174
|
+
- `logReturn`, `percentReturn`
|
|
175
|
+
|
|
176
|
+
Volume:
|
|
177
|
+
- `obv`, `mfi`
|
|
178
|
+
|
|
179
|
+
Trend:
|
|
180
|
+
- `adx`
|
|
181
|
+
|
|
182
|
+
Crypto:
|
|
183
|
+
- `vwapSession`, `fundingRateCumulative`, `fundingRateAPR`, `volatilityRegime`, `signedVolume`, `volumeDelta`, `orderflowImbalance`
|
|
184
|
+
|
|
185
|
+
## Hero Features (crypto edge)
|
|
186
|
+
|
|
187
|
+
1. Session-aware VWAP (`vwapSession`, `createVWAPSession`)
|
|
188
|
+
2. Funding analytics (`fundingRateCumulative`, `fundingRateAPR`)
|
|
189
|
+
3. Volatility regime labeling (`volatilityRegime`)
|
|
190
|
+
4. Orderflow proxies (`signedVolume`, `volumeDelta`, `orderflowImbalance`)
|
|
191
|
+
5. Streaming/stateful indicators for low-allocation pipelines
|
|
192
|
+
|
|
193
|
+
Limitations:
|
|
194
|
+
- Orderflow proxies infer pressure from candle direction and volume; they are not a replacement for L2/L3 order book data.
|
|
195
|
+
- Different libraries use different warmup conventions; comparisons use overlapping non-null windows.
|
|
196
|
+
|
|
197
|
+
## Typing and Inputs
|
|
198
|
+
|
|
199
|
+
`ta-crypto` public APIs accept two input styles:
|
|
200
|
+
- Primitive arrays (`number[]`) for low-level control.
|
|
201
|
+
- Candle objects with long keys (`open/high/low/close/volume/time`) or aliases (`o/h/l/c/v/t`).
|
|
202
|
+
|
|
203
|
+
Single-series APIs (for example `sma`, `ema`, `rsi`, `macd`, `bbands`) accept:
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
import { rsi } from "ta-crypto";
|
|
207
|
+
|
|
208
|
+
const close = [101, 102, 103, 104];
|
|
209
|
+
const candles = [{ o: 100, h: 102, l: 99, c: 101, v: 10, t: 1 }];
|
|
210
|
+
|
|
211
|
+
rsi(close, 14);
|
|
212
|
+
rsi(candles, 14); // uses candle close/c
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
OHLC/OHLCV APIs (for example `vwap`, `stoch`, `atr`, `natr`, `mfi`, `adx`) accept:
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
import { atr, vwap } from "ta-crypto";
|
|
219
|
+
|
|
220
|
+
atr([102, 103], [99, 100], [101, 102], 14);
|
|
221
|
+
atr([{ open: 100, high: 102, low: 99, close: 101, volume: 10 }], 14);
|
|
222
|
+
|
|
223
|
+
vwap([102, 103], [99, 100], [101, 102], [10, 12]);
|
|
224
|
+
vwap([{ o: 100, h: 102, l: 99, c: 101, v: 10 }]);
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Helpers:
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
import { pluckClose, toOHLCV } from "ta-crypto";
|
|
231
|
+
|
|
232
|
+
const close = pluckClose(candles);
|
|
233
|
+
const ohlcv = toOHLCV(candles, 0);
|
|
234
|
+
const ohlcvFromArrays = toOHLCV({ o: [1, 2], h: [3, 4], l: [0, 1], c: [2, 3], v: [5, 6] });
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Validation:
|
|
238
|
+
- Multi-series APIs enforce equal lengths.
|
|
239
|
+
- Numeric inputs are validated as finite numbers with index-aware messages when possible.
|
|
240
|
+
|
|
241
|
+
## Module Imports
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
import { sma } from "ta-crypto/indicators";
|
|
245
|
+
import { vwapSession } from "ta-crypto/crypto";
|
|
246
|
+
import { toOHLCV } from "ta-crypto/candles";
|
|
247
|
+
import { createSMA, createEMA, createRSI } from "ta-crypto/stateful";
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Bench (internal baseline, 10k candles)
|
|
251
|
+
|
|
252
|
+
```text
|
|
253
|
+
sma(14): 0.619 ms/run
|
|
254
|
+
ema(14): 0.549 ms/run
|
|
255
|
+
rsi(14): 0.647 ms/run
|
|
256
|
+
macd: 2.887 ms/run
|
|
257
|
+
bbands: 2.159 ms/run
|
|
258
|
+
atr(14): 1.356 ms/run
|
|
259
|
+
adx(14): 5.371 ms/run
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Run locally:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
npm run bench
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Contributing
|
|
269
|
+
|
|
270
|
+
ta-crypto is open to contributors.
|
|
271
|
+
If you use it, improve it.
|
|
272
|
+
If you miss something, build it.
|
|
273
|
+
If you're learning, this is a great codebase to practice financial math.
|
|
274
|
+
|
|
275
|
+
Start with `CONTRIBUTING.md` and `ROADMAP.md`.
|
|
276
|
+
If you want to contribute but don't know where to start, pick an indicator from the roadmap and add tests comparing with TA-Lib.
|
|
277
|
+
|
|
278
|
+
## Release
|
|
279
|
+
|
|
280
|
+
Publications are gated by GitHub Actions:
|
|
281
|
+
- `CI` runs build/tests + compatibility checks.
|
|
282
|
+
- `Release` workflows run tests/compat again before publish.
|
|
283
|
+
|
|
284
|
+
Recommended with GitHub CLI:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
gh auth login
|
|
288
|
+
gh workflow run ci.yml
|
|
289
|
+
gh run list --workflow ci.yml --limit 1
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
npm run changelog
|
|
294
|
+
npm run version:patch
|
|
295
|
+
npm run release
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## License
|
|
299
|
+
|
|
300
|
+
MIT
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Candle, OHLCVInput, PriceInput } from "./types.js";
|
|
2
|
+
type OHLCInput = Candle[] | OHLCVInput;
|
|
3
|
+
export declare function sma(input: PriceInput, length?: number): Array<number | null>;
|
|
4
|
+
export declare function ema(input: PriceInput, length?: number): Array<number | null>;
|
|
5
|
+
export declare function rma(input: PriceInput, length?: number): Array<number | null>;
|
|
6
|
+
export declare function bbands(input: PriceInput, length?: number, std?: number): {
|
|
7
|
+
basis: (number | null)[];
|
|
8
|
+
upper: (number | null)[];
|
|
9
|
+
lower: (number | null)[];
|
|
10
|
+
};
|
|
11
|
+
export declare function macd(input: PriceInput, fast?: number, slow?: number, signal?: number): {
|
|
12
|
+
macd: (number | null)[];
|
|
13
|
+
signal: (number | null)[];
|
|
14
|
+
histogram: (number | null)[];
|
|
15
|
+
};
|
|
16
|
+
export declare function rsi(input: PriceInput, length?: number): Array<number | null>;
|
|
17
|
+
export declare function logReturn(input: PriceInput, cumulative?: boolean): Array<number | null>;
|
|
18
|
+
export declare function percentReturn(input: PriceInput, cumulative?: boolean): Array<number | null>;
|
|
19
|
+
export declare function realizedVolatility(input: PriceInput, length?: number, periodsPerYear?: number): Array<number | null>;
|
|
20
|
+
export declare function hl2(high: number[], low: number[]): Array<number | null>;
|
|
21
|
+
export declare function hl2(input: OHLCInput): Array<number | null>;
|
|
22
|
+
export declare function hlc3(high: number[], low: number[], close: number[]): Array<number | null>;
|
|
23
|
+
export declare function hlc3(input: OHLCInput): Array<number | null>;
|
|
24
|
+
export declare function ohlc4(open: number[], high: number[], low: number[], close: number[]): Array<number | null>;
|
|
25
|
+
export declare function ohlc4(input: OHLCInput): Array<number | null>;
|
|
26
|
+
export declare function vwap(high: number[], low: number[], close: number[], volume: number[], length?: number): Array<number | null>;
|
|
27
|
+
export declare function vwap(input: OHLCInput, length?: number): Array<number | null>;
|
|
28
|
+
export declare function stoch(high: number[], low: number[], close: number[], kLength?: number, dLength?: number): {
|
|
29
|
+
k: Array<number | null>;
|
|
30
|
+
d: Array<number | null>;
|
|
31
|
+
};
|
|
32
|
+
export declare function stoch(input: OHLCInput, kLength?: number, dLength?: number): {
|
|
33
|
+
k: Array<number | null>;
|
|
34
|
+
d: Array<number | null>;
|
|
35
|
+
};
|
|
36
|
+
export declare function trueRange(high: number[], low: number[], close: number[]): Array<number | null>;
|
|
37
|
+
export declare function trueRange(input: OHLCInput): Array<number | null>;
|
|
38
|
+
export declare function atr(high: number[], low: number[], close: number[], length?: number): Array<number | null>;
|
|
39
|
+
export declare function atr(input: OHLCInput, length?: number): Array<number | null>;
|
|
40
|
+
export declare function natr(high: number[], low: number[], close: number[], length?: number): Array<number | null>;
|
|
41
|
+
export declare function natr(input: OHLCInput, length?: number): Array<number | null>;
|
|
42
|
+
export declare function obv(close: number[], volume: number[]): Array<number | null>;
|
|
43
|
+
export declare function obv(input: OHLCInput): Array<number | null>;
|
|
44
|
+
export declare function mfi(high: number[], low: number[], close: number[], volume: number[], length?: number): Array<number | null>;
|
|
45
|
+
export declare function mfi(input: OHLCInput, length?: number): Array<number | null>;
|
|
46
|
+
export declare function adx(high: number[], low: number[], close: number[], length?: number): {
|
|
47
|
+
adx: Array<number | null>;
|
|
48
|
+
plusDI: Array<number | null>;
|
|
49
|
+
minusDI: Array<number | null>;
|
|
50
|
+
};
|
|
51
|
+
export declare function adx(input: OHLCInput, length?: number): {
|
|
52
|
+
adx: Array<number | null>;
|
|
53
|
+
plusDI: Array<number | null>;
|
|
54
|
+
minusDI: Array<number | null>;
|
|
55
|
+
};
|
|
56
|
+
export declare function vwapSession(high: number[], low: number[], close: number[], volume: number[], session: Array<string | number>): Array<number | null>;
|
|
57
|
+
export declare function vwapSession(input: OHLCInput, session: Array<string | number>): Array<number | null>;
|
|
58
|
+
export declare function signedVolume(open: number[], close: number[], volume: number[]): Array<number | null>;
|
|
59
|
+
export declare function signedVolume(input: OHLCInput): Array<number | null>;
|
|
60
|
+
export declare function volumeDelta(open: number[], close: number[], volume: number[], length?: number): Array<number | null>;
|
|
61
|
+
export declare function volumeDelta(input: OHLCInput, length?: number): Array<number | null>;
|
|
62
|
+
export declare function orderflowImbalance(open: number[], close: number[], volume: number[], length?: number): Array<number | null>;
|
|
63
|
+
export declare function orderflowImbalance(input: OHLCInput, length?: number): Array<number | null>;
|
|
64
|
+
export declare function fundingRateCumulative(values: number[]): Array<number | null>;
|
|
65
|
+
export declare function fundingRateAPR(values: number[], periodsPerYear?: number): Array<number | null>;
|
|
66
|
+
export declare function volatilityRegime(input: PriceInput, length?: number, periodsPerYear?: number, lowZ?: number, highZ?: number): Array<number | null>;
|
|
67
|
+
export {};
|