[R-SIG-Finance] Réf. : Re: R-project and the risk measurement for mutual and hedge funds

Brian G. Peterson brian at braverock.com
Thu Jun 7 13:57:53 CEST 2007


Fabrice McShort writes:
> Thanks for your help!
> 
> R project will enable me to have CVaR, Modified Sharpe Ratio, etc. 
> But, I guess that I cannot use R project to produce "automatically" 
> Risk management report and performance attribution for the funds. 
> Is it true? I will be happy to know what software is appropriated 
 > for this task?
> 
> PS: I need to produce 500 risk management reports per month!!!
> 
> Thanks!

guillaume.nicoulaud at halbis.com wrote:
 > One convenient way to do that is to build a R - TeX architecture.
 > If your raw data is stored in a database you may build pdf reports
 > for as many funds you want in just one click.
 > G


Giullaume is correct.  I'll provide a little more context.

The primary tool that you want is Sweave, which allows you to run R code 
from inside a LaTeX document.  This is straightforward, but I wouldn't 
call it simple if you're not familiar with LaTeX and as a newcomer to R.

I would recommend starting by choosing a LaTeX editor that can be used 
with Sweave, such as Lyx.  There are HOWTO's available online describing 
how to configure Lyx for use with Sweave.

Then, you'll construct your risk report.  Basically, I'd look at the 
charts and tables in the PerformanceAnalytics package for ideas on how 
you might build R functions to compile statistics you need for your 
report into tabular data and for charts that you may wish to display. 
Many of the charts and tables in PerformanceAnalytics may be appropriate 
starting places for your mutual fund reports because many of them were 
developed for analysis of portfolios of hedge funds. I also mention it 
because as one of the authors, I'm most familiar with it.

You'll probably want to use Lyx or some other LaTeX editor to help you 
lay out your Sweave document into a nice printable report structure.  As 
Guillaume mentioned, if your historical data is stored in a database, 
you can automate the task of loading the data and generating one report 
per fund.  If your historical data is in files or available via a web 
download interface, this could be automated also.  Ask the list if you 
run into specific problems on this that you are having trouble sorting 
through yourself.

Once you have a layout that works, running Sweave in an automated or 
semiautomated fashion for producing the reports is pretty 
straightforward.  There was an R News article specifically on this topic 
a while back that I'm sure a little Google searching could help you locate.

Hopefully this adds a little more context to Guillaume's suggestion. 
The list will be happy to help with specifics as you get closer.  Please 
consider sharing the LaTeX/noweb document that you develop with the 
community.  I'm sure others would benefit from your experience.

Regards,

    - Brian



More information about the R-SIG-Finance mailing list