Pyindicators
Technical indicators library
AI-Agent Assisted
Tier 2README
PyIndicators
๐ The most user-friendly technical analysis library for Python! Combining Numba-powered performance with intelligent automation and beautiful visualizations.
100x easier to use than TA-Lib - with auto-detection, one-line analysis, built-in backtesting, streaming support, and interactive widgets!
โจ Key Features
- ๐๏ธ Blazing Fast: Numba JIT-compiled for C-like performance
- ๐ง Intelligent: Auto-detects data formats and column names
- ๐ Complete: 25+ indicators with built-in visualization and backtesting
- ๐ผ Pandas Native: Full DataFrame/Series support with named outputs
- ๐ฑ Interactive: Jupyter widgets and visual strategy builders
- โก Real-time: Streaming indicators for live trading
- ๐ง Flexible: From one-liners to advanced pipelines
- ๐ก๏ธ Robust: Smart error handling with helpful suggestions
๐ Installation
pip install pyindicators
# For interactive features
pip install pyindicators[widgets]
# For development
pip install pyindicators[dev]
โก Quick Start - Choose Your Style
๐ฏ Absolute Beginner (1 line!)
from pyindicators.easy import analyze
# Auto-detects columns, adds indicators, plots, and backtests!
results = analyze('your_data.csv')
๐ผ Pandas User (Most Popular)
from pyindicators.easy import SmartDataFrame
# Works with any CSV/JSON/Parquet file or DataFrame
df = SmartDataFrame('AAPL.csv') # Auto-detects OHLC columns!
# Add indicators with short names
df.add_indicators('rsi', 'macd', 'bb', 'volume')
# Or add everything at once
df.add_indicators('all')
# Built-in visualization with signals
df.plot()
# Instant backtesting
performance = df.backtest(strategy='macd_cross')
print(performance)
๐ Pipeline Enthusiast (Advanced)
from pyindicators.pipeline import IndicatorPipeline
# Chain operations fluently
signals = (IndicatorPipeline(data)
.rsi()
.bollinger_bands()
.macd()
.add_signal('buy', lambda df: (df['RSI_14'] < 30) & (df['Close'] < df['BB_Lower']))
.add_signal('sell', lambda df: (df['RSI_14'] > 70) & (df['Close'] > df['BB_Upper']))
.golden_cross()
.divergence()
.get())
๐ Interactive User (Jupyter)
from pyindicators.widgets import interactive_analysis
# Launch interactive explorer with sliders and real-time updates
explorer = interactive_analysis('data.csv')
โก Live Trader (Real-time)
from pyindicators.streaming import LiveTrader
trader = LiveTrader()
# In your trading loop
result = trader.on_tick({
'high': 105.2, 'low': 104.8,
'close': 105.0, 'volume': 1000000
})
if result['action'] == 'BUY':
print(f"Buy signal at ${result['indicators']['close']}")
๐ป Command Line User
# Quick analysis
pyindicators analyze AAPL.csv
# Calculate specific indicator
pyindicators calc data.csv -i rsi -p 21
# Run backtest
pyindicators backtest data.csv -s macd_cross -c 10000
# Find signals
pyindicators signals data.csv --action buy
๐๏ธ All Available Interfaces
| Interface | Best For | Example |
|---|---|---|
| Easy Mode | Beginners, quick analysis | analyze('data.csv') |
| Pandas Wrapper | Data scientists | ta.rsi(df['Close']) |
| NumPy Core | Performance-critical | rsi(close_array, 14) |
| Pipelines | Complex strategies | Pipeline(data).rsi().macd() |
| Streaming | Live trading | trader.on_tick(live_data) |
| CLI | Terminal users | pyindicators analyze data.csv |
| Widgets | Jupyter notebooks | interactive_analysis(data) |
๐ Available Indicators
๐ Momentum (7 indicators)
- RSI (Relative Strength Index) -
rsi() - Stochastic Oscillator -
stochastic() - Williams %R -
williams_r() - Rate of Change -
roc() - Momentum -
momentum()
๐ Trend (7 indicators)
- SMA (Simple Moving Average) -
sma() - EMA (Exponential Moving Average) -
ema() - WMA (Weighted Moving Average) -
wma() - DEMA (Double Exponential MA) -
dema() - TEMA (Triple Exponential MA) -
tema() - MACD (Moving Average Convergence Divergence) -
macd() - ADX (Average Directional Index) -
adx()
๐ Volatility (5 indicators)
- Bollinger Bands -
bollinger_bands() - ATR (Average True Range) -
atr() - Keltner Channels -
keltner_channels() - Donchian Channels -
donchian_channels() - Standard Deviation -
standard_deviation()
๐ฆ Volume (5 indicators)
- OBV (On Balance Volume) -
obv() - VWAP (Volume Weighted Average Price) -
vwap() - A/D Line (Accumulation/Distribution) -
ad() - MFI (Money Flow Index) -
mfi() - CMF (Chaikin Money Flow) -
cmf()
๐ฏ Built-in Trading Strategies
# Pre-built strategies ready to use
strategies = [
'simple', # RSI oversold/overbought
'macd_cross', # MACD crossover signals
'bb_bounce', # Bollinger Band mean reversion
'trend_follow' # Multi-indicator trend following
]
# Instant backtesting
results = df.backtest(strategy='macd_cross')
๐จ Advanced Features
๐ Smart Data Detection
# Works with ANY column naming convention!
df = SmartDataFrame(data) # Auto-detects: Close, close, CLOSE, Close_Price, etc.
๐ Multi-Timeframe Analysis
from pyindicators.easy import MultiTimeframe
mtf = MultiTimeframe(data)
mtf.add_timeframe('daily', 'D')
mtf.add_timeframe('weekly', 'W')
confluence = mtf.find_confluence() # Find signals across timeframes
๐ฏ Signal Detection
from pyindicators.easy import find_signals
# Find all trading signals automatically
signals = find_signals('AAPL.csv')
print(signals.head())
๐ ๏ธ Custom Indicators
# Create custom indicators easily
pipeline = (IndicatorPipeline(data)
.custom(lambda df: df['Close'].rolling(20).skew(), 'Skewness_20')
.transform('Volume', lambda x: np.log(x), 'Log_Volume'))
๐ฎ Interactive Visualization
from pyindicators.visual import launch_visual_tools
# Interactive chart with sliders
launch_visual_tools(data, tool='interactive')
# Strategy builder with drag-and-drop
launch_visual_tools(data, tool='builder')
# Indicator playground
launch_visual_tools(data, tool='playground')
๐จ Smart Error Handling
PyIndicators provides helpful error messages and suggestions:
# Instead of cryptic errors, you get:
โ Column 'Close' not found in DataFrame!
Available columns: ['close', 'high', 'low', 'volume']
Did you mean one of these?
โข close
๐ก Tip: Check your column names are correct. Common issues:
- Case sensitivity (Close vs close)
- Extra spaces in column names
๐๏ธ Performance
Still blazing fast with Numba optimization:
import time
from pyindicators import rsi
# 1 million data points
data = np.random.randn(1_000_000) + 100
start = time.time()
result = rsi(data, period=14)
elapsed = time.time() - start
print(f"Calculated RSI for 1M points in {elapsed:.3f} seconds")
# Output: Calculated RSI for 1M points in 0.045 seconds
๐ Complete Examples
๐ Full Technical Analysis Workflow
from pyindicators.easy import SmartDataFrame
import yfinance as yf
# Load data (or use any CSV/DataFrame)
df = yf.download('AAPL', start='2020-01-01')
# Create smart dataframe with auto-detection
sdf = SmartDataFrame(df)
# Add all indicators
sdf.add_indicators('all')
# Create custom strategy
sdf.add_signal('custom_buy', lambda df:
(df['RSI'] < 30) &
(df['MACD'] > df['MACD_Signal']) &
(df['Close'] < df['BB_Lower'])
)
# Backtest multiple strategies
strategies = ['simple', 'macd_cross', 'bb_bounce', 'trend_follow']
for strategy in strategies:
results = sdf.backtest(strategy=strategy)
print(f"{strategy}: {results['total_return']}")
# Beautiful visualization
sdf.plot(show_signals=True)
# Export results
sdf.df.to_csv('analysis_results.csv')
๐ Streaming Analysis
from pyindicators.streaming import LiveTrader
import yfinance as yf
# Setup live trader
trader = LiveTrader()
# Simulate live data feed
historical_data = yf.download('AAPL', period='1mo', interval='1m')
for timestamp, row in historical_data.iterrows():
tick_data = {
'high': row['High'],
'low': row['Low'],
'close': row['Close'],
'volume': row['Volume']
}
result = trader.on_tick(tick_data)
if result['action']:
print(f"[{timestamp}] {result['action']} signal at ${tick_data['close']:.2f}")
print(f"RSI: {result['indicators'].get('rsi', 'N/A'):.1f}")
# Get performance
performance = trader.get_performance()
print(f"Total PnL: {performance['total_pnl']}")
๐ฏ Strategy Comparison
from pyindicators.pipeline import StrategyPipeline
# Test multiple strategy setups
strategies = {
'Conservative': StrategyPipeline(data).mean_reversion_setup(bb_period=20, rsi_period=21),
'Aggressive': StrategyPipeline(data).trend_following_setup(fast=10, slow=30),
'Breakout': StrategyPipeline(data).breakout_setup(period=15)
}
results = {}
for name, strategy in strategies.items():
df_with_signals = strategy.get()
# Calculate returns for each strategy
# ... backtesting logic
results[name] = performance_metrics
print("Strategy Performance Comparison:")
print(pd.DataFrame(results).T)
๐ Documentation & Tutorials
- Getting Started Guide - Complete beginner tutorial
- API Reference - Full function documentation
- Strategy Guide - Trading strategy examples
- Performance Tips - Optimization techniques
- Jupyter Examples - Interactive notebook tutorials
๐งช Development
Running Tests
# Install development dependencies
pip install -e .[dev]
# Run all tests
pytest
# Run with coverage
pytest --cov=pyindicators --cov-report=html
# Run specific test file
pytest tests/test_pandas_wrapper.py -v
Benchmarking
# Performance benchmarks
python examples/benchmark.py
# Memory usage analysis
python examples/memory_profile.py
Code Quality
# Format code
black pyindicators tests
# Lint code
ruff check pyindicators tests
# Type checking
mypy pyindicators
๐ค Contributing
We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Add tests for your changes
- Ensure all tests pass (
pytest) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ก Ideas for Contributions
- New technical indicators
- Additional trading strategies
- Performance optimizations
- Documentation improvements
- Integration with data providers (Alpha Vantage, Quandl, etc.)
- Additional visualization options
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Numba Team - For the incredible JIT compiler
- Pandas Team - For the amazing DataFrame functionality
- TA-Lib - For inspiration and reference implementations
- Technical Analysis Community - For indicator formulas and expertise
๐ฌ Support & Community
- ๐ Bug Reports: GitHub Issues
- ๐ก Feature Requests: GitHub Discussions
- ๐ง Email: [email protected]
- ๐ฌ Discord: Join our community
โญ Star History
If you find PyIndicators helpful, please give it a โญ๏ธ on GitHub! It helps others discover the project.
Made with โค๏ธ for the trading and data science community
"The best technical analysis library you'll ever use!" - Happy Users
Tags
Similar Tools
Hive
VerifiedOutcome driven agent development framework
Claude Code Repos Index
VerifiedIndex of 75+ Claude Code repos
Serena
VerifiedCoding agent toolkit with semantic retrieval and editing
Claude Bug Catcher
VerifiedHotkey utility for capturing Linux issues
Claude Gdrive Organiser
VerifiedGoogle Drive organization via rclone
Opencti MCP Server
Natural language interface to OpenCTI