Skip to content

Question: Does the EfficientFrontier +CAPM + ledoit_wolf give more weight to recently listed stocks? #500

Closed

Description

@Originn

I have the following setup:

S = risk_models.CovarianceShrinkage(prices).ledoit_wolf()
mu = pypfopt.expected_returns.capm_return(prices)
ef = EfficientFrontier(mu, S)
ef.add_objective(objective_functions.L2_reg, gamma=(0.1)) 
ef.efficient_risk(0.025)
weights = ef.clean_weights()
su = pd.DataFrame([weights])
#finding zero weights
num_small = len([k for k in weights if weights[k] <= 1e-4])
global_dict[int(userId)]['num_small'] = str(f"{num_small}/{len(ef.tickers)} tickers have zero weight")
fig = px.pie(su, values=weights.values(), names=su.columns)
fig.update_traces(textposition='inside')
fig.update_layout(width=500, height=500, uniformtext_minsize=12, uniformtext_mode='hide', title_text='Weights Distribution using Capital Asset Pricing Model', title_x=0.5)

And I have the following output:

Price graph showing GLBE was listed on May 2021
image

The weights return of the above code
image

The allocation return of the above code
image

When using another recently listed stock (MNDY) instead of GLBE I get similar results:

image

Is there more weights allocated in this setup to more recently listed stocks? or this is by chance ?

Activity

  1. added
    question
    on Dec 8, 2022
  2. Originn commented on Jan 11, 2023

    @Originn
    Author

    Raising in another question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions