ta-crypto 0.1.4 → 0.1.5

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.
Files changed (3) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +157 -157
  3. package/package.json +55 -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,157 @@
1
- # ta-crypto
2
-
3
- [![npm version](https://img.shields.io/npm/v/ta-crypto.svg)](https://www.npmjs.com/package/ta-crypto)
4
- [![CI](https://github.com/TDamiao/ta-crypto/actions/workflows/ci.yml/badge.svg)](https://github.com/TDamiao/ta-crypto/actions/workflows/ci.yml)
5
-
6
- Technical analysis indicators for crypto markets in Node.js. Inspired by pandas-ta, but focused on crypto use-cases and Node-friendly APIs.
7
-
8
- ## Features
9
-
10
- - Typed, lightweight indicators for OHLCV arrays
11
- - Crypto-specific extras like session VWAP, funding rate helpers, volatility regimes, and orderflow proxies
12
- - Functions return arrays aligned to input length with `null` for insufficient data
13
-
14
- ## Install
15
-
16
- ```bash
17
- npm i ta-crypto
18
- ```
19
-
20
- ## Quick Start
21
-
22
- ```ts
23
- import {
24
- ta,
25
- sma,
26
- rsi,
27
- macd,
28
- bbands,
29
- atr,
30
- vwap,
31
- vwapSession,
32
- realizedVolatility,
33
- fundingRateCumulative,
34
- volatilityRegime,
35
- orderflowImbalance,
36
- obv,
37
- mfi,
38
- stoch,
39
- adx
40
- } from "ta-crypto";
41
-
42
- const close = [101, 102, 99, 105, 110, 108, 111];
43
- const open = [100, 101, 100, 103, 108, 109, 110];
44
- const high = [102, 103, 101, 106, 112, 110, 112];
45
- const low = [ 99, 100, 98, 102, 107, 106, 109];
46
- const volume =[ 10, 12, 11, 15, 17, 14, 18];
47
- const session=[ 1, 1, 1, 2, 2, 2, 3];
48
-
49
- const s = sma(close, 3);
50
- const r = rsi(close, 14);
51
- const m = macd(close);
52
- const b = bbands(close, 20, 2);
53
- const a = atr(high, low, close, 14);
54
- const v = vwap(high, low, close, volume);
55
- const vs = vwapSession(high, low, close, volume, session);
56
- const rv = realizedVolatility(close, 30, 365);
57
- const fr = fundingRateCumulative([0.0001, -0.0002, 0.00005]);
58
- const vr = volatilityRegime(close, 30, 365);
59
- const ofi = orderflowImbalance(open, close, volume, 20);
60
- const o = obv(close, volume);
61
- const moneyFlow = mfi(high, low, close, volume, 14);
62
- const st = stoch(high, low, close, 14, 3);
63
- const dx = adx(high, low, close, 14);
64
-
65
- const s2 = ta.sma(close, 3);
66
- ```
67
-
68
- ## API Conventions
69
-
70
- - Input arrays must be the same length.
71
- - Outputs are aligned to input length.
72
- - `null` marks periods with insufficient data.
73
-
74
- ## Indicators
75
-
76
- Overlap:
77
- - `sma`, `ema`, `rma`, `hl2`, `hlc3`, `ohlc4`, `vwap`, `bbands`
78
-
79
- Momentum:
80
- - `rsi`, `macd`, `stoch`
81
-
82
- Volatility:
83
- - `trueRange`, `atr`, `natr`, `realizedVolatility`
84
-
85
- Performance:
86
- - `logReturn`, `percentReturn`
87
-
88
- Volume:
89
- - `obv`, `mfi`
90
-
91
- Trend:
92
- - `adx`
93
-
94
- Crypto:
95
- - `vwapSession`, `fundingRateCumulative`, `fundingRateAPR`, `volatilityRegime`, `signedVolume`, `volumeDelta`, `orderflowImbalance`
96
-
97
- ## Crypto-Specific Notes
98
-
99
- Session VWAP:
100
- - Provide a `session` array with an id per candle. VWAP resets on each new session id.
101
-
102
- Funding rate:
103
- - `fundingRateCumulative` sums periodic rates over time.
104
- - `fundingRateAPR` annualizes a periodic rate using `periodsPerYear`.
105
-
106
- Volatility regimes:
107
- - `volatilityRegime` computes realized volatility and returns -1, 0, or 1 based on z-score thresholds.
108
-
109
- Orderflow proxies:
110
- - `signedVolume`, `volumeDelta`, and `orderflowImbalance` infer buy/sell pressure from candle direction.
111
-
112
- ## Release
113
-
114
- Automated npm publish runs on tag push. Steps:
115
-
116
- 1. Ensure `NPM_TOKEN` is set in GitHub Actions secrets.
117
- - For GitHub Packages, set `GITHUB_TOKEN` (already provided) or a PAT if needed.
118
- 2. Update changelog (recommended):
119
-
120
- ```bash
121
- npm run changelog
122
- ```
123
-
124
- 3. Bump version (optional):
125
-
126
- ```bash
127
- npm run version:patch
128
- ```
129
-
130
- 4. Run:
131
-
132
- ```bash
133
- npm run release
134
- ```
135
-
136
- Or do everything in one step:
137
-
138
- ```bash
139
- npm run release:patch
140
- ```
141
-
142
- GitHub Packages:
143
- - A separate workflow publishes `@TDamiao/ta-crypto` to GitHub Packages on the same tag.
144
-
145
- This creates and pushes a tag like `v0.1.1`, triggering the release workflow.
146
-
147
- ## License
148
-
149
- MIT
150
-
151
- ## GitHub Packages
152
-
153
- Install from GitHub Packages:
154
-
155
- ```bash
156
- npm i @TDamiao/ta-crypto
157
- ```
1
+ # ta-crypto
2
+
3
+ [![npm version](https://img.shields.io/npm/v/ta-crypto.svg)](https://www.npmjs.com/package/ta-crypto)
4
+ [![CI](https://github.com/TDamiao/ta-crypto/actions/workflows/ci.yml/badge.svg)](https://github.com/TDamiao/ta-crypto/actions/workflows/ci.yml)
5
+
6
+ Technical analysis indicators for crypto markets in Node.js. Inspired by pandas-ta, but focused on crypto use-cases and Node-friendly APIs.
7
+
8
+ ## Features
9
+
10
+ - Typed, lightweight indicators for OHLCV arrays
11
+ - Crypto-specific extras like session VWAP, funding rate helpers, volatility regimes, and orderflow proxies
12
+ - Functions return arrays aligned to input length with `null` for insufficient data
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ npm i ta-crypto
18
+ ```
19
+
20
+ ## Quick Start
21
+
22
+ ```ts
23
+ import {
24
+ ta,
25
+ sma,
26
+ rsi,
27
+ macd,
28
+ bbands,
29
+ atr,
30
+ vwap,
31
+ vwapSession,
32
+ realizedVolatility,
33
+ fundingRateCumulative,
34
+ volatilityRegime,
35
+ orderflowImbalance,
36
+ obv,
37
+ mfi,
38
+ stoch,
39
+ adx
40
+ } from "ta-crypto";
41
+
42
+ const close = [101, 102, 99, 105, 110, 108, 111];
43
+ const open = [100, 101, 100, 103, 108, 109, 110];
44
+ const high = [102, 103, 101, 106, 112, 110, 112];
45
+ const low = [ 99, 100, 98, 102, 107, 106, 109];
46
+ const volume =[ 10, 12, 11, 15, 17, 14, 18];
47
+ const session=[ 1, 1, 1, 2, 2, 2, 3];
48
+
49
+ const s = sma(close, 3);
50
+ const r = rsi(close, 14);
51
+ const m = macd(close);
52
+ const b = bbands(close, 20, 2);
53
+ const a = atr(high, low, close, 14);
54
+ const v = vwap(high, low, close, volume);
55
+ const vs = vwapSession(high, low, close, volume, session);
56
+ const rv = realizedVolatility(close, 30, 365);
57
+ const fr = fundingRateCumulative([0.0001, -0.0002, 0.00005]);
58
+ const vr = volatilityRegime(close, 30, 365);
59
+ const ofi = orderflowImbalance(open, close, volume, 20);
60
+ const o = obv(close, volume);
61
+ const moneyFlow = mfi(high, low, close, volume, 14);
62
+ const st = stoch(high, low, close, 14, 3);
63
+ const dx = adx(high, low, close, 14);
64
+
65
+ const s2 = ta.sma(close, 3);
66
+ ```
67
+
68
+ ## API Conventions
69
+
70
+ - Input arrays must be the same length.
71
+ - Outputs are aligned to input length.
72
+ - `null` marks periods with insufficient data.
73
+
74
+ ## Indicators
75
+
76
+ Overlap:
77
+ - `sma`, `ema`, `rma`, `hl2`, `hlc3`, `ohlc4`, `vwap`, `bbands`
78
+
79
+ Momentum:
80
+ - `rsi`, `macd`, `stoch`
81
+
82
+ Volatility:
83
+ - `trueRange`, `atr`, `natr`, `realizedVolatility`
84
+
85
+ Performance:
86
+ - `logReturn`, `percentReturn`
87
+
88
+ Volume:
89
+ - `obv`, `mfi`
90
+
91
+ Trend:
92
+ - `adx`
93
+
94
+ Crypto:
95
+ - `vwapSession`, `fundingRateCumulative`, `fundingRateAPR`, `volatilityRegime`, `signedVolume`, `volumeDelta`, `orderflowImbalance`
96
+
97
+ ## Crypto-Specific Notes
98
+
99
+ Session VWAP:
100
+ - Provide a `session` array with an id per candle. VWAP resets on each new session id.
101
+
102
+ Funding rate:
103
+ - `fundingRateCumulative` sums periodic rates over time.
104
+ - `fundingRateAPR` annualizes a periodic rate using `periodsPerYear`.
105
+
106
+ Volatility regimes:
107
+ - `volatilityRegime` computes realized volatility and returns -1, 0, or 1 based on z-score thresholds.
108
+
109
+ Orderflow proxies:
110
+ - `signedVolume`, `volumeDelta`, and `orderflowImbalance` infer buy/sell pressure from candle direction.
111
+
112
+ ## Release
113
+
114
+ Automated npm publish runs on tag push. Steps:
115
+
116
+ 1. Ensure `NPM_TOKEN` is set in GitHub Actions secrets.
117
+ - For GitHub Packages, set `GITHUB_TOKEN` (already provided) or a PAT if needed.
118
+ 2. Update changelog (recommended):
119
+
120
+ ```bash
121
+ npm run changelog
122
+ ```
123
+
124
+ 3. Bump version (optional):
125
+
126
+ ```bash
127
+ npm run version:patch
128
+ ```
129
+
130
+ 4. Run:
131
+
132
+ ```bash
133
+ npm run release
134
+ ```
135
+
136
+ Or do everything in one step:
137
+
138
+ ```bash
139
+ npm run release:patch
140
+ ```
141
+
142
+ GitHub Packages:
143
+ - A separate workflow publishes `@TDamiao/ta-crypto` to GitHub Packages on the same tag.
144
+
145
+ This creates and pushes a tag like `v0.1.1`, triggering the release workflow.
146
+
147
+ ## License
148
+
149
+ MIT
150
+
151
+ ## GitHub Packages
152
+
153
+ Install from GitHub Packages:
154
+
155
+ ```bash
156
+ npm i @TDamiao/ta-crypto
157
+ ```
package/package.json CHANGED
@@ -1,55 +1,55 @@
1
- {
2
- "name": "ta-crypto",
3
- "version": "0.1.4",
4
- "description": "Technical analysis for crypto markets in Node.js",
5
- "type": "module",
6
- "license": "MIT",
7
- "author": "",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
12
- }
13
- },
14
- "types": "dist/index.d.ts",
15
- "main": "dist/index.js",
16
- "files": [
17
- "dist",
18
- "README.md",
19
- "LICENSE"
20
- ],
21
- "scripts": {
22
- "build": "tsc -p tsconfig.json",
23
- "clean": "rimraf dist",
24
- "prepublishOnly": "npm run clean && npm run build",
25
- "release": "node ./scripts/release.js",
26
- "release:patch": "npm version patch && npm run release",
27
- "release:minor": "npm version minor && npm run release",
28
- "release:major": "npm version major && npm run release",
29
- "version:patch": "npm version patch",
30
- "version:minor": "npm version minor",
31
- "version:major": "npm version major",
32
- "changelog": "node ./scripts/changelog.js",
33
- "test": "node -e \"console.log('no tests yet')\""
34
- },
35
- "devDependencies": {
36
- "rimraf": "^5.0.5",
37
- "typescript": "^5.4.5"
38
- },
39
- "keywords": [
40
- "crypto",
41
- "bitcoin",
42
- "technical-analysis",
43
- "indicators",
44
- "trading",
45
- "ohlcv"
46
- ],
47
- "repository": {
48
- "type": "git",
49
- "url": "git+https://github.com/TDamiao/ta-crypto.git"
50
- },
51
- "bugs": {
52
- "url": "https://github.com/TDamiao/ta-crypto/issues"
53
- },
54
- "homepage": "https://github.com/TDamiao/ta-crypto#readme"
55
- }
1
+ {
2
+ "name": "ta-crypto",
3
+ "version": "0.1.5",
4
+ "description": "Technical analysis for crypto markets in Node.js",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "types": "dist/index.d.ts",
15
+ "main": "dist/index.js",
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsc -p tsconfig.json",
23
+ "clean": "rimraf dist",
24
+ "prepublishOnly": "npm run clean && npm run build",
25
+ "release": "node ./scripts/release.js",
26
+ "release:patch": "npm version patch && npm run release",
27
+ "release:minor": "npm version minor && npm run release",
28
+ "release:major": "npm version major && npm run release",
29
+ "version:patch": "npm version patch",
30
+ "version:minor": "npm version minor",
31
+ "version:major": "npm version major",
32
+ "changelog": "node ./scripts/changelog.js",
33
+ "test": "node -e \"console.log('no tests yet')\""
34
+ },
35
+ "devDependencies": {
36
+ "rimraf": "^5.0.5",
37
+ "typescript": "^5.4.5"
38
+ },
39
+ "keywords": [
40
+ "crypto",
41
+ "bitcoin",
42
+ "technical-analysis",
43
+ "indicators",
44
+ "trading",
45
+ "ohlcv"
46
+ ],
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/TDamiao/ta-crypto.git"
50
+ },
51
+ "bugs": {
52
+ "url": "https://github.com/TDamiao/ta-crypto/issues"
53
+ },
54
+ "homepage": "https://github.com/TDamiao/ta-crypto#readme"
55
+ }