Skip to content

Does the EfficientFrontier with capm_returns and ledoit_wolf assign more weight to recently listed stocks? #514

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)

I have gathered the top 40 US stocks by market cap + a recently listed stock GLBE, and run the above on it

GLBE was listed on May 2021

And I have the following output:
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 Jan 11, 2023
  2. 88d52bdba0366127fffca9dfa93895 commented on Apr 28, 2023

    @88d52bdba0366127fffca9dfa93895
    Collaborator

    Hi @Originn,

    Yes, that is by chance, not by our setup. If you prefer allocations with more recent stocks, you should do it yourself because there is no algorithm or atleast I dont know any algorithm that can do that.

    I am temporarily closing this issue. If you would like to discuss it further, please feel free to reopen it.

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