velora-ta
A high-performance, standalone technical analysis library for algorithmic trading in Rust.
Part of the Velora HFT platform, but can be used completely independently.
๐ฏ Features
- ๐ Performance-first: Zero-copy design, O(1) indicator updates, minimal allocations
- ๐ Comprehensive: 49 indicators across 7 categories
- ๐ Dual-mode: Streaming (real-time) + Batch (historical) calculations
- โ Battle-tested: 198 unit tests with edge case coverage
- ๐ Type-safe: Compile-time guarantees via Rust's type system
- ๐ Well-documented: Extensive documentation with examples
- ๐ฏ Standalone: Zero dependencies on external trading frameworks
- โก Fast: Circular buffers, efficient algorithms
๐ฆ Installation
Add to your Cargo.toml:
[]
= "0.1"
๐ Implemented Indicators (49 Total)
Trend Indicators (14) โ
- SMA - Simple Moving Average
- EMA - Exponential Moving Average
- WMA - Weighted Moving Average
- DEMA - Double Exponential MA (reduced lag)
- TEMA - Triple Exponential MA (minimal lag)
- HMA - Hull Moving Average (super responsive)
- SMMA - Smoothed MA / RMA
- VWMA - Volume-Weighted MA
- ADX - Average Directional Index (trend strength)
- Parabolic SAR - Stop and Reverse
- SuperTrend - Trend following with ATR
- Aroon - Trend change detection
- KAMA - Kaufman Adaptive MA
- Vortex - Vortex Indicator
Momentum Indicators (8) โ
- RSI - Relative Strength Index
- MACD - Moving Average Convergence Divergence
- Stochastic - Stochastic Oscillator
- Williams %R - Williams Percent Range
- ROC - Rate of Change
- Momentum - Simple Momentum
- CCI - Commodity Channel Index
- TSI - True Strength Index
Volatility Indicators (6) โ
- True Range - Single bar volatility
- ATR - Average True Range
- Standard Deviation - Price dispersion
- Bollinger Bands - Volatility bands
- Keltner Channels - ATR-based bands
- Donchian Channels - High/Low bands
Volume Indicators (7) โ
- OBV - On-Balance Volume
- VWAP - Volume-Weighted Average Price
- AD - Accumulation/Distribution
- CMF - Chaikin Money Flow
- MFI - Money Flow Index
- Force Index - Price ร Volume
- EMV - Ease of Movement
Bill Williams Indicators (3) โ
- Awesome Oscillator - Momentum histogram
- Alligator - 3 SMAs (Jaw, Teeth, Lips)
- Fractals - Reversal pattern detection
Statistical Indicators (3) โ
- Linear Regression - Trend line forecast
- Z-Score - Standard deviations from mean
- Correlation - Two-series correlation
Candlestick Patterns (8) โ
Single Candle: Doji, Hammer, Shooting Star
Two Candle: Bullish Engulfing, Bearish Engulfing
Three Candle: Three White Soldiers, Three Black Crows
๐ Quick Start
Streaming Mode (Real-time Trading)
use ;
use Utc;
Batch Mode (Backtesting)
use ;
use Utc;
OHLC-Based Indicators
Some indicators require high/low data:
use ;
use Utc;
Volume Indicators
use ;
use Utc;
๐ Documentation
Quick Reference
| Indicator | Type | Data | Common Use |
|---|---|---|---|
| SMA, EMA | Single | Price | Trend following |
| RSI | Single | Price | Overbought/oversold |
| MACD | Multi | Price | Trend + momentum |
| Bollinger Bands | Multi | Price | Volatility breakouts |
| Stochastic | Multi | OHLC | Momentum oscillator |
| ATR | Single | OHLC | Volatility / stop-loss |
| VWAP | Single | Price+Volume | Intraday benchmark |
| OBV | Single | Price+Volume | Volume confirmation |
Indicator Categories
By Output Type:
- SingleIndicator (30): One output value (SMA, RSI, ATR, etc.)
- MultiIndicator (11): Multiple outputs (MACD, Bollinger, Stochastic, etc.)
- VolumeIndicator (8): Requires volume data
- PatternDetector (8): Candlestick patterns
By Data Requirements:
- Price-only (21): Close price sufficient
- OHLC (17): Needs high/low data
- Volume (11): Needs volume data
๐ Examples
See examples/ directory for complete examples:
sma_ema_demo.rs- Moving averages comparison- Real-world trading strategy examples (coming soon)
๐ฌ Testing
# Run all tests
# Run specific category
# Run with output
# Test coverage
Current Coverage: 198 tests, 100% of indicators tested
โก Performance
Benchmarked on Apple M1:
| Indicator | Update Time | Batch (1000 points) |
|---|---|---|
| SMA(20) | ~15ns | ~15ยตs |
| EMA(20) | ~10ns | ~10ยตs |
| RSI(14) | ~25ns | ~25ยตs |
| MACD | ~30ns | ~30ยตs |
| Bollinger Bands | ~40ns | ~40ยตs |
All indicators are O(1) for streaming updates.
๐บ๏ธ Roadmap
Current: v0.1.0 (49 indicators) โ
All essential indicators for 90%+ of trading strategies
Next: v0.2.0 (Target: +20 indicators)
- Ichimoku Cloud
- Stochastic RSI
- 10 more candlestick patterns
- Fibonacci levels
- Pivot Points
Future: v0.3.0+ (Target: 144+ total)
See FUTURE_INDICATORS.md for complete list including:
- Heikin-Ashi transformation
- Renko/Point & Figure charts
- Advanced statistical indicators
- Machine learning indicators (experimental)
๐ค Contributing
We welcome contributions! To add a new indicator:
- Implement the indicator in appropriate category module
- Add comprehensive tests (aim for 5+ test cases)
- Document with examples
- Update this README
- Submit PR
See CONTRIBUTING.md for detailed guidelines.
๐ Complete Indicator List
โ Implemented (49)
Trend (14): SMA, EMA, WMA, DEMA, TEMA, HMA, SMMA, VWMA, ADX, Parabolic SAR, SuperTrend, Aroon, KAMA, Vortex
Momentum (8): RSI, MACD, Stochastic, Williams %R, ROC, Momentum, CCI, TSI
Volatility (6): True Range, ATR, StdDev, Bollinger Bands, Keltner Channels, Donchian Channels
Volume (7): OBV, VWAP, AD, CMF, MFI, Force Index, EMV
Bill Williams (3): Awesome Oscillator, Alligator, Fractals
Statistical (3): Linear Regression, Z-Score, Correlation
Patterns (8): Doji, Hammer, Shooting Star, Bullish Engulfing, Bearish Engulfing, Three White Soldiers, Three Black Crows
๐ฎ Future Scope (95+ indicators)
See FUTURE_INDICATORS.md for the complete roadmap including:
- Ichimoku Cloud (5 components)
- Advanced momentum (Stochastic RSI, UO, KST, PPO, etc.)
- Fibonacci & Pivot levels
- 15+ more candlestick patterns
- Alternative chart types (Heikin-Ashi, Renko, Point & Figure)
- Statistical (R-Squared, Covariance, Hurst Exponent)
- Market breadth indicators
- Experimental ML indicators
Total Planned: 144+ indicators
๐๏ธ Architecture
Core Traits
Design Principles
- Streaming-first: Optimized for real-time data processing
- Circular buffers: Efficient fixed-size windows
- Zero-copy: References and slices where possible
- Type-safe: Strong typing for all values
- Error handling: Comprehensive validation
๐ก Usage Patterns
Trend Following Strategy
use ;
let mut sma_fast = SMAnew?;
let mut sma_slow = SMAnew?;
for price in prices
Mean Reversion Strategy
use ;
let mut rsi = RSInew?;
let mut bb = new?;
for price in prices
Volatility Breakout
use ;
let mut atr = ATRnew?;
let mut bb = new?;
for bar in ohlc_bars
๐ API Documentation
Common Methods
All indicators support:
// Create indicator
let mut indicator = SMAnew?;
// Check status
indicator.name; // Get indicator name
indicator.warmup_period; // Periods needed before output
indicator.is_ready; // Has enough data?
// Update (streaming)
indicator.update?;
// Get current value
indicator.current;
// Batch calculation
indicator.calculate?;
// Reset state
indicator.reset;
๐งช Testing
All indicators have comprehensive tests covering:
- โ Creation and validation
- โ Invalid parameters
- โ Mathematical correctness
- โ Edge cases (NaN, Infinity, zero division)
- โ Warmup period behavior
- โ Reset functionality
- โ Batch vs streaming consistency
# Run all 198 tests
# Run specific indicator tests
๐ฏ Use Cases
- Algorithmic Trading: Build automated trading systems
- Backtesting: Test strategies on historical data
- Market Analysis: Technical analysis tools
- Research: Quantitative finance research
- Education: Learn indicator calculations
- Charting Libraries: Add indicators to charts
๐ License
MIT License - see LICENSE for details
๐ Acknowledgments
Inspired by:
- TA-Lib (Technical Analysis Library)
- Tulip Indicators
- pandas-ta (Python)
- TradingView indicators
Built with โค๏ธ in Rust
๐ Support
- ๐ Full Documentation
- ๐ฌ GitHub Discussions
- ๐ Issue Tracker
- ๐ง Email Support
Status: v0.1.0 - Production Ready ๐