quantmod

How can i see all available data series from quantmod package?

为君一笑 提交于 2019-12-03 06:22:47
问题 How to show which list of all quotes / data series available for example with getSymbols from Yahoo? 回答1: I don't know of a way. The TTR package has a function ( stockSymbols ) to download all the current symbols from the NYSE, AMEX, and NASDAQ. It tries to put them in an acceptable format for Yahoo, but there's no guarantee that the 6,000+ symbols it retrieves have data on Yahoo. I'm not sure what to do for other exchanges... > library(TTR) > x <- stockSymbols() Fetching AMEX symbols...

Parallelize a rolling window regression in R

拥有回忆 提交于 2019-12-03 06:10:11
问题 I'm running a rolling regression very similar to the following code: library(PerformanceAnalytics) library(quantmod) data(managers) FL <- as.formula(Next(HAM1)~HAM1+HAM2+HAM3+HAM4) MyRegression <- function(df,FL) { df <- as.data.frame(df) model <- lm(FL,data=df[1:30,]) predict(model,newdata=df[31,]) } system.time(Result <- rollapply(managers, 31, FUN="MyRegression",FL, by.column = FALSE, align = "right", na.pad = TRUE)) I've got some extra processors, so I'm trying to find a way to

How can i see all available data series from quantmod package?

我是研究僧i 提交于 2019-12-02 19:45:44
How to show which list of all quotes / data series available for example with getSymbols from Yahoo? I don't know of a way. The TTR package has a function ( stockSymbols ) to download all the current symbols from the NYSE, AMEX, and NASDAQ. It tries to put them in an acceptable format for Yahoo, but there's no guarantee that the 6,000+ symbols it retrieves have data on Yahoo. I'm not sure what to do for other exchanges... > library(TTR) > x <- stockSymbols() Fetching AMEX symbols... Fetching NASDAQ symbols... Fetching NYSE symbols... > str(x) 'data.frame': 6473 obs. of 8 variables: $ Symbol :

Modify chart_Series theme

∥☆過路亽.° 提交于 2019-12-02 10:04:51
问题 I am trying to change the colours of the bars using the theme argument, but I get an error: library(quantmod) getSymbols("SPY", from=Sys.Date()-500, to=Sys.Date()) chart_Series(SPY) chart_Series(SPY,theme=chart_theme(dn.col = "cyan")) # Error in chart_theme(dn.col = "cyan") : unused argument (dn.col = "cyan") 回答1: Look at the code. chart_theme takes no arguments, so trying chart_theme(dn.col="cyan") makes no sense. > args(chart_theme) function () NULL chart_theme() returns a list and you want

Modify chart_Series theme

梦想的初衷 提交于 2019-12-02 06:31:44
I am trying to change the colours of the bars using the theme argument, but I get an error: library(quantmod) getSymbols("SPY", from=Sys.Date()-500, to=Sys.Date()) chart_Series(SPY) chart_Series(SPY,theme=chart_theme(dn.col = "cyan")) # Error in chart_theme(dn.col = "cyan") : unused argument (dn.col = "cyan") Look at the code. chart_theme takes no arguments, so trying chart_theme(dn.col="cyan") makes no sense. > args(chart_theme) function () NULL chart_theme() returns a list and you want to modify portions of it, so just do that. myTheme <- chart_theme() myTheme$col$dn.col <- "cyan" chart

adjustOHLC - need solution to loop through character vector of tickers

回眸只為那壹抹淺笑 提交于 2019-12-02 06:19:11
问题 What I want to do is fairly easy but I haven't been able to figure it out. I thought I could do something similar to that outlined here I have a character vector of tickers that are xts OHLC objects returned by getSymbols . I want to loop through each ticker in symbols and pass the symbol to adjustOHLC to adjust for splits: symbols = c("FCX", "SPY") for(symbol in symbols){ return(adjustOHLC(symbol,adjust =c("split"), use.Adjusted=FALSE)) } It seems adjustOHLC does not grab the value of the

getFinancials (quantmod) and tq_get (tidy quant) not working?

六月ゝ 毕业季﹏ 提交于 2019-12-02 05:48:45
问题 I'm getting the same error in both quantmod and tinyquant for financials data. Can anyone see if this is reproducable? Is this a google finance server issue? None of the below functions have been working for me.I'm not sure if it's me or the server. tq_get("AAPL", get= "financials") [1] NA Warning message: x = 'AAPL', get = 'financials': Error in thead[x]:thead[x + 1]: NA/NaN argument and: getFin("AAPL") Error in thead[x]:thead[x + 1] : NA/NaN argument Can somebody help? 回答1: Yes I get the

R quantmod chart_Series: using large fonts for y axis

心不动则不痛 提交于 2019-12-02 04:33:06
I am trying to use a larger font size for those who have poor eyesight. library(quantmod) getSymbols("SPY", from="2013-11-01", to=Sys.Date()) chart_Series(SPY) myPars <-chart_pars() myPars$cex<-1.5 chart1 <- chart_Series(SPY, pars=myPars) chart1 However, when I do this, only a part of the y axis numbers scale are shown. Is it possible to shift the chart, so the y axis numbers scale are not cut off. Thank you for your help. When I try your code (Note this is in R 3.1.0 in R studio though), the y axis numbers scale doesn't appear to be cut off. Nevertheless, you can adjust the chart_pars() (as

convert yyyymm on factor class to character class to be used with ChartSeries()

主宰稳场 提交于 2019-12-02 03:44:25
I read a CSV file using read.csv() command and I want to convert into xts and graph with chartSeries() . I changed into a matrix by doing: MyData <- as.matrix(MyData) When I convert to xts using MyData_xts <- xts(MyData[,-1], order.by=as.POSIXct(MyData[,1])) I get the following error message: Error in as.POSIXlt.character(as.character(x), ...) : character string is not in a standard unambiguous format The column that has my index is in the yyyymm format. I've read that that may be a problem, but I haven't been able to find a way around it. EDIT 1 The CSV read before converting to matrix looks

R - How can I change date format when I plot an xts & zoo object?

大兔子大兔子 提交于 2019-12-02 02:12:35
问题 I am wondering how I can change date format. The code I am working on is following: library(quantmod) getSymbols("AAPL") price_AAPL <- AAPL[,6] plot(price_AAPL, main = "The price of AAPL") This results I want to alter date format from "%m %d %Y" as shown in the graphic to "%b-%d-%Y" So I tried following after searching some tips: plot(price_AAPL, main = "The price of AAPL", xaxt="n") axis.Date(1, at=seq(head(index(price_AAPL),1), tail(index(price_AAPL),1), length.out=5), format="%b-%d-%Y",