Recently I wrote a program in Python which extracts stock data for a designated period and frequency of the predetermined stocks and then optimises the portfolio using the Sharpe ratio. In order to generate the different kinds of weights, I wrote a generator that gives me all the possible weights (all weights are non-negative and have to sum to 100).
Now the problem with this is that while I can still confidently simulate a 5 stock portfolio (which takes about 5 minutes), simulating a 6 stock portfolio would take up to 10 hours on my machine, given all the possible distributions of weights (if I recall correctly it should be around 96 millions). I would want to push this as far as possible, optimally to a point where the gains from un-systematic risk reduction are minimal as a consequence of adding additional stocks.
Now my question is what are the "smart ways" to do this (obviously the way I am using is neat since you get all the possible outcomes, but cant be considered seriously given the resource and time intensity)? What kind of optimisation techniques would one use in order to make this process faster?
I am not searching for any single solution, but rather for an elaboration as to what optimization techniques exist out there, that could be used in order to approach this problem and what are their advantages or/and disadvantages.
Thank you for any suggestions!