> # Load security data from Yahoo! Finance
> prices1
> prices1
> # To make week end prices:
> nextfri.Date weekly.prices
> # To convert month end prices:
> monthly.prices
> # Convert weekly prices into weekly returns
> r.weekly r1.weekly
> # Convert monthly prices into monthly returns
> r.monthly r1.monthly
> # Write output data to csv file
> write.zoo(r1.weekly, file=”weekly.csv”,sep=”,”,col.names=c(“Dates”,”Percent Return”))
Error: could not find function “write.zoo”
> write.zoo(r1.monthly, file=”monthly.csv”,sep=”,”,col.names=c(“Dates”,”Percent Return”))
Error: could not find function “write.zoo”
>
> # Load security data from Yahoo! Finance
> prices1
> prices1
> # To make week end prices:
> nextfri.Date weekly.prices
> # To convert month end prices:
> monthly.prices
> # Convert weekly prices into weekly returns
> r.weekly r1.weekly
> # Convert monthly prices into monthly returns
> r.monthly r1.monthly
> # Write output data to csv file
> write.zoo(r1.weekly, file=”weekly.csv”,sep=”,”,col.names=c(“Dates”,”Percent Return”))
Error: could not find function “write.zoo”
> write.zoo(r1.monthly, file=”monthly.csv”,sep=”,”,col.names=c(“Dates”,”Percent Return”))
Error: could not find function “write.zoo”
>
I already installed zoo and tseries,but R still can’t find the functions. Please help!
]]>I already installed zoo and tseries,but R still can’t find the functions. Please help!
]]>Hi, thanks for the feedback.
I showed how to download returns for multiple securities in a later post:
http://www.calculatinginvestor.com/2013/09/19/downloading-batch-returns/
-Chad
]]>this is pretty useful. I am trying to figure out however, how you can load data for multiple securities, rather than just for one.
So, I’m wandering how the following needs to be changed
prices1 <- get.hist.quote("SPY", quote="Adj", start="2005-12-25", retclass="zoo")
so that I get data both for SPY and for AGZD for example. Any help will be appreciated
]]>Is there any package that I need to install for using as.yearmon? I have installed the ‘zoo’ package and ‘tseries’ already
]]>I’ll take a look. The “get.hist.quote” function was recently broken because the Yahoo! link changed, and I haven’t updated the script. I was hoping that the function would be updated. Maybe it has and the parameters have changed.
]]>i got error on function na.locf()
should it be an argument in get.hist.quote?
maybe na.omit is sufficient if you’re dealing with securities with the same missing dates?