Could someone recommend resources (websites, books, mailing lists, forums, anything) about programming in R with use of financial data? Anyone? :)
Some links to get you started:
- the Finance Task View at CRAN (and see some of the links at the bottom of the page)
- the R-SIG-Finance mailing list archive
- the presentations of the R in Finance conference we ran in Chicago last spring
but there is no one-shot textbook I am aware of.
The r-sig-finance list is a great place to ask directed questions relating to financial data. That community is focused on time series analysis and instrument pricing (bonds, options, etc.)
In addition you should check out R Metrics http://www.rmetrics.org/. Also, the CRAN Finance View is another good starting point for learning about pre-existing R packages for working with financial data. http://cran.r-project.org/web/views/Finance.html
I'm sure Dirk (the maintainer of the Finance view, and all round R superstar) will chip in with a decent follow up to your question.
If you are very new to R, I recommend reading Econometrics with R by Farnsworth - it is a great introduction to R and working with econometric series: http://cran.r-project.org/doc/contrib/Farnsworth-EconometricsInR.pdf
There are a number of examples and information in the finance section of the Revolutions blog (which I edit): blog.revolution-computing.com/finance/ .
I also recommend checking out the Rmetrics book, as a guide to the wealth of financial tools available in the Rmetrics packages for R.
Dirk Eddelbuettel has the slides (in PDF format, 892 KB) for his presentation "R in Finance" at the Midwest Finance Association's 58th Annual Meeting, Chicago, 2009-03-05.
There is a list of R resources here:
http://www.revolution-computing.com/community/resources.php
An Introduction to R is a good manual with which to start.
A wothy link of a Zed Shaw blog post talking about statistics from a programmer's point of view titled Programmers Need To Learn Statistics Or I Will Kill Them All: http://www.zedshaw.com/essays/programmer_stats.html
At the bottom of the article there is a section titled Where To Get Help
To get started, look at the contributed documentation on the R web page. Some of them are of book length. The 'Empirical Finance' task view on CRAN gives pointers to useful packages.
After a point there is no substitute for real book. For a survey of statistical techniques in R:
- Venables & Ripley: Modern Applied Statistics in S
For serious development you also need:
- Chambers, Software for Data Analysis: Programming with R
- Venables & Ripley, S Programming
For finance, the following may be of some use:
- Shumway and Stoffer, Time Series and its Applications: with R examples
- Zivot and Wang, Modelling Financial Time Series with S-PLUS
Also look at the "Use R!" series of books brought out by Springer.
Regarding packages, have a look at the econometrics and finance views on CRAN. But I would advise especially focusing in on Rmetrics as a beginner because it was designed with teaching in mind and, while it isn't really a "package" per say, it is none-the-less very self-contained and complete. You should also look at the Rmetrics ebooks if you're interested in pursuing that further.
Having a look at the R in Finance conference. In particular, look at last year's conference where all the presentations were posted.
My favorite technical books on the subject (some overlap with @jmoy's recommendations):
- Modeling Financial Time Series with S-Plus, by Eric Zivot (even though it says S-Plus, it is very relevant)
- Statistics and Finance, by David Ruppert (the R code for the book is available)
- Analysis of Financial Time Series, by Ruey Tsay
- Time Series Analysis, by Jonathan D. Cryer
Beyond that, you may want some general resources, and the "bible" of finance is Options, Futures, and Other Derivatives by John Hull.
Lastly, there are many related questions already posted on stackoverflow, so you should have a look at those as well:
The question is understandable, but in my humble opinion not well posed. R is a statistical language and environment (to quote the FAQ).
So one needs to learn the language, and for that ample other resources exist as e.g. this previous SO question which Shane pointed to rightaway.
One can then apply the language to a given problem domain. And yes, for finance I would start with the CRAN Task View on Empirical Finance which has a number for further links. Suggestions to enhance this task view are also welcome.
The combination of R and Finance is potent: empirical finance is after all in large part a data-driven undertaking and with that a language designed for Programming with Data (to quote Chambers) has tremendous appeal. Which is why we are seeing such an uptick of R in the Finance industry.
I agree with Dirk Eddelbuettel's advice i.e. learn language first and then apply to finance.
Some resources (e.g. websites, pdf's etc.) that you'll be able to get by simple googling that I have found useful for finance are:
- Econometrics in R [Grant Farnsworth]
- Random Portfolios for Evaluating Trading Strategies [Patrick Burns]
- http://www.quantmod.com/
- http://braverock.com/brian/R/PerformanceAnalytics/html/PerformanceAnalytics-package.html
- R Functions for Time Series Analysis [Vince Ricci]
- R Newsletter Volume 7/1 April 2007 - Backtesting portfolios
- Optimal Portfolio Modeling: Models to Maximize Returns and Control Risk in Excel and R [Phil McDonnell]**
**NB - I haven't read this book but have read good reviews and may be worth checking out.