[R-SIG-Finance] [R-sig-finance] troubles with the weights in the VaR function

Brian G. Peterson brian at braverock.com
Sat Apr 28 13:13:36 CEST 2007


On Saturday 28 April 2007 04:27, genx wrote:
> I use financial data from Yahoo and it is of low quality i.e dirty but
> still very popular since it's free. As an example, i want to compare
> the Swedish stocks ABB, Ericsson and Skanska to the Stockholm OMX30
> Index using various measures available in rmetrics and the
> performanceanalytics packages. The download procedure looks like this
> for each symbol which should result in four vectors with the same
> length:
>
> OMX30 <- get.hist.quote("^OMX",start=(today <- Sys.Date())-700, quote =
> c("Close"), provider = c("yahoo"), retclass = c("zoo"))
>
> > dim(OMX30)
> [1] 451   1
> > dim(ABB)
> [1] 489   1
> > dim(ERIC)
> [1] 491   1
> > dim(SKAB)
> [1] 491   1

With free data sources, for indexes in particular, they often only have 
monthly data back beyond a certain point.

One trick here is to use the length of your shortest vector.  If your data 
source doesn't have data for a particular series back far enough, then 
use the start date of your shortest series as the start date for 
retrieving all the other series.

Another option, as I mentioned in my post yesterday, would be to use 
na.contiguous or one of the other NA handlers with zoo.  get.hist.quote 
returns zoo objects.  So, if you combine all your historical data in one 
zoo object with multiple data columns, one of the na. methods should 
allow you to get back only the aligned series.

> Solution - a Bloomberg terminal with high quality data?

This will help, but it won't eliminate your problem, in R or any other 
environment.  For researchers who need really clean historical data over 
very long time periods, data from CRSP is often used, but this makes 
Bloomberg look cheap.

Regards,

   - Brian
-- 
773-459-4973 mobile
http://braverock.com/brian/resume-quant.pdf



More information about the R-SIG-Finance mailing list