qntjs-lib 1.0.0 → 1.0.3

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 CHANGED
@@ -1,17 +1,17 @@
1
1
  # qntjs-lib
2
2
 
3
- A compact JavaScript/TypeScript library of numerical helpers and technical-analysis indicators.
3
+ High-performance JavaScript and TypeScript library of technical‑analysis indicators, array utilities, and numerical helpers.
4
4
 
5
- This repository provides a comprehensive set of TA indicators (EMA, TEMA, T3, MFI, KAMA, etc.), vectorized math functions, array utilities, and statistical helpers.
5
+ This repository implements a wide set of TA indicators (EMA, TEMA, T3, MFI, KAMA, etc.), vectorized math functions, and statistical helpers. Implementations are optimized for two common usage patterns:
6
6
 
7
- For best performance, functions operate and return typed arrays like Float64Array.
8
- For convenience, the same functions are also exposed with number[] return types.
7
+ - NaN‑aware workflows (default): functions are NaN‑aware and will skip NaN values where appropriate.
8
+ - Dense fast‑path: when you know inputs contain no NaNs you can opt into a dense, faster implementation by passing `skipna=false` to supported functions.
9
9
 
10
- Most functions skip NaN by default in their calculations.
11
- Some functions accept boolean skipna to skip or not NaN.
12
- When skipna=false is passed to these functions, a fast dense path is executed.
10
+ By default the main (typed) build returns typed arrays (e.g. `Float64Array`) for better numeric performance and predictable memory layout. A companion "untyped" build exposes the same API but returns plain `number[]` values for easier interoperability with plain JavaScript code.
13
11
 
14
- **Quick Start**
12
+ The library has no runtime dependencies and is zero-dependency by design. It can be used in browser web applications or in Node.js environments that support ESM imports.
13
+
14
+ ## Quick Start
15
15
 
16
16
  Install:
17
17
 
@@ -19,23 +19,50 @@ Install:
19
19
  npm install qntjs-lib
20
20
  ```
21
21
 
22
- Basic usage:
22
+ Basic usage (default — typed output):
23
+
24
+ ```js
25
+ import { ta } from 'qntjs-lib';
26
+
27
+ const prices = [1,2,3,4,5,6,7];
28
+ // returns Float64Array by default (typed numeric output)
29
+ const out = ta.ema(prices, 3);
30
+ ```
31
+
32
+ Basic usage (untyped — plain arrays):
23
33
 
24
34
  ```js
25
- import { ta, arr } from 'qntjs-lib';
35
+ import { ta } from 'qntjs-lib/untyped';
26
36
 
27
37
  const prices = [1,2,3,4,5,6,7];
38
+ // returns plain number[] (easier to inspect/serialize)
28
39
  const out = ta.ema(prices, 3);
29
- console.log(out);
30
40
  ```
31
41
 
32
- API highlights
42
+ When to use each:
43
+ - Use the default import (`qntjs-lib`) when you want outputs as `Float64Array` for numeric performance and predictable memory layout.
44
+ - Use `qntjs-lib/untyped` when you prefer plain `number[]` outputs for easier inspection or serialization.
45
+
46
+ ## skipna and dense fast-path
47
+
48
+ Many indicators accept an optional `skipna` boolean (default `true`). Example:
49
+
50
+ ```js
51
+ // NaN-aware (default)
52
+ ta.sma(pricesWithGaps, 5);
53
+
54
+ // Dense fast-path (assume no NaNs)
55
+ ta.sma(densePrices, 5, false);
56
+ ```
57
+
58
+ ## API highlights
33
59
 
34
- - `ta.*` — technical indicators (e.g. `ta.ema`, `ta.t3`, `ta.mfi`, `ta.kama`)
35
- - `arr.*` — array utilities
36
- - `math.*` — math helpers
60
+ - `arr.*` — array utilities: `isna`, `notna`, `fillna`, `ffill`, `bfill`, `replace`, `dropna`, `allna`, `equals`, `countna`, `havena`, `lag`
61
+ - `math.*` — math helpers: `add`, `sub`, `avg`, `mul`, `div`, `scale`, `abs`, `sign`, `round`, `floor`, `ceil`, `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `and`, `or`, `not`, `clamp`, `sum`, `prod`, `min`, `max`, `argmin`, `argmax`, `cumsum`, `cumprod`, `cummax`, `cummin`, `rollsum`, `rollmin`, `rollmax`, `rollminmax`, `rollprod`, `rollargmin`, `rollargmax`, `diff`, `randuniform`, `randnormal`, `dot`, `norm`, `ols`, `olsMulti`
62
+ - `stats.*` — statistical helpers: `mean`, `hmean`, `gmean`, `mad`, `skew`, `kurtosis`, `median`, `quantile`, `percentiles`, `var`, `covar`, `stdev`, `corr`, `zscore`, `norminmax`, `winsorize`, `sample`, `shuffle`, `bootstrap`
63
+ - `ta.*` — technical indicators: `dema`, `ema`, `hma`, `kama`, `sma`, `wma`, `vwma`, `trima`, `t3`, `tema`, `rma`, `ao`, `apo`, `aroon`, `change`, `cmo`, `kst`, `macd`, `mom`, `ppo`, `roc`, `rsi`, `stoch`, `stochrsi`, `ultosc`, `wpr`, `supertrend`, `adx`, `adxr`, `dx`, `cci`, `di`, `dpo`, `ichimoku`, `psar`, `atr`, `tr`, `natr`, `bb`, `bbw`, `donchian`, `keltner`, `adosc`, `obv`, `pnvi`, `wad`, `ad`, `mfi`, `cross`, `crossover`, `crossunder`, `rising`, `falling`
37
64
 
38
- Tests & development
65
+ ## Tests & development
39
66
 
40
67
  Run tests:
41
68
 
@@ -43,18 +70,18 @@ Run tests:
43
70
  npm test
44
71
  ```
45
72
 
46
- Run build (produce distributable artifacts):
73
+ Build (produce distributable artifacts):
47
74
 
48
75
  ```bash
49
76
  npm run build
50
77
  ```
51
78
 
52
- Contributing
79
+ ## Contributing
53
80
 
54
81
  - Open an issue to discuss larger changes.
55
82
  - Run tests and keep coverage high for changes to core algorithms.
56
83
  - Follow the existing style and types in `src/`.
57
84
 
58
- License
85
+ ## License
59
86
 
60
87
  See `LICENSE` in the repo root.
@@ -1571,3 +1571,4 @@ declare namespace index_d {
1571
1571
  }
1572
1572
 
1573
1573
  export { arr_d as arr, index_d$2 as math, index_d as stats, index_d$1 as ta };
1574
+ export type { IchimokuOptions, KstOptions, UltoscOptions };
package/dist/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export * as math from './math/index.js';
2
2
  export * as ta from './ta/index.js';
3
3
  export * as arr from './arr/arr.js';
4
4
  export * as stats from './stats/index.js';
5
+ export type { KstOptions, UltoscOptions, IchimokuOptions } from './ta/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qntjs-lib",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "main": "./dist/bundle/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -36,7 +36,21 @@
36
36
  "type": "git",
37
37
  "url": "git+https://github.com/amahouachi/qntjs-lib.git"
38
38
  },
39
- "keywords": ["technical-analysis","indicators","ta","trading","finance","sma","ema","tema","kama","mfi","typescript","javascript","array-utils"],
39
+ "keywords": [
40
+ "technical-analysis",
41
+ "indicators",
42
+ "ta",
43
+ "trading",
44
+ "finance",
45
+ "sma",
46
+ "ema",
47
+ "tema",
48
+ "kama",
49
+ "mfi",
50
+ "typescript",
51
+ "javascript",
52
+ "array-utils"
53
+ ],
40
54
  "author": "Ahmed MAHOUACHI (https://github.com/amahouachi)",
41
55
  "license": "MIT",
42
56
  "bugs": {