# RiskOptima
![image](https://github.com/user-attachments/assets/b9bc3bd0-d8fa-4f01-97e6-44bf4b886bcb)
RiskOptima is a comprehensive Python toolkit for evaluating, managing, and optimizing investment portfolios. This package is designed to empower investors and data scientists by combining financial risk analysis, backtesting, mean-variance optimization, and machine learning capabilities into a single, cohesive package.
## Stats
https://pypistats.org/packages/riskoptima
## Key Features
- Portfolio Optimization: Includes mean-variance optimization, efficient frontier calculation, and maximum Sharpe ratio portfolio construction.
- Risk Management: Compute key financial risk metrics such as Value at Risk (VaR), Conditional Value at Risk (CVaR), volatility, and drawdowns.
- Backtesting Framework: Simulate historical performance of investment strategies and analyze portfolio dynamics over time.
- Machine Learning Integration: Future-ready for implementing machine learning models for predictive analytics and advanced portfolio insights.
- Monte Carlo Simulations: Perform extensive simulations to analyze potential portfolio outcomes. See example here https://github.com/JordiCorbilla/efficient-frontier-monte-carlo-portfolio-optimization
- Comprehensive Financial Metrics: Calculate returns, Sharpe ratios, covariance matrices, and more.
## Installation
See the project here: https://pypi.org/project/riskoptima/
```
pip install riskoptima
```
## Usage
Example 1: Efficient Frontier
```python
from riskoptima import RiskOptima
import pandas as pd
# Download market data
data = RiskOptima.download_data_yfinance(['AAPL', 'MSFT', 'GOOG'], '2022-01-01', '2022-12-31')
daily_returns, cov_matrix = RiskOptima.calculate_statistics(data)
# Calculate Efficient Frontier
mean_returns = daily_returns.mean()
vols, rets, weights = RiskOptima.efficient_frontier(mean_returns, cov_matrix)
# Plot Efficient Frontier
RiskOptima.plot_ef_ax(50, mean_returns, cov_matrix)
```
Example 2: Monte Carlo Simulation
```python
simulated_portfolios, weights_record = RiskOptima.run_monte_carlo_simulation(daily_returns, cov_matrix)
```
Example 3: Macaulay Duration
```
Navigate to -> https://github.com/JordiCorbilla/portfolio_risk_kit/blob/main/portfolio_risk_kit.ipynb
```
## Documentation
For complete documentation and usage examples, visit the GitHub repository:
[RiskOptima GitHub](https://github.com/JordiCorbilla/RiskOptima)
## Contributing
We welcome contributions! If you'd like to improve the package or report issues, please visit the GitHub repository.
## License
RiskOptima is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/JordiCorbilla/RiskOptima",
"name": "riskoptima",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "portfolio, risk, optimization, VaR, backtesting, monte-carlo, machine-learning, random-forest, linear-regression, gradient-boosting, mean-variance, black-litterman",
"author": "Jordi Corbilla",
"author_email": "jordi.coll.corbilla@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c9/49/474a288798c33b3768063eadd037d3410bf3b79181fa8d1bf4017d129b5a/riskoptima-1.10.0.tar.gz",
"platform": null,
"description": "# RiskOptima\n\n![image](https://github.com/user-attachments/assets/b9bc3bd0-d8fa-4f01-97e6-44bf4b886bcb)\n\n\nRiskOptima is a comprehensive Python toolkit for evaluating, managing, and optimizing investment portfolios. This package is designed to empower investors and data scientists by combining financial risk analysis, backtesting, mean-variance optimization, and machine learning capabilities into a single, cohesive package.\n\n## Stats\nhttps://pypistats.org/packages/riskoptima\n\n## Key Features\n\n- Portfolio Optimization: Includes mean-variance optimization, efficient frontier calculation, and maximum Sharpe ratio portfolio construction.\n- Risk Management: Compute key financial risk metrics such as Value at Risk (VaR), Conditional Value at Risk (CVaR), volatility, and drawdowns.\n- Backtesting Framework: Simulate historical performance of investment strategies and analyze portfolio dynamics over time.\n- Machine Learning Integration: Future-ready for implementing machine learning models for predictive analytics and advanced portfolio insights.\n- Monte Carlo Simulations: Perform extensive simulations to analyze potential portfolio outcomes. See example here https://github.com/JordiCorbilla/efficient-frontier-monte-carlo-portfolio-optimization\n- Comprehensive Financial Metrics: Calculate returns, Sharpe ratios, covariance matrices, and more.\n\n## Installation\n\nSee the project here: https://pypi.org/project/riskoptima/\n\n```\npip install riskoptima\n```\n## Usage\n\nExample 1: Efficient Frontier\n```python\nfrom riskoptima import RiskOptima\nimport pandas as pd\n\n# Download market data\ndata = RiskOptima.download_data_yfinance(['AAPL', 'MSFT', 'GOOG'], '2022-01-01', '2022-12-31')\ndaily_returns, cov_matrix = RiskOptima.calculate_statistics(data)\n\n# Calculate Efficient Frontier\nmean_returns = daily_returns.mean()\nvols, rets, weights = RiskOptima.efficient_frontier(mean_returns, cov_matrix)\n\n# Plot Efficient Frontier\nRiskOptima.plot_ef_ax(50, mean_returns, cov_matrix)\n```\nExample 2: Monte Carlo Simulation\n```python\nsimulated_portfolios, weights_record = RiskOptima.run_monte_carlo_simulation(daily_returns, cov_matrix)\n```\n\nExample 3: Macaulay Duration\n```\nNavigate to -> https://github.com/JordiCorbilla/portfolio_risk_kit/blob/main/portfolio_risk_kit.ipynb\n```\n\n## Documentation\n\nFor complete documentation and usage examples, visit the GitHub repository:\n\n[RiskOptima GitHub](https://github.com/JordiCorbilla/RiskOptima)\n\n## Contributing\n\nWe welcome contributions! If you'd like to improve the package or report issues, please visit the GitHub repository.\n\n## License\n\nRiskOptima is licensed under the MIT License.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The RiskOptima toolkit is a comprehensive Python solution designed to assist investors in evaluating, managing, and optimizing the risk of their investment portfolios. This package implements advanced financial metrics and models to compute key risk indicators, including Value at Risk (VaR), Conditional Value at Risk (CVaR), and volatility assessment",
"version": "1.10.0",
"project_urls": {
"Homepage": "https://github.com/JordiCorbilla/RiskOptima",
"Repository": "https://github.com/JordiCorbilla/RiskOptima"
},
"split_keywords": [
"portfolio",
" risk",
" optimization",
" var",
" backtesting",
" monte-carlo",
" machine-learning",
" random-forest",
" linear-regression",
" gradient-boosting",
" mean-variance",
" black-litterman"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "61517c74ffceb7fdfe82951ae95c10fd7f3fa86906451752674b71df7bfaa7eb",
"md5": "6699830deee2933d4876e59d1d312f7c",
"sha256": "b5f9556e5f6ad52c4fa780b411f5c8c52ebeec0cf958ef996d41d55d015f903c"
},
"downloads": -1,
"filename": "riskoptima-1.10.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6699830deee2933d4876e59d1d312f7c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 26476,
"upload_time": "2025-01-14T22:01:09",
"upload_time_iso_8601": "2025-01-14T22:01:09.444766Z",
"url": "https://files.pythonhosted.org/packages/61/51/7c74ffceb7fdfe82951ae95c10fd7f3fa86906451752674b71df7bfaa7eb/riskoptima-1.10.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c949474a288798c33b3768063eadd037d3410bf3b79181fa8d1bf4017d129b5a",
"md5": "ad1735816845c12512bdf4faf4f8866e",
"sha256": "224efd2e143213786754a51455b03fcc9ee251c99bbf8028f1f1ba6134cfb39d"
},
"downloads": -1,
"filename": "riskoptima-1.10.0.tar.gz",
"has_sig": false,
"md5_digest": "ad1735816845c12512bdf4faf4f8866e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 26897,
"upload_time": "2025-01-14T22:01:11",
"upload_time_iso_8601": "2025-01-14T22:01:11.848955Z",
"url": "https://files.pythonhosted.org/packages/c9/49/474a288798c33b3768063eadd037d3410bf3b79181fa8d1bf4017d129b5a/riskoptima-1.10.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-14 22:01:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "JordiCorbilla",
"github_project": "RiskOptima",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "riskoptima"
}