bulbea
bulbea copied to clipboard
use log returns instead of cummulative returns for split() normalization
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.
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 Scaler
s 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?
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)
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.