[R-SIG-Finance] IBrokers question

rex rex at nosyntax.net
Mon Sep 6 12:03:25 CEST 2010


Sergey Goriatchev <sergeyg at gmail.com> [2010-09-06 00:39]:
>Easy question:
>To be able to play with IBrokers package (load some data from IB) I
>need to sign up with IB, I assume.
>But do I actually need to open an account with IB and transfer money?

Sergey,

IBroker can be used with the free demo version of the IB standalone
TWS. No signup or money transfer is required. 

There's a very brief synopsis of installing TWS and IBroker at:

http://www.nosyntax.net/spwiki/index.php/InteractiveBrokers_with_R

The reqHistoricalData() functions may not work with the demo
version. I installed IBroker yesterday and so have not tested it
when the market is open.

reqMktData() works even on weekends, as the example on the page
shows.

> reqMktData(tws, twsEquity("AAPL"), file="AAPL_realtime.dat")

Here's a bit of the file the above command creates:

<20100905 16:48:31.370947> id=1 symbol=AAPL Volume: 124045
<20100905 16:48:31.371824> id=1 symbol=AAPL highPrice: 259.24
<20100905 16:48:31.372656> id=1 symbol=AAPL lowPrice: 257.07
<20100905 16:48:31.373450> id=1 symbol=AAPL Halted: 0.0
<20100905 16:48:31.374192> id=1 symbol=AAPL bidPrice: 258.13  bidSize: 12
<20100905 16:48:31.375025> id=1 symbol=AAPL bidSize: 12
<20100905 16:48:31.375743> id=1 symbol=AAPL askPrice: 258.15  askSize: 2
<20100905 16:48:31.376635> id=1 symbol=AAPL askSize: 2
<20100905 16:48:31.709398> id=1 symbol=AAPL lastTimestamp: 1283730509
<20100905 16:48:31.710432> id=1 symbol=AAPL lastTimestamp: 1283730511
<20100905 16:48:31.711198> id=1 symbol=AAPL lastPrice: 258.5
<20100905 16:48:31.711932> id=1 symbol=AAPL lastSize: 1
<20100905 16:48:31.712669> id=1 symbol=AAPL Volume: 125892
<20100905 16:48:31.713425> id=1 symbol=AAPL highPrice: 259.24
<20100905 16:48:31.714180> id=1 symbol=AAPL lowPrice: 255.58
<20100905 16:48:31.714923> id=1 symbol=AAPL closePrice: 259.28
<20100905 16:48:31.715666> id=1 symbol=AAPL bidPrice: 258.51  bidSize: 3
<20100905 16:48:31.716587> id=1 symbol=AAPL askPrice: 258.52  askSize: 4
<20100905 16:48:31.717517> id=1 symbol=AAPL bidSize: 3
<20100905 16:48:31.718233> id=1 symbol=AAPL askSize: 4
[...]

Many thanks to Jeffrey Ryan for creating IBroker and QuantMod.

-rex
-- 
Most burning issues generate far more heat than light.



More information about the R-SIG-Finance mailing list