[R] Finding the nearest data in intraday data from two zoo objects

Santosh Srinivas santosh.srinivas at gmail.com
Wed Nov 24 17:04:14 CET 2010


Hello Group,

I have the following options and future data in zoo objects

> head(optData.z)
                       ExpDt OptTyp Strike TrdPrice TotTrdQty
2009-01-01 09:55:03 20090129      1   2900 180.0000        50
2009-01-01 09:55:31 20090129      1   2900 188.0000        50
2009-01-01 09:55:37 20090129      1   2900 185.0000       500
2009-01-01 09:55:39 20090129      1   2900 185.0000       500
2009-01-01 09:55:47 20090129      1   2900 185.1125       600
2009-01-01 09:55:48 20090129      1   2900 185.2500        50

> head(futData.z)
                       ExpDt OptTyp Strike TrdPrice TotTrdQty
2009-01-01 09:55:09 20090129      2      0 2979.000       900
2009-01-01 09:55:11 20090129      2      0 2976.633       600
2009-01-01 09:55:12 20090129      2      0 2977.211       900
2009-01-01 09:55:14 20090129      2      0 2977.750       800
2009-01-01 09:55:15 20090129      2      0 2977.019      4300
2009-01-01 09:55:16 20090129      2      0 2977.050       800

I want to get the closest available futures price for every option ... Is
there any function like the excel equivalent of approximate VLOOKUP of excel
using date time?

Thank you.



More information about the R-help mailing list