So I am interning as a quant analyst at a hedge fund this summer. My job involves researching, developing and testing algortihmic trading strategies. For most of my work I use R, a software package for data analysis. The term ‘big data‘ is being thrown around quite a bit these days. If you’re looking to get in on some of that action, I would suggest starting off with R. In the following few posts, I will write out the different things I learn on how R is used in a finance-centric context. Many of these overlap with fields such as Bio-Statistics, Robotics, Econometrics etc so these techqniques should be broadly applicable across anything requiring data analysis, particularly time-series analysis.
To start off, I run R on Ubuntu. I think R comes pre-installed on Ubuntu distributions but it is not difficult to install on Windows/Mac as well. I use the front-end RKward as a GUI for R. RKward can be downloaded from the Ubuntu Software Center and is also available for Windows and Mac from sourceforge. Download and installation instructions for both R and RKward abound on the internet, so use google.
After RKward and R are set up, the first thing you need to do is download a few packages. Packages are collections of pre-written functions or scripts which can save you from having to write your own code. As R is open source, there are many many packages to be found. This is one of the best things about R and what makes it so popular. If you are looking for a function which you think may be commonly used, it probably exists already in a package somewhere. Use google, find the package, and install it.
The three packages we need to start off with are ‘fortunes‘, ‘quantmod’ and ‘PerformanceAnalytics’. To install packages, open up RKward, click on the console tab at the bottom, so the console opens up and type in install.packages(‘PackageName’).
To load the package after install, type in library(‘PackageName’). You will have to load the packages every time you start up RKward, however, you can modify your R profile to have this done automatically. Instructions for doing just this reside at http://www.statmethods.net/interface/customizing.html.
Fortunes is a fun little package with just one function, fortune(), which gives you an R-related quote everytime you run it. Quantmod is a large package containing a lot of general functions for quantative finance and PerformanceAnalytics provides functions to help analyze the various risk and return characteristics of your instruments/securities.