feat: add math operator wrappers and align TA-Lib binding types

Add Go wrappers for additional TA-Lib math operators:
Div, Max, MaxIndex, Min, MinIndex, MinMax, MinMaxIndex, Mult, Sub, and Sum.

Refactor the TA-Lib function signatures to use int32 consistently,
including taResult and Hilbert Transform bindings, so the Go layer
matches the native library more closely.

Fix HT_TRENDMODE to return []int32 and update related comments and
naming for better API consistency.
This commit is contained in:
2026-07-22 17:18:22 +09:00
parent 1ce0c19fd5
commit e0715fb3e3
6 changed files with 477 additions and 66 deletions
+16 -2
View File
@@ -9,7 +9,17 @@ This project currently exposes a small subset of TA-Lib functions:
- `HT_PHASOR`
- `HT_SINE`
- `HT_TRENDMODE`
- `ADD`
- `Add`
- `Div`
- `Max`
- `MaxIndex`
- `Min`
- `MinIndex`
- `MinMax`
- `MinMaxIndex`
- `Mult`
- `Sub`
- `Sum`
## Requirements
@@ -83,14 +93,18 @@ func main() {
period := talib.HT_DCPERIOD(series)
fmt.Println(period)
sum := talib.ADD(series, series)
sum := talib.Add(series, series)
fmt.Println(sum)
rollingMax := talib.Max(series, 14)
fmt.Println(rollingMax)
}
```
## API notes
- Indicator functions return `nil` when the underlying TA-Lib call fails.
- Native TA-Lib functions are exposed with Go-style exported names such as `Add`, `Div`, `Max`, and `Sum`.
## Project status