oransel/node-talib

Can't get it to work - am I doing something wrong?

Closed this issue · 2 comments

Hi,

This is on v0.2.9 of node-talib on 64bit Ubuntu 13.04. Node v0.10.5

The library seemed to build correctly from npm.

> talib@0.2.9 preinstall /home/jr/workspace/tasar/node_modules/talib
> cd ./src/lib && node build.js && cd ../../ && node-gyp configure && node-gyp build

building talib functions...
make: Entering directory `/home/jr/workspace/tasar/node_modules/talib/build'
  CXX(target) Release/obj.target/talib/src/talib.o
  SOLINK_MODULE(target) Release/obj.target/talib.node
  SOLINK_MODULE(target) Release/obj.target/talib.node: Finished
  COPY Release/talib.node
make: Leaving directory `/home/jr/workspace/tasar/node_modules/talib/build'

The following test seemingly produces garbage in the result array:-

var talib = require('talib');
talib.execute({
                name: "SMA",
                startIdx: 0,
                endIdx: 4,
                inReal: [1.0, 1.0, 1.0, 1.0, 1.0],
                optInTimePeriod: 2
            }, function (result) {
                console.log(JSON.stringify(result));

            })

Results vary. For example, this is 3 runs:

{"begIndex":1,"nbElement":4,"result":{"outReal":[9.121659968796e-311,2.1334585e-    317,2.133458e-317,3.4766123620452e-310,0]}}
jr@jr-13-04:~/workspace/tasar$ node test.js
{"begIndex":1,"nbElement":4,"result":{"outReal":[null,null,null,null,0]}}
jr@jr-13-04:~/workspace/tasar$ node test.js
{"begIndex":1,"nbElement":4,"result":{"outReal":[1.5086519287736e-311,2.1334585e-    317,2.133458e-317,3.47666280419233e-310,0]}}

Kind regards,

  • Alfred

This was down to the inReal parameter passing being incorrect. I've fixed it and submitted a pull request.

I apologize for the delay and thank you for quick fix. I'll review and pull the changes.