Marigold / universal-portfolios

Collection of algorithms for online portfolio selection
Other
779 stars 214 forks source link

Anticor Bug fix for undefined correlation #111

Open Aguspanale opened 4 months ago

Aguspanale commented 4 months ago

Stumbled upon NAN values while using the ANTICOR implementation, the original paper states that :

(page 6) We note that if sigma1(i) (respectively, sigma2(j)) is zero over some window then the growth rate of stock i during the second last window (respectively, stock j during the last window) is constant during this window. For sufficiently large windows of time constant growth of any stock i is unlikely. However, in this unlikely case we choose not to move money into or out of such a stock i.12.

To make the implementation take this detail into account, i simply skipped transfers that could have NAN values from an undefined correlation.