MIT License

项目介绍

acrazing/talib-binding-node 是一个托管在 GitHub 上的开源项目,主要使用 C 编写,采用 MIT License 许可证,目前获得 98 个 Star、20 次 Fork。

仓库全名
acrazing/talib-binding-node
开源许可证
MIT License
Star 数
98
Fork 数
20
未关闭 Issue
8

README 摘要

talib-binding A synchronous TA-Lib bindings for Node.js & TypeScript. Install var yarn: var npm: Install on Windows system Before install this module, you may need to install windows-build-tools by run: Usage 1. All the functions are exported, you can call it in the same form to c api, but there are some difference: the startIdx and endIdx is placed at the end of the function signature, and is optional. the return…

完整内容见 GitHub 原始 README 或本页 。

常见问题

talib-binding-node 用什么语言开发?

主要使用 C 编写,采用 MIT License 许可证,目前有 98 个 Star。

talib-binding-node 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 talib-binding-node 的源码?

可以直接克隆仓库:git clone https://github.com/acrazing/talib-binding-node.git,默认分支为 master;安装与运行步骤见仓库 README。

talib-binding-node 最近还在维护吗?

仓库最近一次更新为 2022年12月9日,当前有 8 个未关闭 Issue;Star 数为 98,可作为社区活跃度的参考。

关于

A synchronous ta-lib bindings for node.js, work on any platform.

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
147
价值分
65
活跃状态
活跃

语言占比

C
C++
Java
Makefile
Python
TypeScript

Release

贡献者

README

talib-binding

A synchronous TA-Lib bindings for Node.js & TypeScript.

Install

var yarn:

yarn add talib-binding

var npm:

npm install talib-binding --save

Install on Windows system

Before install this module, you may need to install windows-build-tools by run:

npm install --global --production windows-build-tools

Usage

  1. All the functions are exported, you can call it in the same form to c api, but there are some difference:
    • the startIdx and endIdx is placed at the end of the function signature, and is optional.
    • the return value is the computed result, if result is one array, will be it, else will be a nested array to contains all output arrays.
    • if the ta-lib function returns a error code, will throw a error.
  2. Additionally, you can pass a Record[] to extract its fields rather than input double array such as inHigh, inLow, etc. And if the input field is a implicit field of the records, you need to input a string to specifying which one field will be extract as it.
  3. The types for TypeScript is generated, you can use this it in TypeScript projects.

Example

  • call in the same form of TA-Lib:
    import * as talib from 'talib-binding'
    
    talib.SAR(
        [2, 3, 4, 5], /* inHigh */
        [1, 2, 3, 4], /* inLow */
        0.02, /* optAcceleration_Factor, optional */
        0.2, /* optAF_Maximum, optional */
        0, /* startIdx, optional */
        3 /* endIdx, optional */
    )
    
  • pass a Record array as the first parameter, the library will extract the field value automatically, if the function contains some implicit parameter name, you need to pass the name string to extract it. The implicit parameter means that the param is not one of High, Low, Open, Close, and Volume, just like inReal, more detailed information could be found in the TypeScript function signatures.
    import * as talib from 'talib-binding'
    
    const records = [
      {Time: 0, Open: 1, High: 2, Low: 1, Close: 2, Volume: 1},
      {Time: 0, Open: 2, High: 3, Low: 2, Close: 3, Volume: 1},
      {Time: 0, Open: 3, High: 4, Low: 3, Close: 4, Volume: 1},
      {Time: 0, Open: 4, High: 5, Low: 4, Close: 5, Volume: 1},
    ]
    
    talib.SAR(records)
    
    // The COS function contains implicit parameter name, you need to call it as follow:
    talib.COS(records, 'Volume')
    
  • if function return a single array, the return value will be it, else will be a nested array.
    import * as talib from 'talib-binding'
    
    const outReal = talib.SAR([2, 3, 4, 5], [1, 2, 3, 4])
    console.log(outReal)
    // [ 1, 1.04, 1.1584 ]
    
    const [outUp, outMid, outLow] = talib.ACCBANDS([2, 3, 4, 5], [1, 2, 3, 4], [2, 3, 4, 5], 3)
    console.log(outUp, outMid, outLow)
    // [ 5.45079365079365, 6.302645502645503 ]
    // [ 3, 4 ]
    // [ 0.4507936507936508, 1.3026455026455028 ]
    
  • if TA function returns a error, OR startIdx/endIdx out of range, will throw it:
    import * as talib from 'talib-binding'
    
    talib.ACCBANDS([2, 3, 4, 5], [1, 2, 3, 4], [2, 3, 4, 5], 10)
    // throw RangeError: `startIdx` or `endIdx` out of range
    

Notes

  • Some API need to use TA_MAType, which is exported as MATypes in the binding. For example:
    import * as talib from 'talib-binding'
    
    talib.MA([1, 2, 3], void 0, talib.MATypes.SMA)
    

Contributing

Clone the repo at first:

git clone https://github.com/acrazing/talib-binding-node && cd talib-binding-node

All the files end with generated.* is generated by src/generate.ts. Maybe you need to view it to get detailed information.

License

  • This project published under MIT License.
  • The TA-Lib is published under LICENSE.

评论

暂无评论