jankrepl / deepdow

Portfolio optimization with deep learning.
https://deepdow.readthedocs.io
Apache License 2.0
875 stars 136 forks source link

Short positions #76

Closed gmgreg closed 3 years ago

gmgreg commented 3 years ago

Looking at the allocation layer documentation and not seeing how to handle short positions. E.g. if one was looking to create a market neutral portfolio equal weighted with long and short how might this be modeled?

jankrepl commented 3 years ago

You are right that currently all the implemented allocation layers are long only.

I guess the simplest way to allow for short positions is to drop the w_i > 0 constraints in NumericalMarkowitz - this would require slightly modifying the source code around this line.

In general, you can write your own nn.Module that takes in some input tensor x and spits out the weight allocation over all assets. As long as the weights sum up to one, all the deepdow machinery should work.

jankrepl commented 3 years ago

I am going to close this issue because of inactivity. Feel free to reopen!