Creating series of spread with / operation

Posted By: Joaquin

Creating series of spread with / operation - 01/03/17 09:10

Hi again,
I've found something weird and I don't know the reason. According to the documentation, one can create artificial series variables of different assets or of different series variables just by doing something like

vars spread = series(asset1[0] + asset2[0]);

Being asset1 and asset2 series of closing prices of 2 different assets.
So far so good. But what I was trying to do was

vars pairsRatio = series(asset1[0] / asset2[0]);

And that operation always gives 1 as a result.
It is not a big problem, as I have seen that

vars pairsRatio = series(asset1[0] * asset2[0]);

works correctly, so with this operation I can get what I was looking for. Just wanted to ask if this behavior with the / operation is normal or not...

Thanks again jcl!
Posted By: jcl

Re: Creating series of spread with / operation - 01/05/17 12:11

No, series(x/y) is not always 1 except when x and y are always equal. So check the values of asset1 and asset2.
Posted By: Joaquin

Re: Creating series of spread with / operation - 01/09/17 10:00

LOL . My fault, x and y were the same... Sorry!
© 2024 lite-C Forums