Closed aloariza closed 2 years ago
Hi @aloariza,
You could do the following:
from pypfopt import objective_functions
te = objective_functions.ex_ante_tracking_error(w, cov_matrix, benchmark_weights)
Where w is the set of optimal weights. Hope this helps!
What are you trying to do? I am optimising a portfolio with weights restriction and with ex_ante_tracking_error used (applied as a convex_function).
The process works fine. I get back weights.
My question is: How can I obtain the value of the tracking error?
Thanks so much in advance.
What have you tried? ef_te_90_pct_co2_reduction = EfficientFrontier(mu, s, weight_bounds=(0, 1)) ef_te_90_pct_co2_reduction.add_constraint( lambda w: carbon_emissions_data['Carbon intensity'].to_list() @ w <= unconstrained_co2_emissions 0.10) ef_te_90_pct_co2_reduction.convex_objective(ex_ante_tracking_error, cov_matrix=ef_te_90_pct_co2_reduction.cov_matrix, benchmark_weights=[1 / number_of_companies] number_of_companies)
What data are you using? What asset class: stocks from Europe, how many assets: 600, how many data points 600stokcks * 3 years.
But data is fine, is working. I just would like to compute the value of the tracking error.