MeridianAlgo
MeridianAlgo is a Python library for quantitative finance and algorithmic trading. It covers portfolio optimization, risk management, derivatives pricing, backtesting, machine learning, execution algorithms, and more, all in one library.
Installation
pip install meridianalgo
Optional extras add heavier capabilities on demand.
pip install "meridianalgo[ml]" # scikit-learn, torch, statsmodels, hmmlearn
pip install "meridianalgo[optimization]" # cvxpy, cvxopt
pip install "meridianalgo[volatility]" # arch (GARCH family)
pip install "meridianalgo[all]" # everything
Requires Python 3.10 or newer. The core install runs on numpy, pandas, and scipy alone. A feature that needs an optional dependency raises MissingDependencyError naming the extra to install. The package ships a py.typed marker, so type checkers read its annotations directly.
Quick start
import meridianalgo as ma
# Prices to returns and back, periodicity inferred from the index
returns = ma.to_returns(prices)
cagr = ma.annualize_return(returns)
worst = ma.drawdown_table(returns, top=5)
# Top level convenience metrics on a return series
sharpe = ma.calculate_sharpe_ratio(returns)
max_dd = ma.calculate_max_drawdown(returns)
cvar_95 = ma.calculate_expected_shortfall(returns)
# One call summary of around 28 metrics plus a formatted text report
stats = ma.summary_stats(returns)
print(ma.tearsheet(returns))
# Rolling risk, all return a pandas Series aligned to the input
roll_sharpe = ma.rolling_sharpe(returns, window=63)
roll_vol = ma.rolling_volatility(returns, window=63)
drawdown = ma.rolling_drawdown(returns)
# Technical indicators, base install, no extras
rsi = ma.RSI(prices, period=14)
upper, mid, lower = ma.BollingerBands(prices, period=20)
Importing the package is fast and pulls in no heavy dependencies. Names load lazily, so import meridianalgo never imports torch, scikit learn, or statsmodels until you use a feature that needs them.
Portfolio optimization takes annualized expected returns as a pandas Series and a covariance matrix as a pandas DataFrame.
from meridianalgo import MeanVariance
expected_returns = returns.mean() * 252
covariance = returns.cov() * 252
result = MeanVariance().optimize(expected_returns, covariance, objective="max_sharpe")
print(result.weights, result.sharpe_ratio)
What is inside
| Domain | Highlights |
|---|---|
| Portfolio | Mean variance, HRP, Black Litterman, risk parity, Kelly, CPPI |
| Risk | VaR, CVaR, stress testing, scenario analysis, risk budgeting |
| Derivatives | Black Scholes, greeks, implied vol, exotics |
| Volatility | GARCH and the GARCH family, realized vol estimators, regimes |
| Monte Carlo | GBM, Heston, jump diffusion, CIR, variance reduction |
| Credit | Merton model, CDS pricing, Z spread, expected loss |
| Fixed income | Bond pricing, duration, convexity, yield curves |
| Backtesting | Event driven engine, order management, slippage |
| Machine learning | LSTM models, walk forward CV, feature engineering |
| Execution | VWAP, TWAP, POV, implementation shortfall |
| Signals | More than forty technical indicators, functional and OOP APIs |
| Utilities | Return conversion, annualization, resampling, drawdown tables |
Links
- Documentation at https://meridianalgo.readthedocs.io
- Source and issues at https://github.com/MeridianAlgo/Python-Packages
- Changelog at https://github.com/MeridianAlgo/Python-Packages/blob/main/CHANGELOG.md
License
MIT License. For research and educational use. Trading involves substantial risk of loss, and past performance does not guarantee future results.
Metadata
Release files for meridianalgo 7.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| meridianalgo-7.3.0.tar.gz | 433.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| meridianalgo-7.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 838.7 kB
Release files / meridianalgo-7.3.0.tar.gz
| Download URL | meridianalgo-7.3.0.tar.gz |
|---|---|
| Size | 433.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac8cabbde28d1b25bf923f5c09449ed6cdd1c73ef26f8055ee2f4ca76a820351
|
|
BLAKE2b-256 checksum How to use checksums |
e70b17507f8bfaf6ff4dde37b1f1a5f1141ad821dc41633389a918ce0d23802a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / meridianalgo-7.3.0-py3-none-any.whl
| Download URL | meridianalgo-7.3.0-py3-none-any.whl |
|---|---|
| Size | 405.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d57d74dae63e20767b9129963d4240a1d785f0f5a1a7b3dfe7dcaf6e4fea261
|
|
BLAKE2b-256 checksum How to use checksums |
0c0e1ade450d279ef50bd72cb365c884c4b8cb19b2acc044cfe97aa8105003c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|