Skip to content

Commit 7bf2a6a

Browse files
committed
v0.3.2 doc(readme): add install method on windows
1 parent 40342be commit 7bf2a6a

File tree

2 files changed

+37
-22
lines changed

2 files changed

+37
-22
lines changed

README.md

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,26 @@ A synchronous [TA-Lib](http://ta-lib.org/) bindings for Node.js & TypeScript.
44

55
## Install
66

7+
var yarn:
8+
79
```bash
810
yarn add talib-binding
911
```
1012

13+
var npm:
14+
15+
```bash
16+
npm install talib-binding --save
17+
```
18+
19+
### Install on Windows system
20+
21+
Before install this module, you may need to install `windows-build-tools` by run:
22+
23+
```bash
24+
npm install --global --production windows-build-tools
25+
```
26+
1127
## Usage
1228

1329
1. All the functions are exported, you can call it in the same form to [c api](https://ta-lib.org/d_api/d_api.html), but there are some difference:
@@ -21,8 +37,7 @@ yarn add talib-binding
2137

2238
- call in the same form of `TA-Lib`:
2339
```typescript
24-
// import * as talib from 'talib-binding'
25-
import * as talib from './src/talib-binding.generated'
40+
import * as talib from 'talib-binding'
2641

2742
talib.SAR(
2843
[2, 3, 4, 5], /* inHigh */
@@ -35,26 +50,24 @@ yarn add talib-binding
3550
```
3651
- 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.
3752
```typescript
38-
// import * as talib from 'talib-binding'
39-
import * as talib from './src/talib-binding.generated'
40-
talib.SAR([
53+
import * as talib from 'talib-binding'
54+
55+
const records = [
4156
{Time: 0, Open: 1, High: 2, Low: 1, Close: 2, Volume: 1},
4257
{Time: 0, Open: 2, High: 3, Low: 2, Close: 3, Volume: 1},
4358
{Time: 0, Open: 3, High: 4, Low: 3, Close: 4, Volume: 1},
4459
{Time: 0, Open: 4, High: 5, Low: 4, Close: 5, Volume: 1},
45-
])
60+
]
61+
62+
talib.SAR(records)
63+
4664
// The COS function contains implicit parameter name, you need to call it as follow:
47-
talib.COS([
48-
{Time: 0, Open: 1, High: 2, Low: 1, Close: 2, Volume: 1},
49-
{Time: 0, Open: 2, High: 3, Low: 2, Close: 3, Volume: 1},
50-
{Time: 0, Open: 3, High: 4, Low: 3, Close: 4, Volume: 1},
51-
{Time: 0, Open: 4, High: 5, Low: 4, Close: 5, Volume: 1},
52-
], 'Volume')
65+
talib.COS(records, 'Volume')
5366
```
5467
- if function return a single array, the return value will be it, else will be a nested array.
5568
```typescript
56-
// import * as talib from 'talib-binding'
57-
import * as talib from './src/talib-binding.generated'
69+
import * as talib from 'talib-binding'
70+
5871
const outReal = talib.SAR([2, 3, 4, 5], [1, 2, 3, 4])
5972
console.log(outReal)
6073
// [ 1, 1.04, 1.1584 ]
@@ -67,17 +80,18 @@ yarn add talib-binding
6780
```
6881
- **if TA function returns a error, OR startIdx/endIdx out of range, will throw it**:
6982
```typescript
70-
// import * as talib from 'talib-binding'
71-
import * as talib from './src/talib-binding.generated'
72-
talib.ACCBANDS([2, 3, 4, 5], [1, 2, 3, 4], [2, 3, 4, 5], 3)
83+
import * as talib from 'talib-binding'
84+
85+
talib.ACCBANDS([2, 3, 4, 5], [1, 2, 3, 4], [2, 3, 4, 5], 10)
7386
// throw RangeError: `startIdx` or `endIdx` out of range
7487
```
7588

7689
## Notes
7790

7891
- Some API need to use `TA_MAType`, which is exported as `MATypes` in the binding. For example:
7992
```typescript
80-
import * as talib from './src/talib-binding.generated'
93+
import * as talib from 'talib-binding'
94+
8195
talib.MA([1, 2, 3], void 0, talib.MATypes.SMA)
8296
```
8397

@@ -95,4 +109,4 @@ to get detailed information.
95109
## License
96110

97111
- This project published under [MIT](./LICENSE) License.
98-
- The `TA-Lib` is published under [LICENSE](./ta-lib/LICENSE.TXT).
112+
- The `TA-Lib` is published under [LICENSE](./ta-lib/LICENSE.TXT).

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"name": "talib-binding",
33
"main": "./build/Release/talib_binding.node",
44
"types": "./src/talib-binding.generated.d.ts",
5-
"version": "0.3.1",
5+
"version": "0.3.2",
66
"license": "MIT",
77
"scripts": {
88
"install": "node-gyp configure build -j4"
99
},
10-
"description": "The [TA-Lib](http://ta-lib.org/) sync bindings.",
10+
"description": "A synchronous [TA-Lib](http://ta-lib.org/) bindings for Node.js & TypeScript.",
1111
"devDependencies": {
1212
"@types/glob": "^5.0.32",
1313
"@types/node": "^8.0.30",
@@ -29,7 +29,8 @@
2929
"talib",
3030
"binding",
3131
"node",
32-
"sync"
32+
"synchronous",
33+
"ta-lib"
3334
],
3435
"author": "acrazing",
3536
"bugs": {

0 commit comments

Comments
 (0)