Skip to content

Installation guide for Unix alikes

milktrader edited this page Apr 30, 2014 · 1 revision

The following guide assumes you have R installed. If not, please install R first. You will also need svn installed.

Also note that these packages have several dependencies (other packages including xts, quantmod) that you may or may not have already installed. The best way to install these packages is through the R console.

R> install.packages("quantmod")

This is just an example. If this is your first installation, you'll have to install via this method over quite a few packages.

You can also try this method with the blotter family of packages by specifying their repository, like this:

R> install.packages("quantstrat",repos="http://r-forge.r-project.org")

This is unreliable though and doesn't work for every package, including RTAQ.

R> install.packages("RTAQ", repos="http://r-forge.r-project.org")
Warning message:
packageRTAQis not available (for R version 2.15.1) 

A more reliable way to install this bleeding-edge code is to get it onto your computer.

note: the is the shell prompt, many times depicted with a less interesting $ symbol.

✈  svn checkout svn://svn.r-forge.r-project.org/svnroot/blotter/

From here, cd to what you just downloaded and see what you got.

[the_directory_that_I_chose_to_hold_the_svncheckout] 
✈  cd blotter/

[blotter] 
✈  ls
README pkg    tags   www
✈  cd pkg/

[pkg] 
✈  ls
FinancialInstrument RTAQ                blotter             quantstrat

Four packages that need to be installed individually.

[pkg] 
✈  sudo R CMD INSTALL quantstrat && sudo R CMD INSTALL blotter && sudo R CMD INSTALL RTAQ && sudo R CMD INSTALL FinancialInstrument

NOTE: it might be useful to not require sudo to install packages, in which case you need to specify .libPaths() in R in which you have write access.

You should now have the code to begin implementing your trading strategy in R.

Congratulations!