Open research toolkit for portfolio analytics and visualization.
Project description
🧮 PySharpe — Simple, Pandas-Based Portfolio Analytics
PySharpe is a lightweight, open-source portfolio performance analysis library for Python, built entirely on top of pandas and numpy. It enables quantitative investors, researchers, and analysts to easily compute key performance metrics, visualize aggregated returns, and export professional-grade Excel performance reports — all with minimal code.
🚀 Features
Plug-and-Play Analysis: Input a pandas.DataFrame or Series of monthly returns.
Comprehensive Metrics:
CAGR, Volatility, Downside Deviation
Sharpe, Sortino, Beta, Alpha
Max & Average Drawdown, Recovery Time
VaR / CVaR (Expected Shortfall)
Recovery-Scaled Sharpe (RSS)
Benchmark Comparison: Evaluate strategy returns vs. benchmark (e.g., market index).
Monthly and Yearly Aggregation: Easily group and visualize average monthly or yearly returns.
Excel Dashboard Builder:
Automatically generates a full Excel report with formatted tables, performance charts, and growth curves ($100 starting value).
Conditional formatting highlights outperformance vs. benchmark.
Visualization-Ready: Built-in support for matplotlib and plotly.
📦 Installation
pip install pysharpe
(Coming soon — once the package is published on PyPI)
For now, clone the repo:
git clone https://github.com/pysharpe-official/pysharpe.git cd pysharpe pip install -r requirements.txt
🧠 Quick Start
import pandas as pd from pysharpe import QPySharpePanalysis
Example DataFrame
df = pd.DataFrame({ 'date': pd.date_range(start='2018-01-01', periods=48, freq='M'), 'weighted_month_return': np.random.normal(0.01, 0.03, 48), 'market_return': np.random.normal(0.008, 0.025, 48) })
analyzer = pysharpe_basic(df, rf_rate=0.02)
Compute metrics
metrics = analyzer._analyze() print(metrics)
Create full Excel dashboard
analyzer.full_excel_report("portfolio_analysis.xlsx")
📊 Example Output
Sheet 1: Summary metrics (CAGR, Sharpe, Alpha, etc.) Sheet 2: Average monthly returns with bar chart Sheet 3: Yearly and monthly performance history Sheet 4: Growth-of-$100 chart (Strategy vs Benchmark)
🧩 Dependencies
pandas numpy matplotlib xlsxwriter plotly
🧱 Project Goals
PySharpe is designed to:
Simplify quantitative performance analysis for everyday investors Offer a clean pandas-based API with transparent math Generate ready-to-share Excel performance reports Remain fully open-source, extensible, and community-driven
🤝 Contributing
Pull requests are welcome! If you’d like to add features (like rolling stats, drawdown visualizations, or Monte Carlo simulations), fork the repo and open a PR.
📜 License
MIT License © 2025 pysharpe
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysharpe-0.1.0.tar.gz.
File metadata
- Download URL: pysharpe-0.1.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e6ca464b110142dc5ba07d703f9318dc84f5a517958c1a755127f86d9122006
|
|
| MD5 |
e0218e253eab4cf15c598c2736c4fe1e
|
|
| BLAKE2b-256 |
1329a58482d53e0bf0ae5932daf9171e4f0dad50402fff42ab0c198139634e28
|
File details
Details for the file pysharpe-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pysharpe-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f47510a24f0aac65ed2edd8aa7645579dd167f56e64a8df0734bde593b3e0d8d
|
|
| MD5 |
21ba54ac61fecc99d79edc1871a90de5
|
|
| BLAKE2b-256 |
9a8e1f59198f166f4e7520417805e024dda55c1d28784941c38eadc2f0502b39
|