rquantmodquantstratblotter

R Packages Blotter and Quantstrat: Extend framework to implement signal based on fundamental data?


I am looking for a way to extend Quantstrat in order to fetch data from bloomberg using the rbbg package and to backtest strategies based on indicators which are calculated using fundamental data.

Is there any documentation on what's the best way to extend the packages accordingly? I mean with regard to entrypoints, already implemented extenstions etc.? I am not looking for step by step instructions but rather for pointers on where to start so that I can integrate the functionality as smooth as possible (or as the original authors would have intended it).

Thx in advance


Solution

  • I would say that the 2013 R in Finance presentation on the quantstrat package is a good start. On page 8 you clearly see that quantstrat is one in many building block in a research/trading production environment.

    As the presentation also shows, there are many ways to get daily data for free through quantmod etc. (see page 8 again). But addressing your question the best way to get market data into quantstrat from Bloomberg is to use our RbbgExtension package (I know it is shameless self-promotion) that is a more intuitive wrapper to the Rbbg package. I am of course biased about my recommendation, but I believe it is worth a try on your part.

    You install RbbgExtension like this...

    require(devtools)

    install_github("pgarnry/RbbgExtension")

    Below is an example that mimics the GBPUSD example in the presentation on page 16.

    require(RbbgExtension) require(quantmod)

    GBPUSD <- BarData(tickers = "GBPUSD", type = "Curncy", start.date = "2015-03-02", start.time = "00:00:00", end.date = "2015-03-30", end.time = "00:00:00", interval = "30")

    GBPUSD <- GBPUSD[, 1:4]

    chartSeries(GBPUSD)

    Here is a chart of GBPUSD for March.

    enter image description here Source: Bloomberg

    With this xts object you can put into quantstrat engine and build your signals etc.