Skip to main content

Advanced Algorithmic Trading and Statistical Analysis Library

Project description

MeridianAlgo

PyPI version License: MIT Python Version

Advanced Algorithmic Trading and Statistical Analysis Library

Overview

MeridianAlgo is a comprehensive Python library designed for quantitative finance, algorithmic trading, and statistical analysis. It provides powerful tools for portfolio optimization, time series analysis, statistical arbitrage, and machine learning for financial markets.

Features

  • Portfolio Optimization: Modern portfolio theory implementation with efficient frontier calculation
  • Statistical Analysis: Advanced statistical methods including cointegration, volatility modeling, and risk metrics
  • Machine Learning: Feature engineering and model evaluation for financial time series prediction
  • Data Processing: Efficient tools for handling and preprocessing financial data
  • Risk Management: Value at Risk (VaR), Expected Shortfall (CVaR), and other risk metrics

Installation

pip install meridianalgo

Quick Start

import meridianalgo as ma
import yfinance as yf

# Fetch market data
data = yf.download(['AAPL', 'MSFT', 'GOOGL'], start='2020-01-01')['Adj Close']

# Calculate returns
returns = data.pct_change().dropna()

# Portfolio optimization
optimizer = ma.PortfolioOptimizer(returns)
efficient_frontier = optimizer.calculate_efficient_frontier()

# Statistical analysis
analyzer = ma.StatisticalArbitrage(data)
correlation = analyzer.calculate_rolling_correlation(window=21)

# Calculate risk metrics
var = ma.calculate_value_at_risk(returns['AAPL'])
es = ma.calculate_expected_shortfall(returns['AAPL'])

Documentation

Core Modules

PortfolioOptimizer

Optimize portfolio allocation using modern portfolio theory.

optimizer = ma.PortfolioOptimizer(returns)
frontier = optimizer.calculate_efficient_frontier()

StatisticalArbitrage

Statistical arbitrage and cointegration analysis.

arbitrage = ma.StatisticalArbitrage(data)
cointegration_test = arbitrage.test_cointegration(data['AAPL'], data['MSFT'])

TimeSeriesAnalyzer

Time series analysis and technical indicators.

analyzer = ma.TimeSeriesAnalyzer(data['AAPL'])
volatility = analyzer.calculate_volatility(window=21)

Risk Metrics

  • calculate_value_at_risk(returns, confidence_level=0.95)
  • calculate_expected_shortfall(returns, confidence_level=0.95)
  • calculate_max_drawdown(returns)
  • hurst_exponent(time_series, max_lag=20)

Machine Learning

Feature Engineering

engineer = ma.FeatureEngineer()
features = engineer.create_features(data['AAPL'])

Model Evaluation

metrics = ma.ModelEvaluator.calculate_metrics(y_true, y_pred)
cv_results = ma.ModelEvaluator.time_series_cv(model, X, y)

Examples

See the examples/ directory for complete usage examples:

  1. Portfolio Optimization
  2. Statistical Arbitrage
  3. Time Series Prediction

Requirements

  • Python 3.7+
  • numpy
  • pandas
  • scipy
  • scikit-learn
  • yfinance
  • torch (for deep learning features)

Contributing

Contributions are welcome! Please read our Contributing Guidelines for details on how to submit pull requests, report issues, or suggest features.

License

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

Support

For support, please open an issue on GitHub or contact support@meridianalgo.com


MeridianAlgo is developed and maintained by the Meridian Algorithmic Research Team.

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

meridianalgo-2.2.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

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

meridianalgo-2.2.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file meridianalgo-2.2.0.tar.gz.

File metadata

  • Download URL: meridianalgo-2.2.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for meridianalgo-2.2.0.tar.gz
Algorithm Hash digest
SHA256 01c540dd10e8f0e35346ee97df33c277f8df1cf62d780400c8ad122219a653ca
MD5 52fe53aed1d9042caa1b7df093f53fef
BLAKE2b-256 2cd1769de65696c1d0a62851bdbc24e36e69cb7d17a37109b6c864b37d1a2804

See more details on using hashes here.

File details

Details for the file meridianalgo-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: meridianalgo-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for meridianalgo-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 006e4b81d68d9122d26f2c14695f5de42e7dab749739eee375f7781c695fe01c
MD5 20f78811582236ee92ad9730c13f18bb
BLAKE2b-256 3ba80b4b5069230fbe95a53c0641a6ee2785b35fa3957789070ba4f2a4120822

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