An emscripten wrapper around TA-LIB, that allows you to use technical analysis library from ta-lib.org with webpack or inside node.js.
Supports typescript types.
To install the most recent release from npm, run:
npm install talib-wasm --save
require('talib-wasm')
.then((funcs) => {
const totalLength = 50;
const inputArray1 = new Array(totalLength);
const inputArray2 = new Array(totalLength);
for (let i = 0; i < totalLength; i++) {
inputArray1[i] = Math.random() * 100;
inputArray2[i] = Math.random() * 100;
}
const result = funcs.CORREL({
startIdx: 0,
begIdx: totalLength - 1,
inReal0: inputArray1,
inReal1: inputArray2,
optInTimePeriod: 5
});
console.log(
result
);
});
Output:
{
outReal: Float64Array [
-0.6928388933464642,
-0.5839394251640864,
-0.14373076952669628,
0.6790200559640114,
0.8465738940590309,
0.28576183066199495,
...
],
returnCode: 0,
returnCodeName: 'TA_SUCCESS'
}
require('talib-wasm')
.then((funcs) => {
console.log(
JSON.stringify(funcs.describeFunctions(), null, 2)
)
});
Output:
{
"ACOS": {
"RequiredInputArguments": [
{
"name": "inReal",
"defaultValue": null
}
],
"OptionalInputArguments": [],
"OutputArguments": [
{
"name": "outReal"
}
]
},
"AD": {
"RequiredInputArguments": [
{
"name": "High",
"defaultValue": null
},
{
"name": "Low",
"defaultValue": null
},
{
"name": "Close",
"defaultValue": null
},
{
"name": "Volume",
"defaultValue": null
}
],
"OptionalInputArguments": [],
"OutputArguments": [
{
"name": "outReal"
}
]
},
"ADD": {
"RequiredInputArguments": [
{
"name": "inReal0",
"defaultValue": null
},
{
"name": "inReal1",
"defaultValue": null
}
],
"OptionalInputArguments": [],
"OutputArguments": [
{
"name": "outReal"
}
]
},
...
}
Some indicators require or accept a optInMAType property:
SMA = 0
EMA = 1
WMA = 2
DEMA = 3
TEMA = 4
TRIMA = 5
KAMA = 6
MAMA = 7
T3 = 8
You need manually install emscripten to build this package.
npm run build
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.14
clang version 12.0.0
node (EMSDK_NODE) version - 15.10.0
python (EMSDK_PYTHON) version - 3.9.2
lookback
functions to get lookback info. Very useful to get difference between input and output arrays lengths.emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.10
clang version 12.0.0 (/opt/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project 445289aa63e1b82b9eea6497fb2d0443813a9d4e)
node (EMSDK_NODE) version - 15.3.0
python (EMSDK_PYTHON) version - 3.8.5
Added main.d.ts file for typescript typings support.
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.0
clang version 12.0.0
talib version - 1.1.3
node (EMSDK_NODE) version - 14.8.0
python (EMSDK_PYTHON) version - 3.8.5
Switch to emscripten v2.0.0
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.0
clang version 12.0.0
talib version - 1.1.3
node (EMSDK_NODE) version - 14.8.0
python (EMSDK_PYTHON) version - 3.8.5
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.40.1
talib - 1.1.3
node - 14.7.0
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.39.18
talib - 1.1.3
node - 14.5.0
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.39.14
talib - 1.1.3
node - 14.2.0
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.39.13
talib - 1.1.3
node - 14.0.0
emcc - (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.39.6
talib - 1.1.3
node - 13.7.0
emcc - (Emscripten gcc/clang-like replacement) 1.39.3
talib - 1.1.3
node - 13.2.0
emcc - (Emscripten gcc/clang-like replacement) 1.39.1
talib - 1.1.3
node - 13.0.1
emcc - (Emscripten gcc/clang-like replacement) 1.38.44
talib - 1.1.2
node - 12.10.0
binaryen - 89
If you like this package - support me on Buy me a coffee.