Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Question) Disable negative weights/shorting #4

Closed
tatumakseli opened this issue Sep 10, 2020 · 3 comments
Closed

(Question) Disable negative weights/shorting #4

tatumakseli opened this issue Sep 10, 2020 · 3 comments

Comments

@tatumakseli
Copy link

Hi,
I'm building portfolios for my home country's stock market.
However there is limited options for shorting stocks.
Is it possible to run Eiten without allowing negative weight (shorting)?

@regnull
Copy link

regnull commented Sep 10, 2020

I would expect --only_long option to do that, but it doesn't seem to have an effect.

@henryrossiter
Copy link

From what I can tell:

  • The only_long parameter doesn't affect the weight calculation at all (negative weights are always allowed)
  • When running back tests and future tests with only_long enabled, assets with negative weights are treated as if their weight is zero
  • The only_long parameter doesn't affect the monte carlo simulation at all (negative weights are always used)

It seems a bit weird to optimize the portfolio with negative weights and then discard the negative positions during testing.

@tradytics am I correct here?

@tradytics
Copy link
Owner

@henryrossiter - yes, so this is how I've seen others do it too. The simulation should be done after converting the weights to zero so that's an issue. Other than that, people usually don't constrain the weights to be positive during the optimization process but then just convert them to zero during testing or when they actually invest money in the portfolio.

The conversion to zero part during optimization is definitely doable but the optimization problem becomes a bit hard I believe. However, one can always add that constraint in the genetic algorithm as it's quite easy to do that.

Hopefully this answers the OP's question. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants