Hi,
I have a time series database of Call options so on each day I have option price of different moneyness for example for january 1, 2015 i have the following data
my purpose is to interpolate Call prices for only 3 values of moneyness (0.97 ; 1 ; 1.06)
to do so I have use the following stata code :
rename moneyness x
rename call_price y
mata
X = st_data(. ,"x")
Y = st_data(. ,"y")
XX = st_data(.,"xx")
A = spline3(X,Y)
B = spline3eval(A,XX)
yy=st_addvar("float", "yy")
st_store(. ,yy,B)
end
browse
and i get this :
Now I want to do the same thing but with data in different dates so for each date(january 1, 2015 and january 2, 2015 for example) I want to apply the spline code and get 3 prices for each moneyness value but I dont know how to do it...
Thank you very much for any help!
Best regards,
Emna
I have a time series database of Call options so on each day I have option price of different moneyness for example for january 1, 2015 i have the following data
date | moneyness | call price |
01/01/15 | 0,960736871 | 0,1 |
01/01/15 | 0,969238937 | 0,24 |
01/01/15 | 0,977892876 | 0,58 |
01/01/15 | 0,986702681 | 1,22 |
01/01/15 | 0,995672703 | 2,24 |
01/01/15 | 1,004807353 | 3,6 |
01/01/15 | 1,014111161 | 5,35 |
01/01/15 | 1,023588777 | 7,55 |
01/01/15 | 1,033245325 | 9,6 |
01/01/15 | 1,043085694 | 11,95 |
01/01/15 | 1,053115368 | 14,4 |
01/01/15 | 1,063339829 | 17 |
01/01/15 | 1,073764682 | 19,25 |
01/01/15 | 1,084396005 | 21,95 |
to do so I have use the following stata code :
rename moneyness x
rename call_price y
mata
X = st_data(. ,"x")
Y = st_data(. ,"y")
XX = st_data(.,"xx")
A = spline3(X,Y)
B = spline3eval(A,XX)
yy=st_addvar("float", "yy")
st_store(. ,yy,B)
end
browse
and i get this :
date | moneyness | call price | xx | yy |
01/01/15 | 0,960736871 | 0,1 | 0,970000029 | 0,260024935 |
01/01/15 | 0,969238937 | 0,24 | 1 | 2,846917629 |
01/01/15 | 0,977892876 | 0,58 | 1,059999943 | 16,18859863 |
01/01/15 | 0,986702681 | 1,22 | ||
01/01/15 | 0,995672703 | 2,24 | ||
01/01/15 | 1,004807353 | 3,6 | ||
01/01/15 | 1,014111161 | 5,35 | ||
01/01/15 | 1,023588777 | 7,55 | ||
01/01/15 | 1,033245325 | 9,6 | ||
01/01/15 | 1,043085694 | 11,95 | ||
01/01/15 | 1,053115368 | 14,4 | ||
01/01/15 | 1,063339829 | 17 | ||
01/01/15 | 1,073764682 | 19,25 | ||
01/01/15 | 1,084396005 | 21,95 |
date | moneyness | call price | xx | yy |
01/01/15 | 0,960736871 | 0,1 | 0,970000029 | 0,260024935 |
01/01/15 | 0,969238937 | 0,24 | 1 | 2,846917629 |
01/01/15 | 0,977892876 | 0,58 | 1,059999943 | 16,18859863 |
01/01/15 | 0,986702681 | 1,22 | ||
01/01/15 | 0,995672703 | 2,24 | ||
01/01/15 | 1,004807353 | 3,6 | ||
01/01/15 | 1,014111161 | 5,35 | ||
01/01/15 | 1,023588777 | 7,55 | ||
01/01/15 | 1,033245325 | 9,6 | ||
01/01/15 | 1,043085694 | 11,95 | ||
01/01/15 | 1,053115368 | 14,4 | ||
01/01/15 | 1,063339829 | 17 | ||
01/01/15 | 1,073764682 | 19,25 | ||
01/01/15 | 1,084396005 | 21,95 | ||
02/01/15 | 0,952399979 | 24,15 | 0,97 | ? |
02/01/15 | 0,976302977 | 26,5 | 1 | ? |
02/01/15 | 1,017591858 | 28,8 | 1,06 | ? |
02/01/15 | 1,079113436 | 31,5 | ||
02/01/15 | 1,140874982 | 34,15 | ||
02/01/15 | 1,152884245 | 35,9 | ||
02/01/15 | 1,165148973 | 39,5 | ||
02/01/15 | 1,177677393 | 41,65 | ||
02/01/15 | 1,190478206 | 44,25 | ||
02/01/15 | 1,203560472 | 45,9 | ||
02/01/15 | 1,21693337 | 48,8 |
Best regards,
Emna
Comment