vendredi 21 février 2020

Generate random weights vector with fixed sum

What I need: I want to create a 10 size vector with random weights. The sum of weights should be equal to 1.

Why I need that: I want to finally calculate the returns of stocks of a randomly diversified portfolio of assets.

Mock Solution: [0.01 0.02 0.07 0.10 0.10 0.05 0.05 .......]. Sum of all elements is 1.




Aucun commentaire:

Enregistrer un commentaire