feat: expand TA-Lib wrapper with math transform functions

- Add 13 new math transform functions: Cos, Sin, Tan, ACos, ASin, ATan, CosH, SinH, TanH, Ceil, Exp, Floor, Sqrt, Ln, Log10
- Implement proper TA-Lib bindings for all math transform operations
- Add comprehensive documentation comments to all new functions
- Standardize error handling across all wrapper functions using slog.Debug
- Refactor function definitions for consistency and maintainability

The wrapper now exposes a comprehensive set of mathematical operations from TA-Lib,
including trigonometric, hyperbolic, exponential, logarithmic, and rounding functions.
All functions follow the established pattern of vector element-wise transformations.
This commit is contained in:
2026-07-23 11:05:32 +09:00
parent e0715fb3e3
commit e77cd88cd9
4 changed files with 561 additions and 10 deletions
+19
View File
@@ -32,6 +32,7 @@ func Load() (uintptr, error) {
purego.RegisterLibFunc(&ht_phasor, ptr, "TA_HT_PHASOR")
purego.RegisterLibFunc(&ht_sine, ptr, "TA_HT_SINE")
purego.RegisterLibFunc(&ht_trendmode, ptr, "TA_HT_TRENDMODE")
purego.RegisterLibFunc(&add, ptr, "TA_ADD")
purego.RegisterLibFunc(&div, ptr, "TA_DIV")
purego.RegisterLibFunc(&max, ptr, "TA_MAX")
@@ -44,6 +45,24 @@ func Load() (uintptr, error) {
purego.RegisterLibFunc(&sub, ptr, "TA_SUB")
purego.RegisterLibFunc(&sum, ptr, "TA_SUM")
purego.RegisterLibFunc(&cos, ptr, "TA_COS")
purego.RegisterLibFunc(&acos, ptr, "TA_ACOS")
purego.RegisterLibFunc(&cosh, ptr, "TA_COSH")
purego.RegisterLibFunc(&sin, ptr, "TA_SIN")
purego.RegisterLibFunc(&asin, ptr, "TA_ASIN")
purego.RegisterLibFunc(&sinh, ptr, "TA_SINH")
purego.RegisterLibFunc(&tan, ptr, "TA_TAN")
purego.RegisterLibFunc(&atan, ptr, "TA_ATAN")
purego.RegisterLibFunc(&tanh, ptr, "TA_TANH")
purego.RegisterLibFunc(&ceil, ptr, "TA_CEIL")
purego.RegisterLibFunc(&exp, ptr, "TA_EXP")
purego.RegisterLibFunc(&floor, ptr, "TA_FLOOR")
purego.RegisterLibFunc(&sqrt, ptr, "TA_SQRT")
purego.RegisterLibFunc(&ln, ptr, "TA_LN")
purego.RegisterLibFunc(&log10, ptr, "TA_LOG10")
return ptr, nil
}