[R-SIG-Finance] RBloomberg rounding price increments to 4 decimals
Brian G. Peterson
brian at braverock.com
Mon Mar 19 13:57:27 CET 2012
The first thing to check is your options on R in general.
options(digits=10)
or even
options(digits=12)
and see if that shows you the data you expect.
I'm not currently using RBloomberg, so I can't check this part of your
problem.
Regards,
- Brian
On Mon, 2012-03-19 at 08:44 -0400, G.abe Lin wrote:
> Hi guys,
>
> I'm using RBloomberg to download OHLC data on futures into my
> environment. I am porting my trading strategy from a custom framework
> to blotter and quantstrat.
>
> I immediately noticed that the P&L did not reconcile, and that is
> apparently because of rounding to 4 decimal places on prices
> downloaded using RBloomberg.
>
> The instruments I am looking at trade in 1/32nds and 1/64ths (+), and
> the 1/64ths are not 4 decimals long -- my prices are essentially
> getting truncated.
>
> Has anyone dealt with this issue successfully before? I am looking
> for a way to preserve the integrity of the price downloaded using
> RBloomberg.
>
> All the code needed to reproduce this is below, thanks.
>
> > sessionInfo()R version 2.14.1 (2011-12-22)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
> States.1252 LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C LC_TIME=English_United
> States.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] quantstrat_0.6.1 blotter_0.8.4
> stringr_0.6 timeDate_2131.00
> [5] PerformanceAnalytics_1.0.3.2 RODBC_1.3-4
> RBloomberg_0.4-150 rJava_0.9-3
> [9] FinancialInstrument_0.11.3 quantmod_0.3-17
> TTR_0.21-0 xts_0.8-4
> [13] zoo_1.7-7 Defaults_1.1-1
>
> loaded via a namespace (and not attached):
> [1] grid_2.14.1 lattice_0.20-0 plyr_1.7.1 tools_2.14.1
>
>
> require(RBloomberg)
>
> > start_date[1] "20110922"> end_date[1] "20120319"> myInst$identifiers$BB[1] "USM2 Comdty"
>
> > FLDS <- c("PX_OPEN","PX_HIGH","PX_LOW","PX_LAST")> > rs = bdh(conn,myInst$identifiers$BB,FLDS, start_date = start_date , end_date = end_date)
>
>
> rs
> ....
>
> 2012-03-15 2012-03-15 136.7812 137.0000 135.5625 136.5312
> 2012-03-16 2012-03-16 136.4688 136.6250 135.4688 136.4375
> 2012-03-19 2012-03-19 136.4375 137.0000 136.1250 136.8438
>
>
>
>
> Don't quit. Suffer now and live the rest of your life as a champion.
>
> - Muhammad Ali
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
More information about the R-SIG-Finance
mailing list