wickra 0.1.2
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 +45 -0
- package/index.js +50 -0
- package/npm/darwin-arm64/package.json +24 -0
- package/npm/darwin-arm64/wickra.darwin-arm64.node +0 -0
- package/npm/darwin-x64/package.json +24 -0
- package/npm/darwin-x64/wickra.darwin-x64.node +0 -0
- package/npm/linux-x64-gnu/package.json +27 -0
- package/npm/linux-x64-gnu/wickra.linux-x64-gnu.node +0 -0
- package/npm/win32-x64-msvc/package.json +24 -0
- package/npm/win32-x64-msvc/wickra.win32-x64-msvc.node +0 -0
- package/package.json +64 -0
- package/wickra.darwin-arm64.node +0 -0
- package/wickra.darwin-x64.node +0 -0
- package/wickra.linux-x64-gnu.node +0 -0
- package/wickra.win32-x64-msvc.node +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @wickra/wickra
|
|
2
|
+
|
|
3
|
+
Node.js bindings for the Wickra streaming-first technical indicators library.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Once published, install per platform via the precompiled native package:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @wickra/wickra
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Build from source
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cd bindings/node
|
|
17
|
+
npm install
|
|
18
|
+
npm run build
|
|
19
|
+
npm test
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The native module is built via [napi-rs](https://napi.rs/). The build script
|
|
23
|
+
produces a `wickra.<platform>-<arch>.node` binary in the package root that
|
|
24
|
+
`index.js` loads at runtime.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import { SMA, RSI, MACD, version } from '@wickra/wickra';
|
|
30
|
+
|
|
31
|
+
console.log('wickra', version());
|
|
32
|
+
|
|
33
|
+
// Batch:
|
|
34
|
+
const prices = Array.from({ length: 1000 }, (_, i) => 100 + Math.sin(i * 0.1) * 5);
|
|
35
|
+
const rsi = new RSI(14).batch(prices);
|
|
36
|
+
|
|
37
|
+
// Streaming:
|
|
38
|
+
const macd = new MACD(12, 26, 9);
|
|
39
|
+
for (const p of livePriceStream) {
|
|
40
|
+
const v = macd.update(p);
|
|
41
|
+
if (v && v.histogram > 0) console.log('bullish crossover candidate');
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
See `index.d.ts` for the full TypeScript surface.
|
package/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
// Platform-aware loader for the Wickra Node native binding.
|
|
4
|
+
//
|
|
5
|
+
// In production (after `npm install wickra`) the actual `.node` binary
|
|
6
|
+
// lives inside a per-platform subpackage that npm installs as an
|
|
7
|
+
// optional dependency — e.g. `wickra-linux-x64-gnu`. In development
|
|
8
|
+
// (after `napi build --platform`) the binary sits next to this file.
|
|
9
|
+
// We try the local path first and fall back to the subpackage so the
|
|
10
|
+
// same loader works in both modes.
|
|
11
|
+
|
|
12
|
+
const { platform, arch } = process;
|
|
13
|
+
const { join } = require('node:path');
|
|
14
|
+
const { existsSync } = require('node:fs');
|
|
15
|
+
|
|
16
|
+
const TARGETS = {
|
|
17
|
+
'linux-x64': 'linux-x64-gnu',
|
|
18
|
+
'darwin-x64': 'darwin-x64',
|
|
19
|
+
'darwin-arm64': 'darwin-arm64',
|
|
20
|
+
'win32-x64': 'win32-x64-msvc',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function load() {
|
|
24
|
+
const key = `${platform}-${arch}`;
|
|
25
|
+
const target = TARGETS[key];
|
|
26
|
+
if (!target) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
`wickra: this platform/architecture combination is not supported (${key}). ` +
|
|
29
|
+
'Open an issue at https://github.com/kingchenc/wickra/issues with your platform details.'
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const localBinary = join(__dirname, `wickra.${target}.node`);
|
|
34
|
+
if (existsSync(localBinary)) {
|
|
35
|
+
return require(localBinary);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
return require(`wickra-${target}`);
|
|
40
|
+
} catch (err) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`wickra: failed to load the native binding for ${key}. ` +
|
|
43
|
+
`Expected either ${localBinary} or the wickra-${target} package to be installed. ` +
|
|
44
|
+
`Run \`npm install\` again, or build from source with \`npm run build\`. ` +
|
|
45
|
+
`Underlying error: ${err.message}`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = load();
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wickra-darwin-arm64",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Native binding for wickra (macOS Apple Silicon). Installed automatically as an optional dependency of wickra on matching platforms.",
|
|
5
|
+
"main": "wickra.darwin-arm64.node",
|
|
6
|
+
"files": [
|
|
7
|
+
"wickra.darwin-arm64.node"
|
|
8
|
+
],
|
|
9
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">= 16"
|
|
12
|
+
},
|
|
13
|
+
"os": [
|
|
14
|
+
"darwin"
|
|
15
|
+
],
|
|
16
|
+
"cpu": [
|
|
17
|
+
"arm64"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/kingchenc/wickra"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/kingchenc/wickra"
|
|
24
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wickra-darwin-x64",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Native binding for wickra (macOS Intel). Installed automatically as an optional dependency of wickra on matching platforms.",
|
|
5
|
+
"main": "wickra.darwin-x64.node",
|
|
6
|
+
"files": [
|
|
7
|
+
"wickra.darwin-x64.node"
|
|
8
|
+
],
|
|
9
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">= 16"
|
|
12
|
+
},
|
|
13
|
+
"os": [
|
|
14
|
+
"darwin"
|
|
15
|
+
],
|
|
16
|
+
"cpu": [
|
|
17
|
+
"x64"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/kingchenc/wickra"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/kingchenc/wickra"
|
|
24
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wickra-linux-x64-gnu",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Native binding for wickra (linux x64 GNU). Installed automatically as an optional dependency of wickra on matching platforms.",
|
|
5
|
+
"main": "wickra.linux-x64-gnu.node",
|
|
6
|
+
"files": [
|
|
7
|
+
"wickra.linux-x64-gnu.node"
|
|
8
|
+
],
|
|
9
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">= 16"
|
|
12
|
+
},
|
|
13
|
+
"os": [
|
|
14
|
+
"linux"
|
|
15
|
+
],
|
|
16
|
+
"cpu": [
|
|
17
|
+
"x64"
|
|
18
|
+
],
|
|
19
|
+
"libc": [
|
|
20
|
+
"glibc"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/kingchenc/wickra"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/kingchenc/wickra"
|
|
27
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wickra-win32-x64-msvc",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Native binding for wickra (Windows x64 MSVC). Installed automatically as an optional dependency of wickra on matching platforms.",
|
|
5
|
+
"main": "wickra.win32-x64-msvc.node",
|
|
6
|
+
"files": [
|
|
7
|
+
"wickra.win32-x64-msvc.node"
|
|
8
|
+
],
|
|
9
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">= 16"
|
|
12
|
+
},
|
|
13
|
+
"os": [
|
|
14
|
+
"win32"
|
|
15
|
+
],
|
|
16
|
+
"cpu": [
|
|
17
|
+
"x64"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/kingchenc/wickra"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/kingchenc/wickra"
|
|
24
|
+
}
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wickra",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Streaming-first technical indicators: incremental, fast, install-free. Node bindings powered by Rust.",
|
|
5
|
+
"author": "kingchenc <kingchencp@gmail.com>",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"trading",
|
|
11
|
+
"indicators",
|
|
12
|
+
"technical-analysis",
|
|
13
|
+
"ta-lib",
|
|
14
|
+
"finance",
|
|
15
|
+
"streaming",
|
|
16
|
+
"rust"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/kingchenc/wickra"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/kingchenc/wickra/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/kingchenc/wickra",
|
|
26
|
+
"files": [
|
|
27
|
+
"index.js",
|
|
28
|
+
"index.d.ts",
|
|
29
|
+
"npm",
|
|
30
|
+
"*.node"
|
|
31
|
+
],
|
|
32
|
+
"napi": {
|
|
33
|
+
"name": "wickra",
|
|
34
|
+
"triples": {
|
|
35
|
+
"defaults": false,
|
|
36
|
+
"additional": [
|
|
37
|
+
"x86_64-unknown-linux-gnu",
|
|
38
|
+
"x86_64-apple-darwin",
|
|
39
|
+
"aarch64-apple-darwin",
|
|
40
|
+
"x86_64-pc-windows-msvc"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">= 16"
|
|
46
|
+
},
|
|
47
|
+
"optionalDependencies": {
|
|
48
|
+
"wickra-linux-x64-gnu": "0.1.2",
|
|
49
|
+
"wickra-darwin-x64": "0.1.2",
|
|
50
|
+
"wickra-darwin-arm64": "0.1.2",
|
|
51
|
+
"wickra-win32-x64-msvc": "0.1.2"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "napi build --platform --release",
|
|
55
|
+
"build:debug": "napi build --platform",
|
|
56
|
+
"artifacts": "napi artifacts",
|
|
57
|
+
"universal": "napi universal",
|
|
58
|
+
"version": "napi version",
|
|
59
|
+
"test": "node --test __tests__/"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@napi-rs/cli": "^2.18.0"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|