xts

R code to rename header of an xts object using name(object) <- vector

旧巷老猫 提交于 2021-02-19 05:38:08
问题 I'm new to learning R and I'm having an issue with some of my R code. I placed all the code for your convenience so that you can see the logic in what I am trying to do. My issue is renaming the header of my xts object Monthly_Quotes. I understand that when having an invalid stock symbol, the getsymbols function will not retrieve the quotes for "zzzz", which is why I am running into the issue of renaming the header. I'd like to resolve this such that if I have a much larger list of ticker

R converting intraday tick dataframe to timesiers

折月煮酒 提交于 2021-02-17 03:01:52
问题 I have an intraday dataframe called SPX containing 5 minute tick data of the SPX index. It is currently in a dataframe and I wish to convert it into a wonderful timeseries. This is what it looks like currently: timestamp open high low close volume 1 2020-04-03 09:35:00 2516. 2524. 2513. 2522. 0 2 2020-04-03 09:40:00 2523. 2528. 2519. 2528. 45796799 3 2020-04-03 09:45:00 2528. 2538. 2526. 2533. 46888484 4 2020-04-03 09:50:00 2533. 2535. 2527. 2528 37476420 5 2020-04-03 09:55:00 2528. 2530.

R converting intraday tick dataframe to timesiers

别等时光非礼了梦想. 提交于 2021-02-17 03:01:03
问题 I have an intraday dataframe called SPX containing 5 minute tick data of the SPX index. It is currently in a dataframe and I wish to convert it into a wonderful timeseries. This is what it looks like currently: timestamp open high low close volume 1 2020-04-03 09:35:00 2516. 2524. 2513. 2522. 0 2 2020-04-03 09:40:00 2523. 2528. 2519. 2528. 45796799 3 2020-04-03 09:45:00 2528. 2538. 2526. 2533. 46888484 4 2020-04-03 09:50:00 2533. 2535. 2527. 2528 37476420 5 2020-04-03 09:55:00 2528. 2530.

how to convert a very large dataset to xts? - as.xts fails on 1.5M rows

梦想的初衷 提交于 2021-02-10 18:43:23
问题 I have the data: dput(head(data)) > dput(head(data)) structure(list(Gmt.time = c("01.06.2015 00:00", "01.06.2015 00:01", "01.06.2015 00:02", "01.06.2015 00:03", "01.06.2015 00:04", "01.06.2015 00:05" ), Open = c(0.88312, 0.88337, 0.88377, 0.88412, 0.88393, 0.8838 ), High = c(0.88337, 0.88378, 0.88418, 0.88418, 0.88393, 0.88393 ), Low = c(0.883, 0.88337, 0.88374, 0.88394, 0.88368, 0.88362 ), Close = c(0.88337, 0.88375, 0.88412, 0.88394, 0.8838, 0.88393 ), Volume = c(83.27, 100.14, 117.18, 52

how to convert a very large dataset to xts? - as.xts fails on 1.5M rows

别来无恙 提交于 2021-02-10 18:41:49
问题 I have the data: dput(head(data)) > dput(head(data)) structure(list(Gmt.time = c("01.06.2015 00:00", "01.06.2015 00:01", "01.06.2015 00:02", "01.06.2015 00:03", "01.06.2015 00:04", "01.06.2015 00:05" ), Open = c(0.88312, 0.88337, 0.88377, 0.88412, 0.88393, 0.8838 ), High = c(0.88337, 0.88378, 0.88418, 0.88418, 0.88393, 0.88393 ), Low = c(0.883, 0.88337, 0.88374, 0.88394, 0.88368, 0.88362 ), Close = c(0.88337, 0.88375, 0.88412, 0.88394, 0.8838, 0.88393 ), Volume = c(83.27, 100.14, 117.18, 52

Conversion to xts does not work because data is of type 'character' and cannot be converted to 'numeric'

◇◆丶佛笑我妖孽 提交于 2021-02-05 05:45:11
问题 I have the following data set data date PX_LAST.USGG10YR Index PX_LAST.GSWISS10 Index 1 2012-12-31 1.7574 0.526 2 2013-01-31 1.9849 0.789 3 2013-02-28 1.8756 0.698 4 2013-03-29 1.8486 0.716 5 2013-04-30 1.6717 0.570 6 2013-05-31 2.1282 0.722 7 2013-06-28 2.4857 1.027 8 2013-07-31 2.5762 1.023 9 2013-08-30 2.7839 1.069 10 2013-09-30 2.6100 1.021 The class of the date column is > class(data[,1]) [1] "POSIXct" "POSIXt" The class of the other two columns is class(data[,2]) [1] "numeric" class

Conversion to xts does not work because data is of type 'character' and cannot be converted to 'numeric'

我怕爱的太早我们不能终老 提交于 2021-02-05 05:43:10
问题 I have the following data set data date PX_LAST.USGG10YR Index PX_LAST.GSWISS10 Index 1 2012-12-31 1.7574 0.526 2 2013-01-31 1.9849 0.789 3 2013-02-28 1.8756 0.698 4 2013-03-29 1.8486 0.716 5 2013-04-30 1.6717 0.570 6 2013-05-31 2.1282 0.722 7 2013-06-28 2.4857 1.027 8 2013-07-31 2.5762 1.023 9 2013-08-30 2.7839 1.069 10 2013-09-30 2.6100 1.021 The class of the date column is > class(data[,1]) [1] "POSIXct" "POSIXt" The class of the other two columns is class(data[,2]) [1] "numeric" class

Faster alternative to function 'rollapply'

霸气de小男生 提交于 2021-02-05 04:50:18
问题 I need to run rolling window function on a xts data which contains about 7,000 rows and 11,000 columns. I did the following: require(PerformanceAnalytics) ssd60<-rollapply(wddxts,width=60,FUN=function(x) SemiDeviation(x),by.column=TRUE) I waited till 12 hours but the computation did not finish. However, when I tried with small dataset as follows: sample<-wddxts[,1:5] ssd60<-rollapply(sample,width=60,FUN=function(x) SemiDeviation(x),by.column=TRUE) the computation was done within 60 seconds. I

Faster alternative to function 'rollapply'

房东的猫 提交于 2021-02-05 04:49:54
问题 I need to run rolling window function on a xts data which contains about 7,000 rows and 11,000 columns. I did the following: require(PerformanceAnalytics) ssd60<-rollapply(wddxts,width=60,FUN=function(x) SemiDeviation(x),by.column=TRUE) I waited till 12 hours but the computation did not finish. However, when I tried with small dataset as follows: sample<-wddxts[,1:5] ssd60<-rollapply(sample,width=60,FUN=function(x) SemiDeviation(x),by.column=TRUE) the computation was done within 60 seconds. I

Shiny Stock Chart Error: chartSeries requires an xtsible object

喜欢而已 提交于 2021-01-29 13:08:04
问题 I have the following code. I want to take the input of a valid stock symbol and render a candlestick plot. I want to give the user the option to switch between 20, 50, and 200 day simple moving averages on the plot as well. However, when I run the app, the mainPanel returns: Error: chartSeries requires an xtsible object. This is my first Shiny App development and I am at a loss as to why it is not working. library(shiny) library(quantmod) library(lubridate) shinyUI(fluidPage( titlePanel(