[R-SIG-Finance] Get Tick data from IBrokers

Jeffrey Ryan jeffrey.ryan at lemnica.com
Mon Sep 5 17:02:48 CEST 2011


You just pass in a list of file names of handles (more efficient) to
the file= param.

> fh <- list(file("aapl.csv", open="w"), file("goog.csv", open="w"))
> reqMktData(ibg, list(twsSTK("AAPL"),twsSTK("GOOG")) event=eWrapper.MktData.CSV(2), file=fh)
> reqMktData(ibg, list(twsSTK("AAPL"),twsSTK("GOOG")), event=eWrapper.MktData.CSV(2), file=fh)
^C

> lapply(fh, close)
[[1]]
NULL

[[2]]
NULL

> system("head aapl.csv")
20110905 09:59:02.304651,,,,,,,162727
20110905 09:59:02.693429,0,-1,,,,,
20110905 09:59:02.694235,,,-1,0,,,
20110905 09:59:02.694818,0,,,,,,
20110905 09:59:02.695388,,,,0,,,
20110905 09:59:02.695950,0,-1,,,,,
20110905 09:59:02.696552,,,-1,0,,,
20110905 09:59:02.697134,0,,,,,,
20110905 09:59:02.697701,,,,0,,,
> system("head goog.csv")
20110905 09:59:03.177405,0,-1,,,,,
20110905 09:59:03.178224,,,-1,0,,,
20110905 09:59:03.178901,0,,,,,,
20110905 09:59:03.179560,,,,0,,,
20110905 09:59:03.180208,0,-1,,,,,
20110905 09:59:03.180879,,,-1,0,,,
20110905 09:59:03.181544,0,,,,,,
20110905 09:59:03.182245,,,,0,,,
>

HTH
Jeff

On Mon, Sep 5, 2011 at 4:46 AM, Jacopo Anselmi <janselmi.sage at gmail.com> wrote:
> Dear finance Rusers,
>
> I'm trying to download efficiently contract data taken from IBrokers to have
> them available later for analysis in R.
>
> I've found this great piece of code done by Jeff
> http://quant.stackexchange.com/questions/461/how-should-i-store-tick-data
>
> Unfortunately I'm not able to pass more than a contract at the same time and
> save the data as xts in an efficient way.
>
> Is there a chance you guys can help out?
>
> Thanks a lot!
>
> Jaco
>
>        [[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.
>



-- 
Jeffrey Ryan
jeffrey.ryan at lemnica.com

www.lemnica.com
www.esotericR.com



More information about the R-SIG-Finance mailing list