quantmod

Does chart_Series() work with logarithmic axis?

放肆的年华 提交于 2019-12-23 20:35:02
问题 Is there a way to produce logarithmic y-axis with chart_Series() ? I am using the experimental chart_Series() rather than the chartSeries() method in quantmod , because it is more convenient when adding additional lines to the plot. library(quantmod) POWR <- getSymbols("POWR", auto.assign=FALSE) # the following attempts did not produce logarithmic axis for y chart_Series(POWR, log.scale=TRUE) # like in chartSeries() chart_Series(POWR, log="y") # like in plot.default() From a quick look into

How can I download a set of prices with getSymbols and store them in the order it was requested?

匆匆过客 提交于 2019-12-23 12:53:21
问题 I download historical prices with quantmod's getSymbols function for multiple tickers and convert them into either a list or a multivariate XTS with the following code: library(quantmod) myenv <- new.env() tickers <- c("^GSPC", "AAPL", "MSFT", "GOOG", "^RUT") getSymbols(tickers, env=myenv) ll <- eapply(myenv, function(x) x) # Convert to list ts <- do.call(merge, (eapply(myenv, Ad))) # Convert to multivariate XTS and extract only the adjusted price The problem I have with this approach is that

chart.Scatter() in PortfolioAnalytics package corrupted

别说谁变了你拦得住时间么 提交于 2019-12-23 06:06:06
问题 Running the short R-code below in R Studio (v1.0.143, Win7, R-3.4.4, Performance Analytics 1.5.2, quantmod 0.4-12) returns the following chart: library(PortfolioAnalytics) library(quantmod) getSymbols("INDU", src = "yahoo", from = "2017-01-01", to = "2017-06-26") getSymbols("VZ", src = "yahoo", from = "2017-01-01", to = "2017-06-26") ret_INDU <- Return.calculate(Cl(INDU))[-1,] ret_VZ <- Return.calculate(Cl(VZ))[-1,] chart.Scatter(ret_INDU, ret_VZ) It looks like something went seriously wrong

Access odd-named object returned by getSymbols

穿精又带淫゛_ 提交于 2019-12-23 05:09:38
问题 I'm downloading data from Yahoo using quantmod : > getSymbols("HNZ-A.TO") [1] "HNZ-A.TO" Warning message: In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, : downloaded length 70893 != reported length 200 The file shows up in my R workspace. The data is there and I can use edit to see the object, but I can't use the object. For example: > head(HNZ-A.TO) Error in head(HNZ - A.TO) : object 'HNZ' not found What can I do to use this object? 回答1: Use back-ticks or get . HNZA.TO

quantmod::getFX function returns “character in a standard unambiguous format”

六月ゝ 毕业季﹏ 提交于 2019-12-22 10:09:09
问题 I have been using quantmod::getFX on an almost daily basis recently, and for some reason today it makes my shiny app crashes. I updated R, all my packages, tried the function on two different computers, but still get the same error. To replicate the problem: library(quantmod) getFX("EUR/USD") The error is: Error in charToDate(x) : character string is not in a standard unambiguous format Let me know if you need further information. 来源: https://stackoverflow.com/questions/43289123/quantmodgetfx

R quantmod:getFinancials

泪湿孤枕 提交于 2019-12-22 09:56:00
问题 I'm trying to import the financials statements of all the companies listed on the NYSE whose market cap is in greater than the first quartile of the sample. Here is my code : require(TTR) require(quantmod) data.init="2013/01/01" start.date <- as.numeric(gsub("/", "",data.init)) nyse.symbols <- stockSymbols("NYSE")[,-c(3,5)] nyse.symbols <- na.omit(nyse.symbols[which(nyse.symbols[,"MarketCap"]>0),]) ######## Selection Criteria # Filter 1 : stock mkt cap > 1st quartile --> remove the less

Pulling Intraday Minute Bar Data with Quantmod in R

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 09:05:36
问题 I expect this is a fairly simple answer (and I will be embarrassed when I see how easy the solution is), but I am having a lot of trouble pulling intraday stock data by minute using the getSymbols() function under the quantmod package. I try to pull data using getSymbols("F") and end up with the following output: > F[1:10] F.Open F.High F.Low F.Close F.Volume F.Adjusted 2007-01-03 7.56 7.67 7.44 7.51 78652200 7.22 2007-01-04 7.56 7.72 7.43 7.70 63454900 7.41 2007-01-05 7.72 7.75 7.57 7.62

R quantmod::getFinancials

血红的双手。 提交于 2019-12-21 20:44:56
问题 I'm using the quantmod package. I've got a vector of tickers like this : c("AAPL","GOOG","IBM","GS","AMZN","GE") and I want to create a function to calculate the EBIT margin of a stock (= operating income / total revenue). So for a given stock, I use the following piece of code which only works for GE (provided a ".f" is added a the end of the ticker) : require(quantmod) getFinancials("GE",period="A") ebit.margin <- function(stock.ticker.f){ return(stock.ticker$IS$A["Operating Income",]/stock

quantmod - SSL: unable to get local issuer certificate in R

Deadly 提交于 2019-12-21 06:39:10
问题 I’m trying to use quantmod package in R to get financial data from Yahoo. It works perfectly on my personal laptops (Mac and Win). But I cannot make it work on my working computer (Win7). My code is: getSymbols("JPM", src = "yahoo") Please note it only doesn't work on my company laptop. Here's the error code: Error in curl::curl_download(cu, tmp, handle = h) : SSL certificate problem: unable to get local issuer certificate I have tried to solve the problems in the following ways: install httr

Quantmod save tickers to files in a loop or lapply

╄→尐↘猪︶ㄣ 提交于 2019-12-21 06:27:08
问题 I am stuck with a minor quantmod problem; if anyone can suggest a tweak to my code, I’d really appreciate that. I don’t know progamming as such; maybe that’s why I miss the obvious. The problem is arising because getSymbols takes a string as input (e.g. "YHOO"), but returns just YHOO (without quotes) as the xts object which holds the data. Also, for market indices, Yahoo includes a caret in the string for the code (e.g. "^GSPC"), but quantmod returns plain GSPC as the data object. I am trying