R

getSymbols and Alpha Vantage

Thanks to Paul Teetor, getSymbols() can now import data from Alpha Vantage! This feature is part of the quantmod 0.4-11 release, and provides another another data source to avoid any Yahoo Finance API changes*. Alpha Vantage is a free web service that provides real-time and historical equity data. They provide daily, weekly, and monthly history for both domestic and international markets, with up to 20 years of history. Dividend and split adjusted close prices are available for daily data.

xts 0.10-0 on CRAN!

A new, and long overdue, release of xts is now on CRAN! The major change is the completely new plot.xts() written by Michael Weylandt and Ross Bennett, and which is based on Jeff Ryan’s quantmod::chart_Series() code. Do note that the new plot.xts() includes breaking changes to the original (and rather limited) plot.xts(). However, we believe the new functionality more than compensates for the potential one-time inconvenience. And I will no longer have to tell people that I use plot.

quantmod 0.4-9 on CRAN

A new release of quantmod is now on CRAN! The only change was to address changes to Yahoo! Finance and their effects on getSymbols.yahoo(). GitHub issue #157 contains some details about the fix implementation. Unfortunately, the URL wasn’t the only thing that changed. The actual data available for download changed as well. The most noticeable difference is that the adjusted close column is no longer dividend-adjusted (i.e. it’s only split-adjusted). Also, only the close price is unadjusted; the open, high, and low are split-adjusted.

quantmod 0.4-8 on CRAN

I pushed a bug-fix release of quantmod to CRAN last night. The major changes were to getSymbols.FRED() (#141) getSymbols.oanda() (#144) getSymbols.yahoo() (#149) All three providers made breaking changes to their URLs/interfaces. getSymbols.google() also got some love. It now honors all arguments set via setSymbolLookup() (#138), and it correctly parses the date column in non-English locales (#140). There’s a handy new argument to getDividends(): split.adjust. It allows you to request dividends unadjusted for splits (#128).

Stack Financials: Analyze Financial Statement Data

A quantmod user asked an interesting question on StackOverflow: Looping viewFinancials from quantmod. Basically, they wanted to create a data.frame that contained financial statement data for several companies for several years. I answered their question, and thought others might find the function I wrote useful… hence, this post! I called the function stackFinancials() because it would use getFinancials() and viewFinancials() to pull financial statement data for multiple symbols, and stack them together in long form.

R/Finance 2017: Call for Papers

R/Finance 2017: Applied Finance with R May 19 and 20, 2017 University of Illinois at Chicago The ninth annual R/Finance conference for applied finance using R will be held on May 19 and 20, 2017 in Chicago, IL, USA at the University of Illinois at Chicago. The conference will cover topics including portfolio management, time series analysis, advanced risk tools, high-performance computing, market microstructure, and econometrics. All will be discussed within the context of using R as a primary tool for financial risk management, portfolio construction, and trading.

quantmod 0.4-6 on CRAN

CRAN just accepted a bugfix release of quantmod. The most pertinent changes were to fix getSymbols.oanda (#36) and getOptionChain.yahoo (#92). It also includes a fix to addTRIX (#72). Oanda changed their URL format from http to https, and getSymbols.oanda did not follow the redirect. Yahoo Finance changed the HTML for displaying options data, which broke getOptionChain.yahoo. The fix downloads JSON instead of scraping HTML, so hopefully it will be less likely to break.

DataCamp course: Importing and managing financial data

The team at DataCamp announced a new R/Finance course series in a recent email: Subject: Data Mining Tutorial, R/Finance course series, and more! R/Finance - A new course series in the works We are working on a whole new course series on applied finance using R. This new series will cover topics such as time series (David S. Matteson), portfolio analysis (Kris Boudt), the xts and zoo packages (Jeffrey Ryan), and much more.

Registration for R/Finance 2016 is open!

You can find registration information and agenda details on the conference website. Or you can go directly to the Cvent registration page. Note that registration fees will increase by 50% at the end of early registration on May 6, 2016. The conference will take place on May 20 and 21, at UIC in Chicago. Building on the success of the previous conferences in 2009-2015, we expect more than 250 attendees from around the world.

Comment on Overnight SPY Anomaly

This post is in response to Michael Harris’ Price Action Lab post, where he uses some simple R code to evaluate the asymmetry of returns from the day’s close to the following day’s open. I’d like to respond to his 3 notes, which I’ve included below. The R backtest assumes fractional shares. This means that equity is fully invested at each new position. This is important because it affects drawdown calculations.