quantmod_0.4.22 on CRAN
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
An updated version of quantmod is now on CRAN. It adds functions HL()
, is.HL()
, and has.HL()
to check for ‘high’ and ‘low’ price columns. It also makes accessing Yahoo Finance price, dividend, and split data more robust. getSymbols.FRED()
got to
and from
arguments, like other getSymbols()
methods. The remaining changes are bug fixes and maintenace chores.
This was mainly a maintenance and bug fix release, but it does include a couple nice features. quantmod versions 0.4.17 through 0.4.21 included several relevant features that weren’t highlighted in any previous posts. They’re included in a separate section below.
New Features
-
Exported
HL()
,is.HL()
, andhas.HL()
functions and added documentation. These were added in 0.4.20 but not exported or included in the documentation. -
Switched to the Yahoo Finance v8 JSON endpoint and removed the v7 CSV endpoint. There seems to be a rate limit for the number of tickers you can request via the CSV endpoint. The yfinance python library uses the JSON endpoint and doesn’t seem to have rate limit issues. (#360, #362, #364)
-
getSymbols.FRED()
now supportsto
andfrom
arguments. So users can set the ‘from’ and ‘to’ arguments for FRED data like they can for other data sources like Yahoo. Those values had been ignored and the entire series was always returned. (#368)
Bug Fixes
-
Fixed
getDividends()
andgetSplits()
for stocks that issue monthly dividends. (#372) -
Added error handling to
getSplits()
andgetDividends()
.getDividends()
didn’t handle cases where the download failed, or when dividends needed to be split-adjusted but there were no splits. It also tried to set colnames on the empty xts object that’s returned when there are no dividends.getSplits()
had the same colnames issue. Thanks to Chris Cheung for the report! (#366) -
Remove “^” prefix from
getSymbols()
return value. The name of the objectgetSymbols()
created and the symbol value it returned were inconsistent when the ‘Symbols’ argument has a “^” prefix andauto.assign = TRUE
:getSymbols()
removed the “^” from the object it creates, but- returned the ‘Symbols’ argument unchanged, and
- removed the “^” from the column names of the object it creates.
The example below will create an object named
IXIC
but the value ofsym
will be “^IXIC”.sym <- getSymbols("^IXIC")
That means
x <- get(sym)
will not work because an object named^IXIC
doesn’t exist. (#371)
Chores
-
Moved jsonlite from Suggests to Imports so it doesn’t cause a problem when a package that doesn’t also Suggest jsonlite but uses
getSymbols()
. Thanks to Kurt Hornik for the report and fix! (#380) -
Fixed S3 method issues. R-devel (83995-ish) added a check that found methods that were not registered (
str.replot()
,seriesHi.timeSeries()
, andseriesLo.timeSeries()
). It was also confused byrange.bars()
andunique.formula.names()
because they are named like S3 methods. Neither were exported so they didn’t affect users. Thanks to Kurt Hornik for the report! (#375)
Changes in Prior Versions
New Features
-
Added
HL()
and supporting functions. These are analogues toHLC()
,OHLC()
, etc. Thanks for Karl Gauvin for the nudge to implement them. -
Added adjusted close price to
getSymbols.tiingo()
output. Thanks to Ethan Smith for the suggestion and patch! (#289, #345) -
Updated
getSymbols.tiingo()
to use a Date index for daily data. Thanks to Ethan Smith for the report! (#350) -
Updated
getOptionChain()
to return all the fields that Yahoo Finance provides. Thanks to Adam Childers (@rhizomatican) for the patch! (#318, #336) -
Added orats as a source for
getOptionChain()
. Thanks to Steve Bronder (@SteveBronder) for the suggestion and implementation! (#325) -
Added “Defaults” handling to
getQuote()
andgetQuote.yahoo()
. Thanks to Ethan Smith for the report. (#291) -
Added Bid and Ask fields to the output from
getQuote()
. Thanks to @jrburl for the report and PR. (#302)
Bug Fixes
-
Removed check for Yahoo Finance cookies because the site no longer responds with a cookie, and that caused the connection attempt to fail. This affected
getSymbols()
,getDividends()
, andgetSplits()
. Thanks to several users for reporting, and especially to @pverspeelt and @alihru for investigating potential fixes! (#358) -
Updated
getSymbols.yahooj()
for changes to the web page. (#312) -
Removed unneeded arguments to the
getSymbols.tiingo()
implementation. Thanks to Ethan Smith for the suggestion and patch! (#343, #344) -
Load dividends and splits data into the correct environment when the user provides a value for the
env
argument. The previous behavior always loaded the data into the environment the function was called from. Thanks to Stewart Wright for the report and patch! (#33) -
Improved the error message when
getSymbols()
cannot import data for a symbol because the symbol is not valid or does not have historical data. Thanks to Peter Carl for the report. (#333) -
Fixed the
getMetals()
example in the documentation. The example section previously had an example ofgetFX()
. Thanks to Gerhard Nachtmann (@nachti) for the report and patch! (#330) -
Fixed
getQuote()
so it returns data when the ticker symbol contains an “&”. Thanks to @pankaj3009 for the report! (#324) -
Fixed
addMACD()
whencol
is specified. Thanks to @nvalueanalytics for the report! (#321) -
Fixed issues handling https:// in
getSymbols.yahooj()
. Thanks to @lobo1981 and @tchevri for the reports and Ethan Smith for the suggestion to move from XML to xml2. (#310, #312) -
Fixed
getSymbols.yahoo()
,getDividends()
, andgetSplits()
so they all handle download errors and retry again. Thanks for @helgasoft for the report ongetSymbols.yahoo()
and @msfsalla for the report ongetDividends()
andgetSplits()
. (#307, #314) -
Added implied volatility and last trade date to
getOptionChain()
output. Thanks to @hd2581 and @romanlelek for the reports. And thanks to @rjvelasquezm for noticing the error whenlastTradeDate
isNULL
. (#224, #304) -
Fixed
getOptionChain()
to throw a warning and returnNULL
for every expiry that doesn’t have data. (#299) -
Fixed “Defaults” to handle unexported function (e.g.
getQuote.av()
. Thanks to @helgasoft for the report. (#316) -
importDefaults()
didn’t callget()
on vector with length > 1. Thanks to Kurt Hornik for the report. (#319) -
chartTheme()
now works when quantmod is not attached. Thanks to Kurt Hornik for the report.
If you love using my open-source work (e.g. quantmod, TTR, xts, IBrokers, microbenchmark, etc.), you can give back by sponsoring me on GitHub. I truly appreciate anything you’re willing and able to give!
I look forward to your questions and feedback! If you have a question, please ask on Stack Overflow and use the [r] and [quantmod] tags. Or you can send an email to the R-SIG-Finance mailing list (you must subscribe to post). Open an issue on GitHub if you find a bug or want to request a feature. Please read the contributing guide first! It will help save time for both of us. 😉
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.