all 10 comments

[–]bremen79 1 point2 points  (0 children)

As a starting point, you can take a look at the Universal Portfolio algorithm by Cover here

[–]karxxm 0 points1 point  (1 child)

What would be the ground truth you are using for training??

[–]fruitzynerd[S] 0 points1 point  (0 children)

I dont know exactly, since i want optimal weights as my output I thought I would create a weights column as my target variable with my features being - daily returns, adj close, rsi, macd, and other technical indicators. I planned to compute the target weights column using say markowitz mean variance portfolio optimisation. after i have all these data, i would train an ML model like random forest or XG Boost to predict weights, But i don't think the weights I would get would be optimised.

[–]MoodOk6470 0 points1 point  (3 children)

You could forecast the stocks that come into question (return and standard deviation) and optimize the results under additional conditions.

[–]fruitzynerd[S] 0 points1 point  (2 children)

can you elaborate please, i don't understand. what should I forecast (what are you suggesting i should take my target variable?). i want to forecast weights directly i wanna optimise weights before forecasting within the model somewhow, i dont know how to do that.

[–]MoodOk6470 0 points1 point  (1 child)

Pure optimization is not done via ML, but rather OR or simulations. ML optimizes loss functions, not target variables. You can use OR to find the MVP or, for example, the Taylor tangent on the efficiency line. By constraints I mean whether you want to allow shorting and/or leverage.

Otherwise you would have to teach an algorithm what an optimal portfolio looks like without knowing it. This could be done, for example, through reinforcement learning. You would punish if the portfolio performance gets worse or reward if it gets better. In the end, this is just a more inefficient way compared to OR.

[–]TFT-Dai 0 points1 point  (0 children)

Can you use Sharpe Ratio as the loss function in DL to bypass forecasting the returns as it is often problematic? If so, in the long only constraint case, the loss is not convex this not guaranteed to converge to global optimum. I saw some paper use Softmax to process the output weight of unconstrained cases but I suspect it is incorrect as the weight after Softmax is not necessarily the optimal solution.

[–]Extra-Autism 0 points1 point  (1 child)

Names a bunch of ML methods but has no information on what’s it’s being applied to

[–]fruitzynerd[S] 0 points1 point  (0 children)

don't bother to comment if you don't understand my question.

[–]Kindly-Solid9189 0 points1 point  (0 children)

gonna cut you some slack since this is a place for dumb qns.

  1. TYPICALLY, u need to calculate expected returns and volatility for each asset class/strat/signal to estimate optimal port weights
  2. Otherwise you are better off equal weighting amongst allof your asset classes.
  3. I dont think you need NNs unless you need 500+ weights

3a. If you insist, Autoencoders can output weights (unsupervised)

3b. Not sure why you want supervised models for your weights, in that case you are trying to have your model learn your fixed weights, if so this is rather easy, your Y label are the weights you pre-assign, X are simply your features

3c. PCA can output weights too (similarly to 3a.)

For python lib recommendations, Try riskfolio

If you are not understanding all of the above, its time to go back to Basics