Skip to main content

A high-performance technical analysis library built on top of Polars

Project description

Polars-Talis 📈

GoSignal Logo

🚀 Powered by GoSignal - Advanced Trading Intelligence

Python 3.8+ License: MIT Polars

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.

🙏 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polars_talis-0.1.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polars_talis-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file polars_talis-0.1.0.tar.gz.

File metadata

  • Download URL: polars_talis-0.1.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for polars_talis-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ed721544346ab9d8e587cc254a1511509ca8cd5680df3129b2c76d63e6e66c07
MD5 0c5c71da63a75509fb88ef47686cf92c
BLAKE2b-256 be5b024bf5b8f754dbab3ed31c0b896868b0517e5f7ebf12e7d8736576c1751c

See more details on using hashes here.

File details

Details for the file polars_talis-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: polars_talis-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for polars_talis-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10354bf3e7dc817d62e31c00d8a7f5d277ef3fe2348da5e3e95a01b7df39ae1e
MD5 66abde683d9ea764097ae4f91e9ce067
BLAKE2b-256 d2be4a8df7e18c51840f38bda5a2838e57fd222277291285b6844bbd37a9b20a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page