Tacuda 0.9.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Tacuda --version 0.9.0
                    
NuGet\Install-Package Tacuda -Version 0.9.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tacuda" Version="0.9.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tacuda" Version="0.9.0" />
                    
Directory.Packages.props
<PackageReference Include="Tacuda" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Tacuda --version 0.9.0
                    
#r "nuget: Tacuda, 0.9.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Tacuda@0.9.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Tacuda&version=0.9.0
                    
Install as a Cake Addin
#tool nuget:?package=Tacuda&version=0.9.0
                    
Install as a Cake Tool

TaCuda — .NET/C# Bindings

Managed bindings for the native tacuda CUDA library. TA-Lib 0.7.1 baseline coverage (161 functions, 811 native entrypoints incl. the batch API): generated P/Invoke signatures for host API, device API, MACDEXT, 19 vector math kernels, and typed _ex entrypoints. The DllImport name is platform-neutral (tacuda), so the same assembly loads tacuda.dll, libtacuda.so, or libtacuda.dylib automatically.

Prerequisites

  • .NET 8.0+ or .NET 9.0+
  • NVIDIA GPU (Compute Capability >= 6.0)
  • CUDA Toolkit 11.x or 12.x
  • Built tacuda shared library (tacuda.dll / libtacuda.so / libtacuda.dylib)

Package Scope

  • NativeMethods.ct_* methods generated from include/tacuda.h / include/tacuda_device.h
  • Precision-aware core entrypoints (*_ex) with runtime dtype pair selection
  • OHLCV helper model (OhlcvSeries) for convenient column-major inputs

Installation

NuGet

dotnet add package Tacuda

From Source

# Build the native library first
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

# Reference the binding project
dotnet add reference bindings/csharp/Tacuda.Bindings.csproj

Note: The tacuda native library must be discoverable at runtime. Place it next to the published binary or add its location to PATH / LD_LIBRARY_PATH.

Quick Start

using Tacuda.Bindings;

// Prepare data
var prices = new float[100000];
var sma = new float[100000];
var rsi = new float[100000];

// Fill prices with your data...

// Calculate indicators (GPU-accelerated)
NativeMethods.ct_sma(prices, sma, prices.Length, 20);
NativeMethods.ct_rsi(prices, rsi, prices.Length, 14);

// MACD (multiple outputs)
var macd = new float[100000];
var signal = new float[100000];
var hist = new float[100000];
NativeMethods.ct_macd(prices, macd, signal, hist, prices.Length, 12, 26, 9, 0);

// OHLCV container
var candles = new OhlcvSeries(open, high, low, close, volume);
var output = new float[candles.Length];
NativeMethods.ct_atr(candles.High, candles.Low, candles.Close, output, candles.Length, 14);

// MACDEXT with independent MA types (1=EMA, 0=SMA, 2=WMA)
NativeMethods.ct_macdext(prices, macd, signal, hist, prices.Length,
                         12, 1, 26, 0, 9, 2);

// Vector math (element-wise GPU kernels)
var logs = new float[100000];
NativeMethods.ct_ln(prices, logs, prices.Length);

// Zero-copy device pipeline
IntPtr dIn = NativeMethods.ct_device_alloc(prices.Length);
IntPtr dOut = NativeMethods.ct_device_alloc(prices.Length);
NativeMethods.ct_device_upload(dIn, prices, prices.Length);
NativeMethods.ct_sma_d(dIn, dOut, prices.Length, 20);   // compute on GPU
NativeMethods.ct_sin_d(dOut, dOut, prices.Length);      // chain kernels
NativeMethods.ct_device_sync();
var result = new float[prices.Length];
NativeMethods.ct_device_download(result, dOut, prices.Length);
NativeMethods.ct_device_free(dIn);
NativeMethods.ct_device_free(dOut);

Available Indicators (TA-Lib 0.7.1 baseline coverage)

All indicators are available as static NativeMethods.ct_* methods:

Category Methods
Moving Averages ct_sma, ct_ema, ct_wma, ct_dema, ct_tema, ct_trima, ct_kama, ct_t3, ct_mama, ct_mavp, ct_ma
Momentum ct_rsi, ct_macd, ct_macdext, ct_macdfix, ct_stochastic, ct_stochf, ct_stochrsi, ct_cci, ct_cmo, ct_roc, ct_momentum, ct_willr, ct_apo, ct_ppo, ct_pvo, ct_trix, ct_ultosc, ct_bop
Volatility ct_atr, ct_natr, ct_trange, ct_bbands, ct_accbands, ct_stddev, ct_var
Trend ct_adx, ct_adxr, ct_dx, ct_plus_di, ct_minus_di, ct_plus_dm, ct_minus_dm, ct_sar, ct_sarext, ct_aroon, ct_aroon_osc
Volume ct_ad, ct_adosc, ct_obv, ct_mfi, ct_imi, ct_nvi, ct_pvi
Statistical ct_linearreg, ct_linearreg_slope, ct_linearreg_intercept, ct_linearreg_angle, ct_tsf, ct_correl, ct_beta, ct_avgdev
Hilbert Transform ct_ht_dcperiod, ct_ht_dcphase, ct_ht_phasor, ct_ht_sine, ct_ht_trendline, ct_ht_trendmode
Vector Math (19) ct_sin, ct_cos, ct_tan, ct_asin, ct_acos, ct_atan, ct_sinh, ct_cosh, ct_tanh, ct_exp, ct_ln, ct_log10, ct_sqrt, ct_ceil, ct_floor, ct_add, ct_sub, ct_mult, ct_div
Candlestick 63 ct_cdl_* patterns

Device API variants (ct_*_d and ct_*_device) plus ct_device_alloc/upload/download/sync/free and buffer-pool controls are available for zero-copy GPU pipelines.

NuGet Packaging

To build the NuGet package with native libraries:

# 1. Build native libraries for target platforms
# 2. Place them in runtimes/ folder:
#    runtimes/win-x64/native/tacuda.dll
#    runtimes/linux-x64/native/libtacuda.so

# 3. Pack
cd bindings/csharp
dotnet pack -c Release

To publish:

dotnet nuget push bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key <NUGET_API_KEY>

Regenerating Bindings

After editing include/tacuda.h:

python bindings/generate_bindings.py

CTest verifies that the generated files are up to date.

Running Tests

dotnet run --project bindings/csharp/ConsoleExample -- --test
# Runs 100 tests covering all indicator categories, vector math, MACDEXT and device API

Changelog

Canonical release history is maintained in CHANGELOG.md.

License

Apache License 2.0 — see LICENSE.

Streaming and version pairing

Streaming was added in 0.8.0 for incremental single-series and portfolio updates across 10 indicator families. Pair bindings with the native library from the same release; 0.9.0 also includes precision, input-validation and stream correctness fixes. A native older than 0.8.0 does not export the streaming functions. See the Streaming API guide. The 161-function compatibility baseline is native TA-Lib 0.7.1, not TA-Lib 0.8.1.

Fused portfolio batches (0.9.0)

Seventeen indicator families can process a portfolio in one CUDA kernel per call. Supported device batches are CUDA Graph compatible; user-stream calls stay asynchronous. TACUDA_BATCH_FUSED=auto|0|1 controls automatic, per-series or forced fused dispatch. Period/shape limits apply, and the double internal arithmetic can change the last float32 bits from 0.8. See batch dispatch and migration.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.9.3 97 11/22/2026
0.9.2 101 11/20/2026
0.9.1 101 11/16/2026
0.9.0 98 11/14/2026
0.8.0 103 11/8/2026
0.7.1 200 7/23/2026