Import Japanese equity data into R with quantmod 0.4-4

March 10, 2015
By

(This article was first published on FOSS Trading, and kindly contributed to R-bloggers)

I pushed quantmod 0.4-4 to CRAN this weekend.  It adds a getSymbols.yahooj function to pull stock data from Yahoo Finance Japan, and fixes issues in getOptionChain.yahoo and getSymbols.oanda.


Changes to the Yahoo Finance and Oanda websites broke the getOptionChain.yahoo and getSymbols.oanda functions, respectively.  I didn’t use getOptionChain.yahoo much, so I’m not certain I restored all the prior functionality.  Let me know if there’s something I missed. I’d be glad to add a test case for that, or to add a test you’ve written.


The getSymbols.yahooj function is a major enhancement provided by Wouter Thielen.  It allows quantmod users to pull stock data from Yahoo Finance Japan.


Japanese ticker symbols usually start with a number and it is cumbersome to use variable names that start with a number in the R environment, so the string “YJ” will be prepended to each of the Symbols.  I recommend using setSymbolLookup to prepend the ticker symbols with “YJ” yourself, so you can just use the main getSymbols function.


For example, if you want to pull Sony data, you would run:
require(quantmod)
setSymbolLookup(YJ6758.T=’yahooj’)
getSymbols(‘YJ6758.T’)


The full list of supported data sources for quantmod is now: Yahoo Finance-US, Yahoo Finance-Japan, Google Finance, csv, RData (including rds and rda), FRED, SQLite, MySQL, and Oanda.

Contributions to add support for additional data sources are welcomed.  The existing getSymbols functions are good templates to start from.

To leave a comment for the author, please follow the link and comment on their blog: FOSS Trading.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)