Skip to content

SundayTheQuant/polars-talis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Polars-Talis πŸ“ˆ

GoSignal Logo

πŸš€ Powered by GoSignal - Advanced Trading Intelligence

Python 3.8+ License: MIT Polars PyPI version

A high-performance technical analysis library built on top of Polars, designed for financial data analysis with parallel processing capabilities.

🌟 Features

  • Lightning Fast: Built on Polars' optimized DataFrame operations
  • Parallel Processing: Execute multiple indicators simultaneously
  • Type Safe: Full type hints and validation
  • Extensible: Easy to add custom indicators
  • Memory Efficient: Leverages Polars' memory optimization
  • Thread Safe: Concurrent execution without data races

Available Indicators

Trend Indicators

  • SMA (Simple Moving Average)
  • EMA (Exponential Moving Average)

Momentum Indicators

  • RSI (Relative Strength Index)
  • MACD (Moving Average Convergence Divergence)

Volatility Indicators

  • Bollinger Bands

πŸš€ Installation

pip install polars-talis

Or install from source:

git clone https://github.com/yourusername/polars-ta.git
cd polars-ta
pip install -e .

πŸ“– Quick Start

import polars as pl
from polars_talis import TechnicalAnalyzer, SMA, EMA, RSI, MACD, BollingerBands

# Load your data
df = pl.DataFrame({
    "date": ["2023-01-01", "2023-01-02", "2023-01-03"],  # Your dates
    "close": [100.0, 102.5, 101.8],  # Your price data
    "volume": [1000, 1200, 950]  # Your volume data
})

# Create analyzer with multiple indicators
analyzer = TechnicalAnalyzer(max_workers=4)
analyzer.add_indicators([
    SMA(20),           # 20-period Simple Moving Average
    EMA(12),           # 12-period Exponential Moving Average  
    RSI(14),           # 14-period RSI
    MACD(),            # MACD with default parameters
    BollingerBands(20, 2.0)  # 20-period BB with 2 std dev
])

# Calculate all indicators (parallel execution)
result = analyzer.calculate(df, parallel=True)

print(result.columns)
# ['date', 'close', 'volume', 'SMA_20', 'EMA_12', 'RSI_14', 'MACD', 'MACD_signal', 'BB_upper', 'BB_middle', 'BB_lower']

πŸ”§ Advanced Usage

Custom Indicator Configuration

from polars_talis import SMA

# Custom column and name
sma_custom = SMA(period=50, column="high", name="SMA_High_50")

# Add to analyzer
analyzer.add_indicator(sma_custom)

Performance Monitoring

# Get summary of configured indicators
summary = analyzer.get_summary()
print(summary)
# {
#     'total_indicators': 5,
#     'by_type': {'trend': 2, 'momentum': 2, 'volatility': 1},
#     'indicators': [...]
# }

Error Handling

try:
    result = analyzer.calculate(df)
except ValueError as e:
    print(f"Data validation error: {e}")
except Exception as e:
    print(f"Calculation error: {e}")

πŸ—οΈ Architecture

Polars-Talis is built with a modular architecture:

polars_talis/
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ base.py          # Base classes and types
β”‚   └── analyzer.py      # Main analyzer engine
└── indicators/
    β”œβ”€β”€ trend.py         # Trend indicators
    β”œβ”€β”€ momentum.py      # Momentum indicators
    └── volatility.py    # Volatility indicators

Key Components

  • BaseIndicator: Abstract base class for all indicators
  • IndicatorConfig: Configuration dataclass for indicators
  • TechnicalAnalyzer: Main engine for parallel indicator execution
  • IndicatorType: Enumeration of indicator categories

πŸ“Š Visualizations

Polars-Talis comes with beautiful built-in visualizations to help you understand your technical analysis results:

πŸ“ˆ Price Trends with Moving Averages

Price Trends

πŸ“Š Bollinger Bands Analysis

Bollinger Bands

⚑ Momentum Indicators (RSI & MACD)

Momentum Indicators

Generate Your Own Charts

Run the example script to create these visualizations:

cd examples
python create_visualizations.py

This will generate professional charts showing:

  • Price action with trend indicators (SMA, EMA)
  • Bollinger Bands volatility analysis
  • Momentum indicators (RSI, MACD) with trading signals

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-indicator)
  3. Commit your changes (git commit -m 'Add amazing indicator')
  4. Push to the branch (git push origin feature/amazing-indicator)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

⭐ Star History

Star History Chart

πŸ™ Acknowledgments

  • Built on top of the amazing Polars library
  • Inspired by traditional TA libraries like TA-Lib
  • Powered by GoSignal - Advanced Trading Intelligence πŸš€

For questions, suggestions, or support, please open an issue or contact us through GoSignal.

About

technical analysis library built with polars

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages