bulbea icon indicating copy to clipboard operation
bulbea copied to clipboard

use log returns instead of cummulative returns for split() normalization

Open zhuoqiang opened this issue 7 years ago • 3 comments

In split() when setting normalize to true, bulbea will use cummulative returns to normalize the data first and then split the data. How about use log returns instead of cummulative returns for normalization?

Log returns are more useful in quant world than cummulative returns.

Cummulative returns hides the short term relative returns. How today's price comparing with yestoday or last month is more important than comparing with the very first inital price (maybe several years before), IMOH.

zhuoqiang avatar Mar 28 '17 07:03 zhuoqiang

I believe the normalisation should be independent of the split. Nonetheless, I can't wrap around how can we go ahead with something like it. For instance, scikit-learn has independent Scalers for pre-processing data. In our case, this highly depends on the window size split needed (which occurs during the split). This can be done for the future (independent scaling objects).

As for now, I'd think of passing an argument to the split function.

split(share, normalize = 'cum')
# OR
split(share, normalize = 'log')

What say?

achillesrasquinha avatar Mar 29 '17 13:03 achillesrasquinha

I like the idea of independent normalization function. It is more flexible and extensible.

while the normalize parameter could use str as argument for build-in normalization functions, it could be even more extensbile to support user defined normalization function as argument directly

def some_normalize(array):
    ....
    return some_changed_array

split(share, normalize=some_normalize)

zhuoqiang avatar Mar 30 '17 02:03 zhuoqiang

Sounds Great! For now, I'll have the option left to both, user defined and normalisation provided by bulbea. Just send in some more normalisation techniques for Financial Data besides cumulative and log returns.

achillesrasquinha avatar Mar 30 '17 03:03 achillesrasquinha