Questions tagged [xts]

xts is an R package that contains an eXtensible Time Series class and methods. xts extends and behaves like zoo.

xts is an package for analysis. It provides uniform handling of R's different time-based data classes by extending the package.

Repositories

Vignettes

Other resources

Related tags

1987 questions
1
vote
0 answers

Dygraph multiple plots - turn them on and off with R and dySeries options

Good afternoon everyone, I am discovering dyGraph for R and it is an amazing tool. I need to plot only two variables ("Lifetime.Engaged.Users" & "Lifetime.Post.Total.Reach") of my 32 variables xts matrix. My problem is as follow, even if I specify…
1
vote
2 answers

Filling higher resolution zoo obj with data from lower resolution zoo obj

I have one zoo object with hourly observations, and one with daily observations. My goal is to merge the two series by the index into one object, where I match daily values with all hourly values of the same date. To be specific, the first object…
zaphoid
  • 98
  • 7
1
vote
0 answers

R xts::plot.xts multi.panel doesn't produce data

R's xtsExtra::plot.xts no longer supports nc and auto.grid. I'm trying to use xts::plot.xts's multi.panel but the first problem is that all panels are blank: $ svn checkout --revision 875 svn://svn.r-forge.r-project.org/svnroot/xts/ $…
kgibm
  • 852
  • 10
  • 22
1
vote
1 answer

Create an xts object in R from multiple Quandl codes

I am trying to pull multiple Quandl codes at the same time into R, and want to end up with a single xts object with [i] columns (plus the date column) containing the data. The function I created to call the data from Quandl seems okay, but I need…
Kenneth K.
  • 25
  • 3
1
vote
1 answer

How to reverse chronological order with getSymbols in R

I download some stock data with quantmod and retrieve the closing prices: require(quantmod) tickers<-c('AAPL','GOOGL') getSymbols(tickers, from="2014-03-01") close <- do.call(merge, lapply(tickers, function(x) Cl(get(x)))) head(close) AAPL.Close…
Rhodo
  • 1,234
  • 4
  • 19
  • 35
1
vote
1 answer

Merging XTS objects

I have 5 XTS objects. Each containing an individual variable returns (various asset classes, e.g. stocks, bonds, hedge funds, etc...) The problem I am having is that the date sequence for each object are not exact. Some dates are missing for some…
fibrou
  • 313
  • 1
  • 5
  • 15
1
vote
1 answer

Storing the xts object returned by getSymbols

I'm trying to collect mutual fund performance data via open and close prices from quantmod. I have scraped a list of 5000 some funds and am trying to loop through and get one open and close price for each fund. I'm having difficulty calling the…
Alan Felix
  • 51
  • 1
  • 3
1
vote
1 answer

Lowering the frequency of a time series and holding same hour of the day in despite of summer time R

I'm trying to go from 5 minute intervals to 4 hours intervals. The POSIXct or zoo/ xts objects work fine. However, I have not been able to create the 4 hours intervals for the same hours of the day every day since summer time or winter, although…
nopeva
  • 1,583
  • 5
  • 22
  • 38
1
vote
1 answer

Replacing values in xts object avoiding subscript out of bounds error

I have an xts object library(xts) A <- xts(c(1,NA,NA,NA,1,NA,NA,NA,NA,1,NA), Sys.Date()-11:1) colnames(A) <- c("A") What I need is: every time we observe a 1 in A, then The next two days should contain also a 1 (the next day here means the next…
Pat
  • 1,299
  • 4
  • 17
  • 40
1
vote
2 answers

Can I create new xts columns from a list of names?

My objective: read data files from yahoo then perform calculations on each xts using lists to create the names of xts and the names of columns to assign results to. Why? I want to perform the same calculations for a large number of xts datasets…
flemingcra
  • 41
  • 3
1
vote
0 answers

R - Quantstrat Issue with prefer and getPrice

Currently working on a strategy in quantstrat using Quandl futures data. However, when I try to applyStrategy() after adding indicators, signals and order rules, I receive the following error message, Error in getPrice(mktdata, prefer = prefer) :…
user6893
  • 143
  • 1
  • 2
  • 9
1
vote
2 answers

Extracting nth day of monthly data in r

I'm facing a problem with making columns using loop. I have a xts dataset and it's second-by-second data. It's start from 2014-09-01 00:00:00 104.172 2014-09-01 00:00:01 104.170 2014-09-01 00:00:02 104.170 2014-09-01 00:00:03 104.170 2014-09-01…
Roki
  • 13
  • 5
1
vote
1 answer

Selecting regular intervals from time series

I am trying to subset intervals based on exact times from an irregular timeseries. The data is CO2 concentration measured every 3 Seconds. There are a few gaps whenever the instrument was connecting to the logger. What I need to do, is substetting…
FlorianFH
  • 13
  • 2
1
vote
0 answers

Apply Bollinger Strategy with to a Portfolio of Assets

I face the following simple trading strategy: Buy: when the price of a stock is above the upper Bollinger band. Sell: when the price of a stock is below the lower Bollinger band. Hold: A buy signal has appeared, so we hold the stock until one…
Pat
  • 1,299
  • 4
  • 17
  • 40
1
vote
1 answer

How to multiply matching columns between lists?

I have 2 lists. One is the stock weights and other the returns. Here is an example: a <- matrix(c(0.15, 0.20, 0.10, 0.30, 0.25), 1,5) colnames(a) <- c("AMBV4", "ARCZ6", "BBAS3", "BBDC4", "BRAP4") b <- matrix(c(0.20, 0.30, 0.40, 0.10),…
Jorge Dias
  • 49
  • 7