This is a Zig wrapper for TA-LIB.
- Add ta-lib-zig as a dependency in your
build.zig.zon:
zig fetch --save "git+https://github.com/ta-lib/ta-lib-zig#main"- In your
build.zig, add thehttpzmodule as a dependency you your program:
const ta_lib = b.dependency("ta_lib", .{
.target = target,
.optimize = optimize,
});
// the executable from your call to b.addExecutable(...)
exe.root_module.addImport("ta_lib", ta_lib.module("ta_lib"));A simple example using the Momentum indicator:
const ta = @import("ta_lib");
const prices = [_]f64{ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 };
const result = try ta.MOM(allocator, &prices, 5);
defer allocator.free(result);