Marigold / universal-portfolios

Collection of algorithms for online portfolio selection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Which data format to use with OLMAR?

jirichmel opened this issue · comments

Hello, I have been trying to use the algorithms but since there aren't any docs (just the ipython notebooks) I want to ask what kind of format actually goes into the OLMAR method. Is it the ratio of prices, which is at time t we have price ratio p_t / p_(t-1) which basically means the ratio of the current price and the previous price OR is it the actual price of the asset at time t which should be fed to the algorithm at time t. Thank you.

PS: I have gotten exceptional results on my dataset with the price ratio format and extremely poor results with the actual price format with OLMAR. Given that the ipython notebook uses nyse_o dataset which is 'ratio' and I would choose 'ratio' as the correct format but below this example, the yahoo dataset does not use the 'ratio' price format with OLMAR as it seems. Which format is the correct one?

Yeah, the docs are crap, sorry for that :( All algos (i.e. Algo.run(...)) accept raw price data which are internally converted to whatever you specify with Algo.PRICE_TYPE. So the correct usage is

data = tools.dataset('nyse_o') # returns price data
algo = algos.OLMAR(window=5, eps=10)
result = algo.run(data)

I have gotten exceptional results on my dataset with the price ratio format and extremely poor results with the actual price format with OLMAR

These extremely poor results are correct :). The reason OLMAR works well on price ratio is that it works best for mean-reverting time series (and treats price ratio as raw price).

Okay, that you very much, I just read the code, very nice. One more question: how does the fees work? Does the model account for two fees, e. g. I have stock bought, then sell it for money, pay 0.1% fee and then buy something again so I pay 0.1% fee again. I should pay approximately 0.2% in fees. So do i put result_withou.fee = 0.001 to account for all these fees or result_withou.fee = 0.002 to account for all the fees? Thank you.