quantmod

Rbind with XTS. How to stack without sorting by index date

痴心易碎 提交于 2021-01-04 02:40:53
问题 I am using quantmod which generates XTS objects with ticker info, and I am looking to compile/stack a bunch of XTS documents on top of each other to process code. Using Rbind with XTS I find that it does not stack XTS on top of each other, rather it merges and sorts by date: x <- xts(1:10, Sys.Date()+1:10) x [,1] 2014-07-10 1 2014-07-11 2 2014-07-12 3 2014-07-13 4 2014-07-14 5 2014-07-15 6 2014-07-16 7 2014-07-17 8 2014-07-18 9 2014-07-19 10 y <- xts(rep(2,3), Sys.Date()+c(1,2,3)) y [,1] 2014

How to loop through objects in the global environment - R

和自甴很熟 提交于 2021-01-03 06:59:50
问题 I have looked far and wide for a solution to this issue, but I cannot seem to figure it out. I do not have much experience working with xts objects in R. I have 40 xts objects (ETF data) and I want to run the quantmod function WeeklyReturn on each of them individually. I have tried to refer to them by using the ls() function: lapply(ls(), weeklyReturn) I have also tried the object() function lapply(object(), weeklyReturn) I have also tried using as.xts() in my call to coerce the ls() objects

How to loop through objects in the global environment - R

纵饮孤独 提交于 2021-01-03 06:59:15
问题 I have looked far and wide for a solution to this issue, but I cannot seem to figure it out. I do not have much experience working with xts objects in R. I have 40 xts objects (ETF data) and I want to run the quantmod function WeeklyReturn on each of them individually. I have tried to refer to them by using the ls() function: lapply(ls(), weeklyReturn) I have also tried the object() function lapply(object(), weeklyReturn) I have also tried using as.xts() in my call to coerce the ls() objects

BatchGetSymbols - reshape output

不羁的心 提交于 2020-06-09 05:20:53
问题 I like to use the advanted of BatchgetSymbols. Any advice how I can best manipulate the output to receive the format below? symbols_RP <- c('VDNR.L','VEUD.L','VDEM.L','IDTL.L','IEMB.L','GLRE.L','IGLN.L') #Setting price download date range from_date <- as.Date('2019-01-01') to_date <- as.Date(Sys.Date()) get.symbol.adjclose <- function(ticker) { l.out <- BatchGetSymbols(symbols_RP, first.date = from_date, last.date = to_date, do.cache=TRUE, freq.data = "daily", do.complete.data = TRUE, do.fill

Downloading FRED data with quantmod: can dates be specified?

*爱你&永不变心* 提交于 2020-06-08 16:47:44
问题 I am downloading data from FRED with the quantmod library (author Jeffrey A. Ryan). With Yahoo and Google data, I am able to set start and end dates. Can the same be done for FRED data? The help page does not list "from" and "to" as options of quantmod's getSymbols function, from which I'm inferring that it is not currently possible. Is there a way to set a range for the data to be downloaded or do I need to download the entire dataset and discard the data I don't need? Thanks for your help.

Y Axis is cut off using Chartseries in R

﹥>﹥吖頭↗ 提交于 2020-02-20 09:22:12
问题 I am using chartSeries and the Y axis is getting cut off. I'd like the price on the right to extend to 2 decimal places. It seems to be an issue of margins or font size, but after doing some searching around, I can't find anywhere to adjust these options. I say margins since there seems to be plenty of space on the left hand side of the chart. Any ideas? Thanks. Here is reproducible code for the above chart: require (zoo) require(quantmod) data <- structure(list(Date = structure(list(sec = c