mirror of
https://github.com/robertmartin8/PyPortfolioOpt.git
synced 2022-11-27 18:02:41 +03:00
improved docstrings
This commit is contained in:
@@ -105,7 +105,7 @@ class BaseScipyOptimizer(BaseOptimizer):
|
|||||||
- ``tickers`` - str list
|
- ``tickers`` - str list
|
||||||
- ``weights`` - np.ndarray
|
- ``weights`` - np.ndarray
|
||||||
- ``bounds`` - float tuple OR (float tuple) list
|
- ``bounds`` - float tuple OR (float tuple) list
|
||||||
- ``initial_guess`` - nnp.ndarray
|
- ``initial_guess`` - np.ndarray
|
||||||
- ``constraints`` - dict list
|
- ``constraints`` - dict list
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -110,6 +110,9 @@ class BlackLittermanModel(base_optimizer.BaseOptimizer):
|
|||||||
- ``bl_weights()`` - weights implied by posterior returns
|
- ``bl_weights()`` - weights implied by posterior returns
|
||||||
- ``portfolio_performance()`` calculates the expected return, volatility
|
- ``portfolio_performance()`` calculates the expected return, volatility
|
||||||
and Sharpe ratio for the allocated portfolio.
|
and Sharpe ratio for the allocated portfolio.
|
||||||
|
- ``set_weights()`` creates self.weights (np.ndarray) from a weights dict
|
||||||
|
- ``clean_weights()`` rounds the weights and clips near-zeros.
|
||||||
|
- ``save_weights_to_file()`` saves the weights to csv, json, or txt.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|||||||
@@ -46,6 +46,17 @@ class CLA(base_optimizer.BaseOptimizer):
|
|||||||
- ``f`` - float list list
|
- ``f`` - float list list
|
||||||
|
|
||||||
- Outputs: ``weights`` - np.ndarray
|
- Outputs: ``weights`` - np.ndarray
|
||||||
|
|
||||||
|
Public methods:
|
||||||
|
|
||||||
|
- ``max_sharpe()`` optimises for maximal Sharpe ratio (a.k.a the tangency portfolio)
|
||||||
|
- ``min_volatility()`` optimises for minimum volatility
|
||||||
|
- ``efficient_frontier()`` computes the entire efficient frontier
|
||||||
|
- ``portfolio_performance()`` calculates the expected return, volatility and Sharpe ratio for
|
||||||
|
the optimised portfolio.
|
||||||
|
- ``set_weights()`` creates self.weights (np.ndarray) from a weights dict
|
||||||
|
- ``clean_weights()`` rounds the weights and clips near-zeros.
|
||||||
|
- ``save_weights_to_file()`` saves the weights to csv, json, or txt.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, expected_returns, cov_matrix, weight_bounds=(0, 1)):
|
def __init__(self, expected_returns, cov_matrix, weight_bounds=(0, 1)):
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ class EfficientFrontier(base_optimizer.BaseScipyOptimizer):
|
|||||||
- ``efficient_return()`` minimises risk for a given target return
|
- ``efficient_return()`` minimises risk for a given target return
|
||||||
- ``portfolio_performance()`` calculates the expected return, volatility and Sharpe ratio for
|
- ``portfolio_performance()`` calculates the expected return, volatility and Sharpe ratio for
|
||||||
the optimised portfolio.
|
the optimised portfolio.
|
||||||
|
- ``set_weights()`` creates self.weights (np.ndarray) from a weights dict
|
||||||
|
- ``clean_weights()`` rounds the weights and clips near-zeros.
|
||||||
|
- ``save_weights_to_file()`` saves the weights to csv, json, or txt.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, expected_returns, cov_matrix, weight_bounds=(0, 1), gamma=0):
|
def __init__(self, expected_returns, cov_matrix, weight_bounds=(0, 1), gamma=0):
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ class HRPOpt(base_optimizer.BaseOptimizer):
|
|||||||
- ``hrp_portfolio()`` calculates weights using HRP
|
- ``hrp_portfolio()`` calculates weights using HRP
|
||||||
- ``portfolio_performance()`` calculates the expected return, volatility and Sharpe ratio for
|
- ``portfolio_performance()`` calculates the expected return, volatility and Sharpe ratio for
|
||||||
the optimised portfolio.
|
the optimised portfolio.
|
||||||
|
- ``set_weights()`` creates self.weights (np.ndarray) from a weights dict
|
||||||
|
- ``clean_weights()`` rounds the weights and clips near-zeros.
|
||||||
|
- ``save_weights_to_file()`` saves the weights to csv, json, or txt.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, returns):
|
def __init__(self, returns):
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ class CVAROpt(base_optimizer.BaseScipyOptimizer):
|
|||||||
|
|
||||||
- ``min_cvar()``
|
- ``min_cvar()``
|
||||||
- ``normalize_weights()``
|
- ``normalize_weights()``
|
||||||
|
- ``set_weights()`` creates self.weights (np.ndarray) from a weights dict
|
||||||
|
- ``clean_weights()`` rounds the weights and clips near-zeros.
|
||||||
|
- ``save_weights_to_file()`` saves the weights to csv, json, or txt.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, returns, weight_bounds=(0, 1)):
|
def __init__(self, returns, weight_bounds=(0, 1)):
|
||||||
|
|||||||
Reference in New Issue
Block a user