Skip to content

Commit ec108db

Browse files
committed
Update readme
1 parent decb343 commit ec108db

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
11
# TA-Lib
22

33
This is a Zig wrapper for [TA-LIB](http://ta-lib.org).
4+
5+
## Installation
6+
7+
1) Add ta-lib-zig as a dependency in your `build.zig.zon`:
8+
9+
```bash
10+
zig fetch --save "git+https://github.com/ta-lib/ta-lib-zig#main"
11+
```
12+
13+
2) In your `build.zig`, add the `httpz` module as a dependency you your program:
14+
15+
```zig
16+
const ta_lib = b.dependency("ta_lib", .{
17+
.target = target,
18+
.optimize = optimize,
19+
});
20+
21+
// the executable from your call to b.addExecutable(...)
22+
exe.root_module.addImport("ta_lib", ta_lib.module("ta_lib"));
23+
```
24+
## Examples
25+
26+
A simple example using the Momentum indicator:
27+
28+
```zig
29+
const ta = @import("ta_lib");
30+
31+
const prices = [_]f64{ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 };
32+
33+
const result = try ta.MOM(allocator, &prices, 5);
34+
```

0 commit comments

Comments
 (0)