All,

I have been just recently working with zoo objects for trading systems.

Can someone please help with these basic questions?

Given a daily time series downloaded using get.hist.quote() from the tseries 
package, ie......

startDate= as.Date("2000-01-01")
endDate= as.Date("2011-01-29")
frequency= 'd'

s= get.hist.quote('IWF', start= startDate, end= endDate, 
      compression= 'd', quote= "AdjClose")

tail(s,30)
           AdjClose
2010-12-16    56.85
2010-12-17    56.95
2010-12-20    57.00
2010-12-21    57.32
2010-12-22    57.37
2010-12-23    57.30
2010-12-27    57.30
2010-12-28    57.29
2010-12-29    57.43
2010-12-30    57.34
2010-12-31    57.26
2011-01-03    57.80
2011-01-04    57.55
2011-01-05    57.87
2011-01-06    57.89
2011-01-07    57.81
2011-01-10    57.88
2011-01-11    58.13
2011-01-12    58.60
2011-01-13    58.59
2011-01-14    58.94
2011-01-18    59.20
2011-01-19    58.64
2011-01-20    58.36
2011-01-21    58.33
2011-01-24    58.79
2011-01-25    58.84
2011-01-26    59.24
2011-01-27    59.36
2011-01-28    58.23

How can I extract a time series (a zoo object) containing the price of only the 
last trading day of each week, ie.:

2010-12-17    56.95
2010-12-23    57.30
2010-12-31    57.26
2011-01-07    57.81
2011-01-14    58.94
2011-01-21    58.33
2011-01-28    58.23

Similarly how can I extract a zoo object of only the last trading day of each 
month, ie.

2010-12-31    57.26

Of course in most cases the last trading day is different from the last 
calendar 
day, and I would like to preserve the actual date of the last trading day.

Finally, how can I extract a time series of the prices of only the days of 
options expiration in a particular cycle, such as the third friday of Mar, 
June, 
Sept. and Dec.?

Any help is greatly appreciated.

Regards,

John
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to