Enterprise-Grade Quantitative Finance Platform for Professional Developers
MeridianAlgo is the most comprehensive Python platform for institutional quantitative finance, trusted by hedge funds, asset managers, and quantitative researchers worldwide. Features cutting-edge algorithms for market microstructure, statistical arbitrage, optimal execution, high-frequency trading, factor models, and advanced risk management.
Every algorithm is implemented to institutional standards with proper error handling, parameter validation, and performance optimization.
Based on peer-reviewed research from leading academics and practitioners (Almgren & Chriss, Avellaneda & Stoikov, Fama & French, and others).
Over 200 test cases ensuring reliability in production environments.
Clear, complete documentation with mathematical formulations and real-world examples.
# Standard installation
pip install meridianalgo
# With machine learning support
pip install meridianalgo[ml]
# Complete installation (recommended for professionals)
pip install meridianalgo[all]
# Development installation
git clone https://github.com/MeridianAlgo/Python-Packages.git
cd Python-Packages
pip install -e .[dev]import meridianalgo as ma
# Get market data
data = ma.api_get_market_data(['AAPL', 'GOOGL'], '2023-01-01', '2023-12-31')
# Calculate technical indicators
rsi = ma.RSI(data['AAPL'], period=14)
macd_line, signal_line, histogram = ma.MACD(data['AAPL'])
# Risk analysis
metrics = ma.api_calculate_risk_metrics(data['AAPL'].pct_change())
print(f"Sharpe Ratio: {metrics['sharpe_ratio']:.2f}")
print(f"VaR (95%): {metrics['var_95']:.2%}")Professional tools for analyzing market microstructure and order flow:
from meridianalgo.quant import OrderFlowImbalance, RealizedVolatility, MarketImpactModel
# Order flow analysis
ofi = OrderFlowImbalance()
imbalance = ofi.calculate_ofi(bid_volumes, ask_volumes, bid_prices, ask_prices)
# Realized volatility (institutional standard)
rv = RealizedVolatility.rv_5min(high_freq_prices, freq='5min')
bipower_var = RealizedVolatility.bipower_variation(returns)
# Market impact estimation
impact_model = MarketImpactModel()
expected_impact = impact_model.square_root_law(
order_size=10000, daily_volume=500000, sigma=0.02
)Complete framework for statistical arbitrage strategies:
from meridianalgo.quant import PairsTrading, CointegrationAnalyzer, OrnsteinUhlenbeck
# Pairs trading with dynamic hedge ratio
pt = PairsTrading(entry_threshold=2.0, exit_threshold=0.5)
hedge_ratio = pt.calculate_hedge_ratio(stock1, stock2, method='tls')
signals = pt.generate_signals(stock1, stock2, window=20)
# Test for cointegration
analyzer = CointegrationAnalyzer()
result = analyzer.engle_granger_test(stock1, stock2)
# Ornstein-Uhlenbeck process modeling
ou = OrnsteinUhlenbeck()
params = ou.fit(spread_series)
print(f"Half-life: {params['half_life']:.1f} days")Institutional-grade execution algorithms:
from meridianalgo.quant import VWAP, TWAP, ImplementationShortfall
# VWAP execution
vwap = VWAP(total_quantity=10000, start_time='09:30', end_time='16:00')
schedule = vwap.calculate_schedule(historical_volume_profile)
# Implementation Shortfall (Almgren-Chriss)
is_algo = ImplementationShortfall(
total_quantity=50000, total_time=1.0, volatility=0.02, risk_aversion=1e-6
)
trajectory = is_algo.calculate_optimal_trajectory()
cost_analysis = is_algo.calculate_expected_cost()Professional HFT strategies:
from meridianalgo.quant import MarketMaking, LatencyArbitrage, HFTSignalGenerator
# Market making (Avellaneda-Stoikov model)
mm = MarketMaking(target_spread_bps=5.0, max_inventory=1000)
bid_price, ask_price = mm.calculate_quotes(mid_price=100, volatility=0.02)
# Latency arbitrage detection
arb = LatencyArbitrage(latency_threshold_us=100.0, min_profit_bps=1.0)
opportunity = arb.detect_opportunity(venue1_price, venue1_time, venue2_price, venue2_time)Multi-factor models for portfolio construction:
from meridianalgo.quant import FamaFrenchModel, APTModel, FactorRiskDecomposition
# Fama-French three-factor model
ff = FamaFrenchModel(model_type='three_factor')
results = ff.fit(asset_returns, factor_data)
# Factor risk decomposition
decomp = FactorRiskDecomposition.decompose_variance(
portfolio_weights, factor_exposures, factor_covariance, specific_variances
)Advanced regime detection and market state classification:
from meridianalgo.quant import HiddenMarkovModel, StructuralBreakDetection
# Hidden Markov Model for regime detection
hmm = HiddenMarkovModel(n_states=2)
results = hmm.fit(returns)
current_regime = hmm.predict_state(recent_returns).iloc[-1]
# Detect structural breaks
sbd = StructuralBreakDetection()
breaks = sbd.cusum_test(returns)# Maximum Sharpe Ratio
sharpe_weights = ma.api_optimize_portfolio(returns, method='sharpe')
# Black-Litterman Model
bl_model = ma.BlackLitterman(returns, market_caps)
bl_weights = bl_model.optimize_with_views({'AAPL': 0.15, 'MSFT': 0.12})
# Risk Parity
rp_model = ma.RiskParity(returns)
rp_weights = rp_model.optimize()
# Efficient Frontier
frontier = ma.EfficientFrontier(returns)
frontier_data = frontier.calculate_frontier(target_returns)# Value at Risk (Multiple Methods)
historical_var = ma.HistoricalVaR(returns, confidence_level=0.95)
parametric_var = ma.ParametricVaR(returns, confidence_level=0.99)
monte_carlo_var = ma.MonteCarloVaR(returns, n_simulations=10000)
# Expected Shortfall (CVaR)
es = ma.calculate_expected_shortfall(returns, confidence_level=0.95)
# Comprehensive risk metrics
metrics = ma.api_calculate_risk_metrics(returns)# Feature engineering
engineer = ma.FeatureEngineer()
features = engineer.create_features(prices)
# LSTM for price prediction
predictor = ma.LSTMPredictor(sequence_length=60, epochs=100)
X, y = ma.prepare_data_for_lstm(prices.values)
predictor.fit(X_train, y_train)
predictions = predictor.predict(X_test)meridianalgo/
βββ quant/ # Advanced Quantitative Algorithms
β βββ market_microstructure.py # Order flow, realized vol, market impact
β βββ statistical_arbitrage.py # Pairs trading, cointegration
β βββ execution_algorithms.py # VWAP, TWAP, POV, Implementation Shortfall
β βββ high_frequency.py # Market making, latency arbitrage
β βββ factor_models.py # Fama-French, APT, custom factors
β βββ regime_detection.py # HMM, structural breaks
βββ portfolio_management/ # Portfolio optimization
βββ risk_analysis/ # Risk management
βββ backtesting/ # Backtesting engine
βββ technical_indicators/ # 200+ technical indicators
βββ ml/ # Machine learning models
βββ derivatives/ # Options & derivatives
βββ fixed_income/ # Bond pricing
βββ forex/ # FX analysis
βββ crypto/ # Cryptocurrency tools
- Statistical arbitrage strategies
- Multi-factor alpha generation
- High-frequency trading
- Risk-adjusted portfolio construction
- Factor-based investing
- Portfolio optimization (Markowitz, Black-Litterman, Risk Parity)
- Transaction cost analysis
- Performance attribution
- Market microstructure analysis
- Regime detection and forecasting
- Cointegration and mean reversion testing
- Factor model development
- Optimal execution algorithms
- Market making strategies
- Latency arbitrage
- Real-time risk monitoring
# Run all tests
pytest tests/ -v
# Run specific module tests
pytest tests/test_quant.py -v
# Run with coverage
pytest tests/ --cov=meridianalgo --cov-report=html
# Run integration tests
pytest tests/integration/ -vTest Coverage: 200+ test cases | 90%+ code coverage
- API Reference:
docs/api/ - User Guide:
docs/user_guide/ - Tutorials:
docs/tutorials/ - Examples:
examples/
python examples/quant_examples.py # Quant algorithms demo
python examples/advanced_trading_strategy.py # Trading strategy
python examples/basic_usage.py # Getting startedgit clone https://github.com/MeridianAlgo/Python-Packages.git
cd Python-Packages
pip install -e .[dev]
# Run tests
pytest tests/
# Format code
black meridianalgo/
flake8 meridianalgo/We welcome contributions! See CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
- GitHub Issues: Report bugs
- GitHub Discussions: Ask questions
- Email: support@meridianalgo.com
- Documentation: Full docs
@software{meridianalgo2024,
title = {MeridianAlgo: Advanced Quantitative Development Platform},
author = {Meridian Algorithmic Research Team},
year = {2024},
version = {5.0.0},
url = {https://github.com/MeridianAlgo/Python-Packages}
}- Professional Quant Module: Complete suite of institutional-grade algorithms
- Market microstructure analysis (order flow, VPIN, realized volatility)
- Statistical arbitrage (pairs trading, cointegration, OU process)
- Execution algorithms (VWAP, TWAP, POV, Implementation Shortfall)
- High-frequency trading (market making, latency arbitrage)
- Factor models (Fama-French, APT, custom factors)
- Regime detection (HMM, structural breaks, market classification)
- Reorganized package structure for better clarity
- Enhanced documentation with 100+ examples
- Complete test coverage (200+ tests)
- Improved error handling and validation
- Performance optimizations throughout
- New comprehensive README
- Professional examples for all modules
- Updated API documentation
- Real-world use case guides
- 200+ unit tests
- Integration test suite
- Comprehensive test coverage
- Mock data generators
- GPU acceleration for ML models
- Real-time data streaming
- Enhanced visualization tools
- Additional execution algorithms
- Distributed computing support
- Cloud deployment tools
- Advanced options pricing models
- ESG factor integration
MeridianAlgo v5.0.0 - Advanced Quantitative Development Platform
Built by quantitative professionals, for quantitative professionals.
Empowering the next generation of quantitative finance.