Trading Strategies Performance Report with R and Knitr
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
I’ve been looking for template reports using R and Knitr for a while but I didn’t find anything that suits my needs so far. I therefore decided to create them myself.
What I like to see about trading strategies are basic performance charts (daily, monthly and yearly), some basic trading statistics and above all most recent performance figures to track potential strategy decay. I also want all of the information to be displayed on a single page. All this already exists obviously but not within a synthetic report like the one I present here. Therefore some custom formatting was required.
The input necessary to create this report is a simple 2 columns csv file with daily date and return. The output is a good looking pdf file (see image below).
I created a GistGitHub repository with 3 files:
- performanceReportREADME.txt: it contains the usual disclaimer
- performanceReportWithKnitr.R: This is the main R function that creates the charts and the input for LaTeX tables
- performanceReport_AssetAllocation.Rnw: This file calls the R function above and generates the pdf report.
Any comments welcome
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.