# TechKit Documentation **High-performance technical analysis library for financial applications.** ```{image} https://img.shields.io/pypi/v/techkit.svg :target: https://pypi.org/project/techkit/ :alt: PyPI Version ``` Welcome to TechKit documentation! TechKit is a modern technical analysis library designed for financial applications, providing high-performance, thread-safe technical indicator calculation capabilities. ## What is TechKit? TechKit is a **high-performance, thread-safe** technical analysis library designed to replace traditional TA-Lib. It provides **189 technical indicators** with support for real-time streaming data processing and batch historical data analysis. ### Core Features - **189 Technical Indicators** - Complete TA-Lib algorithm compatibility plus advanced analytics - **High Performance** - C++ core implementation with O(1) incremental updates - **Cross-Platform Support** - Python, Node.js, WebAssembly, and native C/C++ - **Thread-Safe** - Zero global state design, each instance is completely independent - **Memory Efficient** - O(period) memory footprint, suitable for large-scale data processing - **Real-Time Streaming** - Supports incremental data updates without waiting for complete datasets - **Easy to Use** - Clean API design supporting both object-oriented and functional styles ### Use Cases TechKit is suitable for the following scenarios: - **Quantitative Trading Research** - Quickly calculate large numbers of technical indicators for strategy backtesting - **Real-Time Trading Systems** - Stream data processing with low-latency indicator calculation - **Data Analysis Platforms** - Batch process historical data to generate technical analysis reports - **Web Applications** - Calculate indicators directly in the browser without backend services - **Mobile Applications** - Lightweight, high-performance mobile technical analysis ## Version Information TechKit provides bindings for multiple languages and platforms, each with potentially different versions: ### Python Version - **Package Name**: `techkit` - **Current Version**: 1.2.7 - **Python Requirement**: Python 3.10+ - **Dependencies**: NumPy 1.21+ - **Supported Platforms**: Linux (x86_64, aarch64), macOS (x86_64, arm64), Windows (AMD64) - **Number of Indicators**: 189 (full version) - **Installation**: `pip install techkit` ### Node.js Version TechKit provides two Node.js packages to meet different needs: #### techkit (Core Edition) - **Package Name**: `techkit` - **Current Version**: 1.2.7 - **Number of Indicators**: 158+ core indicators (TA-Lib compatible) - **WASM Size**: ~200KB - **Features**: Lightweight, includes the most commonly used technical indicators - **Use Cases**: Most application scenarios requiring common indicators - **Installation**: `npm install techkit` #### techkit-full (Full Edition) - **Package Name**: `techkit-full` - **Current Version**: 1.2.7 - **Number of Indicators**: 189 (including advanced analytics) - **WASM Size**: ~800KB - **Features**: Complete functionality including risk metrics, volatility models, pattern recognition, etc. - **Use Cases**: Requiring complete functionality, advanced analytics, pattern recognition - **Installation**: `npm install techkit-full` **Version Comparison**: | Feature | techkit | techkit-full | |---------|---------|--------------| | Core Indicators (TA-Lib) | ✅ 158 | ✅ 158 | | Advanced Analytics | ❌ | ✅ 31 | | Risk Metrics | ❌ | ✅ Sharpe, Sortino, VaR | | Volatility Models | ❌ | ✅ GARCH, EWMA | | Pattern Recognition | ❌ | ✅ Harmonic Patterns, Chart Patterns | | Browser Support | ✅ | ✅ | | Node.js Native | ✅ | ✅ | ### Browser Version Both Node.js packages support browser environments: - **techkit**: Runs in browser via WebAssembly - **techkit-full**: Runs in browser via WebAssembly (more complete functionality) ### C/C++ Version - **Language**: C (ABI) + C++11 (implementation) - **Build System**: CMake - **Number of Indicators**: 189 - **Features**: Native performance, no dependencies ## Quick Start Select your platform to view the quick start guide: ::::{tab-set} :::{tab-item} Python ```python import techkit as tk import numpy as np # Create indicator instances sma = tk.SMA(period=20) # 20-period Simple Moving Average rsi = tk.RSI(period=14) # 14-period Relative Strength Index # Prepare price data (example) prices = np.array([100.0, 101.5, 102.3, 101.8, 103.2, 104.1, 103.5, 105.0]) # Method 1: Incremental updates (suitable for real-time data streams) for price in prices: sma_result = sma.update(price) rsi_result = rsi.update(price) # Check if result is valid (indicators need a certain amount of data to calculate) if sma_result.valid: print(f"Price: {price:.2f}, SMA: {sma_result.value:.2f}, RSI: {rsi_result.value:.2f}") # Method 2: Batch calculation (suitable for historical data analysis) sma_values = tk.SMA(20).calculate(prices) rsi_values = tk.RSI(14).calculate(prices) # NaN values indicate insufficient data at that position print("SMA values:", sma_values) print("RSI values:", rsi_values) ``` ::: :::{tab-item} JavaScript/Node.js ```javascript import { init, SMA, RSI } from 'techkit'; // Initialize (must be called once before use) await init(); // Create indicator instances const sma = new SMA(20); // 20-period Simple Moving Average const rsi = new RSI(14); // 14-period Relative Strength Index // Prepare price data const prices = [100.0, 101.5, 102.3, 101.8, 103.2, 104.1, 103.5, 105.0]; // Method 1: Incremental updates (suitable for real-time data streams) for (const price of prices) { const smaResult = sma.update(price); const rsiResult = rsi.update(price); // Check if result is valid if (smaResult.valid) { console.log(`Price: ${price.toFixed(2)}, SMA: ${smaResult.value.toFixed(2)}, RSI: ${rsiResult.value.toFixed(2)}`); } } // Method 2: Batch calculation (suitable for historical data analysis) const smaValues = sma.calculate(prices); const rsiValues = rsi.calculate(prices); console.log('SMA values:', smaValues); console.log('RSI values:', rsiValues); // Cleanup resources (important!) sma.dispose(); rsi.dispose(); ``` ::: :::{tab-item} C++ ```cpp #include #include #include int main() { // Create indicator instances (RAII - automatic resource management) auto sma = techkit::Indicator::SMA(20); auto rsi = techkit::Indicator::RSI(14); // Prepare price data std::vector prices = {100.0, 101.5, 102.3, 101.8, 103.2, 104.1, 103.5, 105.0}; // Incremental updates for (size_t i = 0; i < prices.size(); ++i) { auto sma_r = sma.update(prices[i]); auto rsi_r = rsi.update(prices[i]); if (sma_r.valid) { std::cout << "Price: " << prices[i] << ", SMA: " << sma_r.value << ", RSI: " << rsi_r.value << std::endl; } } return 0; // Indicators automatically released } ``` ::: :::: ## Why Choose TechKit? ### Advantages Over TA-Lib 1. **Incremental Update Support** - TA-Lib only supports batch calculation, TechKit supports O(1) incremental updates suitable for real-time data streams 2. **Thread-Safe** - Zero global state, no locking required in multi-threaded environments 3. **Modern API** - Object-oriented design, more aligned with modern programming practices 4. **Cross-Platform** - Unified API usable in Python, Node.js, browsers, and C++ 5. **Complete Documentation** - Detailed documentation suitable for beginners ### Performance Advantages - **C++ Core** - Native performance, 10-100x faster than pure Python/JavaScript implementations - **Memory Efficient** - O(period) memory footprint instead of O(n) - **Vectorized Computation** - Fully utilizes CPU SIMD instructions during batch calculation ### Use Case Examples **Scenario 1: Real-Time Trading System** ```python # Receive real-time price stream, calculate indicators immediately for price in real_time_price_stream: rsi_result = rsi.update(price) if rsi_result.valid and rsi_result.value > 70: trigger_sell_signal() # RSI overbought, trigger sell signal ``` **Scenario 2: Historical Data Backtesting** ```python # Calculate indicators for all historical data at once historical_prices = load_from_database() sma_values = tk.SMA(20).calculate(historical_prices) rsi_values = tk.RSI(14).calculate(historical_prices) ``` **Scenario 3: Web Application** ```javascript // Calculate indicators directly in browser without backend const sma = new SMA(20); const result = sma.calculate(userPriceData); updateChart(result); ``` ## Documentation Navigation ### Quick Start If you're using TechKit for the first time, we recommend reading in this order: 1. **[Installation Guide](getting-started/installation.md)** - Learn how to install and configure TechKit 2. **[Quick Start](getting-started/quickstart.md)** - Get started in 5 minutes, learn basic usage 3. **[Code Examples](getting-started/examples.md)** - View complete examples of real-world scenarios ### API Reference Choose the corresponding API documentation based on your language: - **[Python API](api/python-api.md)** - Complete Python binding reference, suitable for Python users - **[Node.js API](api/nodejs-api.md)** - JavaScript/TypeScript API reference, includes techkit and techkit-full documentation - **[C API](api/c-api.md)** - C language interface reference, suitable for C/C++ developers - **[C++ API](api/cpp-api.md)** - C++ wrapper reference, modern C++ interface ### Indicator Reference View all available technical indicators by category: - **[Overlap Studies](indicators/overlap.md)** - Moving averages, Bollinger Bands, etc. (17 indicators) - **[Momentum Indicators](indicators/momentum.md)** - RSI, MACD, Stochastic, etc. (30 indicators) - **[Volatility Indicators](indicators/volatility.md)** - ATR, NATR, etc. (3 indicators) - **[Volume Indicators](indicators/volume.md)** - OBV, AD, etc. (3 indicators) - **[Statistical Functions](indicators/statistics.md)** - Standard deviation, variance, linear regression, etc. (9 indicators) - **[Pattern Recognition](indicators/patterns.md)** - Candlestick pattern recognition (61 patterns) - **[Advanced Analytics](indicators/advanced.md)** - Risk metrics, volatility models, harmonic patterns, etc. (66 indicators) ### Development Documentation If you want to contribute to development or build from source: - **[Building Guide](development/building.md)** - Compile TechKit from source - **[Contributing Guide](development/contributing.md)** - How to contribute code - **[Changelog](development/changelog.md)** - Version update history ## Complete Table of Contents ```{toctree} :maxdepth: 2 :caption: Getting Started getting-started/index getting-started/installation getting-started/quickstart getting-started/examples ``` ```{toctree} :maxdepth: 2 :caption: API Reference api/index api/python-api api/nodejs-api api/c-api api/cpp-api ``` ```{toctree} :maxdepth: 2 :caption: Indicator Reference indicators/index indicators/overlap indicators/momentum indicators/volatility indicators/volume indicators/statistics indicators/patterns indicators/advanced ``` ```{toctree} :maxdepth: 2 :caption: Development development/index development/building development/contributing development/changelog ``` ```{toctree} :maxdepth: 2 :caption: Contact contact ``` ## Indices and Search - {ref}`genindex` - Complete index - {ref}`search` - Search documentation ## Get Help - **Documentation Site**: [https://techkit-docs.netlify.app/](https://techkit-docs.netlify.app/) - **GitHub Repository**: [https://github.com/yiivon/techkit](https://github.com/yiivon/techkit) - **Issue Tracker**: [GitHub Issues](https://github.com/yiivon/techkit/issues) ## Version Information - **Documentation Version**: 1.2.7 - **Last Updated**: 2024-12 - **License**: MIT License