[R] Continuasly Compunded Returns with quantmod-data
R. Michael Weylandt
michael.weylandt at gmail.com
Mon Nov 21 17:58:43 CET 2011
1) It's sort of a cheap trick, but this works flexibly (i.e., you can
put in func(SPY) or func("SPY") and get the same output):
func <- function(y){
if(!require(quantmod)) stop("You need the quantmod package.")
chartSeries(get(getSymbols(as.character(substitute(y)), from =
"2011-11-01")))
}
2) coredata()
Michael
On Mon, Nov 21, 2011 at 10:42 AM, barb <mainzel89 at hotmail.com> wrote:
> Many Thanks - Also for the link!
> It works nice!
>
> If i have further question, can i post them here or should i open a new
> thread?
>
>
> 1)
> If i want the following to make a function:
> I do have to convert it, but i can´t get rid of these " " (brackets).
>
> func<-function(y) {
> library(quantmod)
> getSymbols("y",from="2011-11-01")
> chartSeries(y)
> }
>
> func(MSFT)
>
> 2) How i can get rid of the time dates and get a simple vector?
>
> GOOG.Open
> 2011-11-01 580.10
> 2011-11-02 584.90
> 2011-11-03 587.00
> 2011-11-04 593.50
> 2011-11-07 593.32
> 2011-11-08 609.00
> 2011-11-09 604.26
> 2011-11-10 605.93
> 2011-11-11 601.30
> 2011-11-14 608.00
> 2011-11-15 612.80
> 2011-11-16 612.08
> 2011-11-17 610.05
> 2011-11-18 602.00
>
>
>
> Regards
> Tonio
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Continuously-compounded-Returns-with-quantmod-data-tp4090014p4091937.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list