A Simple Shiny App for Monitoring Trading Strategies

In a previous post I showed how to use  R, Knitr and LaTeX to build a template strategy report. This post goes a step further by making  the analysis  interactive. Besides the interactivity, the Shiny App also solves two problems :

  • I can now access all my trading strategies from a single point regardless of the instrument traded. Coupled with the Shiny interactivity, it allows easier comparison.
  • I can focus on a specific time period.

The code used in this post is available on a Gist/Github repository. There are essentially 3 files.

  • ui.R:  controls the layout and appearance of the app.
  • server.R: contains the instructions needed to build the app.  It loads the data and format it. There is one csv file per strategy each containing at least two columns: date and return with the following format: (“2010-12-22″,”0.04%”  ). You can load as much strategies as you want as long as they have the right format.
  • shinyStrategyGeneral.R: loads the required packages and launches the app.

This app is probably far from perfect and I will certainly improve it in the future. Feel free to get in touch should you have any suggestion.



A big thank you to the RStudio/Shiny team for such a great tool.


5 Responses to “A Simple Shiny App for Monitoring Trading Strategies”

  • Great idea. I just cloned your gist. There is one problem: The getData reads from csv, which are not included. Do you base your app on “downloadable” data, or is it proprietary?

  • Hi Arnaud,

    Nice idea! Can you make a demo which uses non-proprietary data?


  • Following public request I added to the Gist a sample csv file. It has the required format and the right columns names.
    Should you want to use the Shiny App as it is you need 3 csv files with the right format. Each with a name and a path that you specify within the data reactive function (in the server.r file).
    When writing this I realize that the app probably needs a tutorial. I will include one soon.

Leave a Reply