[R-SIG-Finance] Coercion problem in RBloomberg

spencerg spencer.graves at prodsyse.com
Sat Jul 11 04:55:07 CEST 2009


      I have not seen a reply to this, so I will offer a comment.  I do 
not have access to Bloomberg, so I can not recreate the problem.  
However, I can suggest two things: 


      1.  Have you tried "debug(blpGetData)"?  When you next execute a 
call to "blpGetData", this will put you in the environment of the 
function, allowing you to walk through the function line by line, 
looking at and changing things as you wish.  To support this, I suggest 
you download the package source file, "RBloomberg_0.1-11.tar.gz", from 
"http://cran.fhcrc.org/web/packages/RBloomberg/index.html".  This is 
often useful, because any comments in the source code are deleted in the 
copy that is attached with "library(RBloomberg)". 


      2.  Have you considered setting "options(warn=2)"?  This will turn 
warnings into errors, making it easier to find the problem that 
generated the warning message. 


      Hope this helps. 
      Spencer Graves


Keith Sabol wrote:
> Essentially, I'm trying to re-create the data displayed Bloomberg's QRMD
> function.  When I run the following I get the error below:
>
>  
>
> blpGetData(conn,c("X 4 Corp"), c("VOLUME","LAST_PRICE"),
> ,start=as.chron(14432.375),end=as.chron(14433.55), barsize=0)
>
>                     VOLUME LAST_PRICE
>
> (07/08/09 10:15:01) 150000 150000.000
>
> (07/08/09 11:05:01) 350000    123.026
>
> Warning message:
>
> In matrix(vec, nrow = nr, ncol = nc) :
>
>   data length [11] is not a sub-multiple or multiple of the number of
> rows [2]
>
>  
>
>  
>
> When I run the data request to return the "raw" data I get:
>
>  
>
>  
>
> blpGetData(conn,"X 4 Corp", c("VOLUME","LAST_PRICE"),
> ,start=as.chron(14432.375),end=as.chron(14433.55),
> barsize=0,retval="raw")
>
> [[1]]
>
> [[1]][[1]]
>
> [[1]][[1]][[1]]
>
> An object of class "COMDate"
>
> [1] 40001.64
>
>  
>
> [[1]][[1]][[2]]
>
> An object of class "COMDate"
>
> [1] 40002.42
>
>  
>
> [[1]][[1]][[3]]
>
> An object of class "COMDate"
>
> [1] 40002.43
>
>  
>
> [[1]][[1]][[4]]
>
> An object of class "COMDate"
>
> [1] 40002.46
>
>  
>
>  
>
>  
>
> [[2]]
>
> [[2]][[1]]
>
> [[2]][[1]][[1]]
>
> NULL
>
>  
>
> [[2]][[1]][[2]]
>
> [1] 150000
>
>  
>
> [[2]][[1]][[3]]
>
> [1] 350000
>
>  
>
> [[2]][[1]][[4]]
>
> [1] 150000
>
>  
>
>  
>
>  
>
> [[3]]
>
> [[3]][[1]]
>
> [[3]][[1]][[1]]
>
> [1] 123.026
>
>  
>
> [[3]][[1]][[2]]
>
> [1] 118.107
>
>  
>
> [[3]][[1]][[3]]
>
> [1] 118.475
>
>  
>
> [[3]][[1]][[4]]
>
> [1] 118.75
>
>  
>
>  
>
> Coercions to "zoo" or "matrix" fail because of the NULL that is
> returned. Does anyone know how to get around this?
>
>  
>
> Thanks in advance!
>
>  
>
>  
>
>  
>
> Keith Sabol
>
>  
>
> Email Disclosure Notice
> This message (including any attachments) is for the addr...{{dropped:12}}
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>
>



More information about the R-SIG-Finance mailing list