[R-SIG-Finance] getSymbols() with various frequency

Steve Hun ch@rch@t28 @end|ng |rom y@hoo@com
Wed Apr 3 20:48:03 CEST 2019


in this small code piece, the return stock prices are default to daily but
intended to be in weekly or monthly format:

for(symbol in symbols){ # establish trade-able instruments
    stock(symbol, currency="USD",multiplier=1)

One way to do that is use to.weekly() function. The issue is symbol (say,
symbol = "SPY") is a character class, not "xts zoo" class so
to.weekly(symbol) would incur errors. to.weekly(SPY) is fine. When the
symbols list is long, this'd become annoying. 

So are there better to convert daily price to weekly/monthly?


	[[alternative HTML version deleted]]

More information about the R-SIG-Finance mailing list