Skip to content

Commit 351e13f

Browse files
Fixed bug in example
1 parent 05ed85b commit 351e13f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/GeneralEfficientFrontier.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,19 @@ particular index, in otherwords, to minimise the **tracking error**. This does n
169169
a mean-variance optimization paradigm, but we can still implement it in PyPortfolioOpt::
170170

171171
from pypfopt.base_optimizer import BaseConvexOptimizer
172-
from pypfopt.objective_functions import ex_post_tracking error
172+
from pypfopt.objective_functions import ex_post_tracking_error
173173

174-
historic_returns = ... # dataframe of historic asset returns
175-
S = risk_models.sample_cov(historic_returns, returns_data=True)
174+
historic_rets = ... # dataframe of historic asset returns
175+
benchmark_rets = ... # pd.Series of historic benchmark returns (same index as historic)
176176

177177
opt = BaseConvexOptimizer(
178178
n_assets=len(historic_returns.columns),
179-
tickers=historic_returns.index,
179+
tickers=historic_returns.columns,
180180
weight_bounds=(0, 1)
181181
)
182182
opt.convex_objective(
183-
objective_functions.ex_post_tracking_error,
184-
historic_returns=historical_rets,
183+
ex_post_tracking_error,
184+
historic_returns=historic_rets,
185185
benchmark_returns=benchmark_rets,
186186
)
187187
weights = opt.clean_weights()

0 commit comments

Comments
 (0)