tradytics / eiten

Statistical and Algorithmic Investing Strategies for Everyone
https://www.tradytics.com/
GNU General Public License v3.0
2.75k stars 323 forks source link

(Question) Disable negative weights/shorting #4

Closed tatumakseli closed 3 years ago

tatumakseli commented 4 years ago

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 commented 4 years ago

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

henryrossiter commented 3 years ago

From what I can tell:

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 commented 3 years ago

@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.