riskoptima 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jordi Corbilla
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.1
2
+ Name: riskoptima
3
+ Version: 1.0.0
4
+ 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
5
+ Home-page: https://github.com/JordiCorbilla/RiskOptima
6
+ License: MIT
7
+ Keywords: portfolio,risk,optimization,VaR,backtesting,monte-carlo
8
+ Author: Jordi Corbilla
9
+ Author-email: jordi.coll.corbilla@gmail.com
10
+ Requires-Python: >=3.12
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Dist: matplotlib (>=3.8.4)
16
+ Requires-Dist: numpy (>=1.26.4)
17
+ Requires-Dist: pandas (>=2.1.4)
18
+ Requires-Dist: scipy (>=1.13.1)
19
+ Requires-Dist: statsmodels (>=0.14.2)
20
+ Requires-Dist: yfinance (>=0.2.51)
21
+ Project-URL: Repository, https://github.com/JordiCorbilla/RiskOptima
22
+ Description-Content-Type: text/markdown
23
+
24
+ # RiskOptima
25
+
26
+ 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.
27
+
28
+ ## Key Features
29
+
30
+ - Portfolio Optimization: Includes mean-variance optimization, efficient frontier calculation, and maximum Sharpe ratio portfolio construction.
31
+ - Risk Management: Compute key financial risk metrics such as Value at Risk (VaR), Conditional Value at Risk (CVaR), volatility, and drawdowns.
32
+ - Backtesting Framework: Simulate historical performance of investment strategies and analyze portfolio dynamics over time.
33
+ - Machine Learning Integration: Future-ready for implementing machine learning models for predictive analytics and advanced portfolio insights.
34
+ - Monte Carlo Simulations: Perform extensive simulations to analyze potential portfolio outcomes.
35
+ - Comprehensive Financial Metrics: Calculate returns, Sharpe ratios, covariance matrices, and more.
36
+
37
+ ## Installation
38
+
39
+ ```
40
+ pip install riskoptima
41
+ ```
42
+ ## Usage
43
+
44
+ Example 1: Efficient Frontier
45
+ ```python
46
+ from riskoptima import RiskOptima
47
+ import pandas as pd
48
+
49
+ # Download market data
50
+ data = RiskOptima.download_data_yfinance(['AAPL', 'MSFT', 'GOOG'], '2022-01-01', '2022-12-31')
51
+ daily_returns, cov_matrix = RiskOptima.calculate_statistics(data)
52
+
53
+ # Calculate Efficient Frontier
54
+ mean_returns = daily_returns.mean()
55
+ vols, rets, weights = RiskOptima.efficient_frontier(mean_returns, cov_matrix)
56
+
57
+ # Plot Efficient Frontier
58
+ RiskOptima.plot_ef_ax(50, mean_returns, cov_matrix)
59
+ ```
60
+ Example 2: Monte Carlo Simulation
61
+ ```python
62
+ simulated_portfolios, weights_record = RiskOptima.run_monte_carlo_simulation(daily_returns, cov_matrix)
63
+ ```
64
+
65
+ Example 3: Macaulay Duration
66
+ ```
67
+ Navigate to -> https://github.com/JordiCorbilla/portfolio_risk_kit/blob/main/portfolio_risk_kit.ipynb
68
+ ```
69
+
70
+ ## Documentation
71
+
72
+ For complete documentation and usage examples, visit the GitHub repository:
73
+
74
+ RiskOptima GitHub
75
+
76
+ ## Contributing
77
+
78
+ We welcome contributions! If you'd like to improve the package or report issues, please visit the GitHub repository.
79
+
80
+ ## License
81
+
82
+ RiskOptima is licensed under the MIT License.
83
+
84
+
@@ -0,0 +1,60 @@
1
+ # RiskOptima
2
+
3
+ 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.
4
+
5
+ ## Key Features
6
+
7
+ - Portfolio Optimization: Includes mean-variance optimization, efficient frontier calculation, and maximum Sharpe ratio portfolio construction.
8
+ - Risk Management: Compute key financial risk metrics such as Value at Risk (VaR), Conditional Value at Risk (CVaR), volatility, and drawdowns.
9
+ - Backtesting Framework: Simulate historical performance of investment strategies and analyze portfolio dynamics over time.
10
+ - Machine Learning Integration: Future-ready for implementing machine learning models for predictive analytics and advanced portfolio insights.
11
+ - Monte Carlo Simulations: Perform extensive simulations to analyze potential portfolio outcomes.
12
+ - Comprehensive Financial Metrics: Calculate returns, Sharpe ratios, covariance matrices, and more.
13
+
14
+ ## Installation
15
+
16
+ ```
17
+ pip install riskoptima
18
+ ```
19
+ ## Usage
20
+
21
+ Example 1: Efficient Frontier
22
+ ```python
23
+ from riskoptima import RiskOptima
24
+ import pandas as pd
25
+
26
+ # Download market data
27
+ data = RiskOptima.download_data_yfinance(['AAPL', 'MSFT', 'GOOG'], '2022-01-01', '2022-12-31')
28
+ daily_returns, cov_matrix = RiskOptima.calculate_statistics(data)
29
+
30
+ # Calculate Efficient Frontier
31
+ mean_returns = daily_returns.mean()
32
+ vols, rets, weights = RiskOptima.efficient_frontier(mean_returns, cov_matrix)
33
+
34
+ # Plot Efficient Frontier
35
+ RiskOptima.plot_ef_ax(50, mean_returns, cov_matrix)
36
+ ```
37
+ Example 2: Monte Carlo Simulation
38
+ ```python
39
+ simulated_portfolios, weights_record = RiskOptima.run_monte_carlo_simulation(daily_returns, cov_matrix)
40
+ ```
41
+
42
+ Example 3: Macaulay Duration
43
+ ```
44
+ Navigate to -> https://github.com/JordiCorbilla/portfolio_risk_kit/blob/main/portfolio_risk_kit.ipynb
45
+ ```
46
+
47
+ ## Documentation
48
+
49
+ For complete documentation and usage examples, visit the GitHub repository:
50
+
51
+ RiskOptima GitHub
52
+
53
+ ## Contributing
54
+
55
+ We welcome contributions! If you'd like to improve the package or report issues, please visit the GitHub repository.
56
+
57
+ ## License
58
+
59
+ RiskOptima is licensed under the MIT License.
60
+
@@ -0,0 +1,26 @@
1
+ [tool.poetry]
2
+ name = "riskoptima"
3
+ version = "1.0.0"
4
+ description = "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"
5
+ authors = ["Jordi Corbilla <jordi.coll.corbilla@gmail.com>"]
6
+ license = "MIT"
7
+ readme = "README.md"
8
+ homepage = "https://github.com/JordiCorbilla/RiskOptima"
9
+ repository = "https://github.com/JordiCorbilla/RiskOptima"
10
+ keywords = ["portfolio", "risk", "optimization", "VaR", "backtesting", "monte-carlo"]
11
+
12
+ [tool.poetry.dependencies]
13
+ python = ">=3.12"
14
+ numpy = ">=1.26.4"
15
+ pandas = ">=2.1.4"
16
+ scipy = ">=1.13.1"
17
+ statsmodels = ">=0.14.2"
18
+ yfinance = ">=0.2.51"
19
+ matplotlib = ">=3.8.4"
20
+
21
+ [build-system]
22
+ requires = ["poetry-core"]
23
+ build-backend = "poetry.core.masonry.api"
24
+
25
+
26
+
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ #----------------------------------------------------------------------------
4
+ # Created By : Jordi Corbilla
5
+ # Created Date: 2023
6
+ # version ='0.7.0'
7
+ # ---------------------------------------------------------------------------
8
+
9
+ from tablepy_lib.consoleFormatter import markdown
10
+ from tablepy_lib.consoleFormatter import sql_insert
11
+ from tablepy_lib.consoleFormatter import formatter
12
+ from tablepy_lib.consoleFormatter import ConsoleFormatter