docs(various): Fix typos
parent
6644741ff2
commit
d55e7f1cee
|
@ -1996,7 +1996,7 @@
|
|||
"# You must always create a new efficient frontier object\n",
|
||||
"ef = EfficientFrontier(mu, S)\n",
|
||||
"ef.add_sector_constraints(sector_mapper, sector_lower, sector_upper)\n",
|
||||
"ef.add_objective(objective_functions.L2_reg, gamma=0.1) # gamme is the tuning parameter\n",
|
||||
"ef.add_objective(objective_functions.L2_reg, gamma=0.1) # gamma is the tuning parameter\n",
|
||||
"ef.efficient_risk(0.15)\n",
|
||||
"weights = ef.clean_weights()\n",
|
||||
"weights"
|
||||
|
@ -2074,7 +2074,7 @@
|
|||
"source": [
|
||||
"ef = EfficientFrontier(mu, S)\n",
|
||||
"ef.add_sector_constraints(sector_mapper, sector_lower, sector_upper)\n",
|
||||
"ef.add_objective(objective_functions.L2_reg, gamma=1) # gamme is the tuning parameter\n",
|
||||
"ef.add_objective(objective_functions.L2_reg, gamma=1) # gamma is the tuning parameter\n",
|
||||
"ef.efficient_risk(0.15)\n",
|
||||
"weights = ef.clean_weights()\n",
|
||||
"weights"
|
||||
|
|
|
@ -49,7 +49,7 @@ but I ultimately decided that though BL is not technically an optimizer, it didn
|
|||
split up its methods into `expected_returns` or `risk_models`. I have thus made it an independent
|
||||
module and owing to the comparatively extensive theory, have given it a dedicated documentation page.
|
||||
I'd like to thank `Felipe Schneider <https://github.com/schneiderfelipe>`_ for his multiple
|
||||
contributions to the Black-Litterman implementation. A full example of its usage, including the acquistion
|
||||
contributions to the Black-Litterman implementation. A full example of its usage, including the acquisition
|
||||
of market cap data for free, please refer to the `cookbook recipe <https://github.com/robertmartin8/PyPortfolioOpt/blob/master/cookbook/4-Black-Litterman-Allocation.ipynb>`_.
|
||||
|
||||
.. tip::
|
||||
|
|
|
@ -200,7 +200,7 @@ in anything related to ``max_sharpe()``, ``min_volatility()``, ``efficient_risk(
|
|||
set up a completely new problem to optimize for some custom objective?
|
||||
|
||||
For example, perhaps our objective is to construct a basket of assets that best replicates a
|
||||
particular index, in otherwords, to minimise the **tracking error**. This does not fit within
|
||||
particular index, in other words, to minimise the **tracking error**. This does not fit within
|
||||
a mean-variance optimization paradigm, but we can still implement it in PyPortfolioOpt::
|
||||
|
||||
from pypfopt.base_optimizer import BaseConvexOptimizer
|
||||
|
|
|
@ -515,7 +515,7 @@ def portfolio_performance(
|
|||
:type verbose: bool, optional
|
||||
:param risk_free_rate: risk-free rate of borrowing/lending, defaults to 0.02
|
||||
:type risk_free_rate: float, optional
|
||||
:raises ValueError: if weights have not been calcualted yet
|
||||
:raises ValueError: if weights have not been calculated yet
|
||||
:return: expected return, volatility, Sharpe ratio.
|
||||
:rtype: (float, float, float)
|
||||
"""
|
||||
|
|
|
@ -144,7 +144,7 @@ class BlackLittermanModel(base_optimizer.BaseOptimizer):
|
|||
to be passed).
|
||||
If pi="equal", use an equal-weighted prior.
|
||||
:type pi: np.ndarray, pd.Series, optional
|
||||
:param absolute_views: a colleciton of K absolute views on a subset of assets,
|
||||
:param absolute_views: a collection of K absolute views on a subset of assets,
|
||||
defaults to None. If this is provided, we do not need P, Q.
|
||||
:type absolute_views: pd.Series or dict, optional
|
||||
:param Q: Kx1 views vector, defaults to None
|
||||
|
@ -469,7 +469,7 @@ class BlackLittermanModel(base_optimizer.BaseOptimizer):
|
|||
The period of the risk-free rate should correspond to the
|
||||
frequency of expected returns.
|
||||
:type risk_free_rate: float, optional
|
||||
:raises ValueError: if weights have not been calcualted yet
|
||||
:raises ValueError: if weights have not been calculated yet
|
||||
:return: expected return, volatility, Sharpe ratio.
|
||||
:rtype: (float, float, float)
|
||||
"""
|
||||
|
|
|
@ -103,7 +103,7 @@ class CLA(base_optimizer.BaseOptimizer):
|
|||
|
||||
:param x: argument
|
||||
:type x: float
|
||||
:return: infinity if the argmument was None otherwise x
|
||||
:return: infinity if the argument was None otherwise x
|
||||
:rtype: float
|
||||
"""
|
||||
return float("-inf") if x is None else x
|
||||
|
|
|
@ -216,7 +216,7 @@ class EfficientCDaR(EfficientFrontier):
|
|||
|
||||
:param verbose: whether performance should be printed, defaults to False
|
||||
:type verbose: bool, optional
|
||||
:raises ValueError: if weights have not been calcualted yet
|
||||
:raises ValueError: if weights have not been calculated yet
|
||||
:return: expected return, CDaR.
|
||||
:rtype: (float, float)
|
||||
"""
|
||||
|
|
|
@ -223,7 +223,7 @@ class EfficientCVaR(EfficientFrontier):
|
|||
|
||||
:param verbose: whether performance should be printed, defaults to False
|
||||
:type verbose: bool, optional
|
||||
:raises ValueError: if weights have not been calcualted yet
|
||||
:raises ValueError: if weights have not been calculated yet
|
||||
:return: expected return, CVaR.
|
||||
:rtype: (float, float)
|
||||
"""
|
||||
|
|
|
@ -429,7 +429,7 @@ class EfficientFrontier(base_optimizer.BaseConvexOptimizer):
|
|||
The period of the risk-free rate should correspond to the
|
||||
frequency of expected returns.
|
||||
:type risk_free_rate: float, optional
|
||||
:raises ValueError: if weights have not been calcualted yet
|
||||
:raises ValueError: if weights have not been calculated yet
|
||||
:return: expected return, volatility, Sharpe ratio.
|
||||
:rtype: (float, float, float)
|
||||
"""
|
||||
|
|
|
@ -261,7 +261,7 @@ class EfficientSemivariance(EfficientFrontier):
|
|||
The period of the risk-free rate should correspond to the
|
||||
frequency of expected returns.
|
||||
:type risk_free_rate: float, optional
|
||||
:raises ValueError: if weights have not been calcualted yet
|
||||
:raises ValueError: if weights have not been calculated yet
|
||||
:return: expected return, semideviation, Sortino ratio.
|
||||
:rtype: (float, float, float)
|
||||
"""
|
||||
|
|
|
@ -512,7 +512,7 @@ def test_bl_no_uncertainty():
|
|||
for k, v in viewdict.items():
|
||||
assert np.abs(rets[k] - v) < 1e-5
|
||||
|
||||
# If only one view has 100% confidencee, only that asset will have post = prior.
|
||||
# If only one view has 100% confidence, only that asset will have post = prior.
|
||||
omega = np.diag([0, 0.2, 0.2, 0.2])
|
||||
bl = BlackLittermanModel(S, absolute_views=viewdict, omega=omega)
|
||||
rets = bl.bl_returns()
|
||||
|
|
|
@ -240,7 +240,7 @@ def test_lp_portfolio_allocation():
|
|||
da = DiscreteAllocation(w, latest_prices, short_ratio=0.3)
|
||||
allocation, leftover = da.lp_portfolio()
|
||||
|
||||
# Gives differnt answers on different machines
|
||||
# Gives different answers on different machines
|
||||
# assert allocation == {
|
||||
# "AMD": 1,
|
||||
# "GOOG": 1,
|
||||
|
|
|
@ -1255,7 +1255,7 @@ def test_max_sharpe_short_semicovariance():
|
|||
)
|
||||
|
||||
|
||||
def test_min_volatilty_shrunk_L2_reg():
|
||||
def test_min_volatility_shrunk_L2_reg():
|
||||
df = get_data()
|
||||
ef = setup_efficient_frontier()
|
||||
ef.add_objective(objective_functions.L2_reg)
|
||||
|
|
Loading…
Reference in New Issue