Hi,
I am using the IBrokers package to get data from IB, but now I have run into
a little bit of trouble.

I have a lot of stock symbols I have to get a quote for (bid/ask price
only).

It looks like there is not a specific function in IBrokers to get quotes, so
I thought about filtering out the bid/ask price from the reqMktData()
function as in the highlighted output (is there a easier way?):
> reqMktData(tws, twsSTK("SBUX"))
<20090826 18:18:52.859000> id=1 symbol= Volume: 53727
<20090826 18:18:52.860000> id=1 symbol= highPrice: 19.68
<20090826 18:18:52.861000> id=1 symbol= lowPrice: 19.21
<20090826 18:18:52.862000> id=1 symbol= shortable: 3.0
<20090826 18:18:53.087000> id=1 symbol= lastTimestamp: 1251310542
<20090826 18:18:53.088000> id=1 symbol= lastTimestamp: 1251310728
<20090826 18:18:53.089000> id=1 symbol= lastPrice: 19.4
<20090826 18:18:53.090000> id=1 symbol= lastSize: 1
<20090826 18:18:53.091000> id=1 symbol= Volume: 54057
<20090826 18:18:53.091000> id=1 symbol= highPrice: 19.68
<20090826 18:18:53.093000> id=1 symbol= lowPrice: 19.21
<20090826 18:18:53.094000> id=1 symbol= closePrice: 19.5
<20090826 18:18:53.094000> id=1 symbol= openPrice: 19.45
<20090826 18:18:53.098000> id=1 symbol= bidPrice: 19.39  bidSize: 214
<20090826 18:18:53.099000> id=1 symbol= askPrice: 19.4  askSize: 156
<20090826 18:18:53.100000> id=1 symbol= bidSize: 214
<20090826 18:18:53.100000> id=1 symbol= askSize: 156

I tried to override the tickPrice function in my eWrapper (as in the
documentation example):

> myWrapper <- eWrapper()
> myWrapper$tickPrice <- function(msg, timestamp, file, ...) {}
>
> # add new tickPrice action
> myWrapper$tickPrice <- function(msg, timestamp, file, ...) {
cat("tickPrice",msg) }

Now when I call the reqMktData I get the followng output:

> reqMktData(tws, twsSTK("SBUX"), eventWrapper=myWrapper)
<20090826 17:56:13.473000> id=1 symbol= Volume: 51409
tickPrice 1tickPrice 1tickPrice 1<20090826 17:56:13.592000> id=1 symbol=
Volume: 51409
tickPrice 1tickPrice 1<20090826 17:56:14.214000> id=1 symbol= lastTimestamp:
1251309292
<20090826 17:56:14.231000> id=1 symbol= lastTimestamp: 1251309383
tickPrice 1<20090826 17:56:14.240000> id=1 symbol= lastSize: 1
<20090826 17:56:14.254000> id=1 symbol= Volume: 51515
tickPrice 1tickPrice 1tickPrice 1tickPrice 1<20090826 17:56:14.269000> id=1
symbol= lastTimestamp: 1251309292
<20090826 17:56:14.276000> id=1 symbol= lastTimestamp: 1251309383
tickPrice 1<20090826 17:56:14.289000> id=1 symbol= lastSize: 1
tickPrice 1tickPrice 1tickPrice 1tickPrice 1tickPrice 1<20090826
17:56:14.300000> id=1 symbol= bidSize: 134
<20090826 17:56:14.310000> id=1 symbol= askSize: 202
<20090826 17:56:14.324000> id=1 symbol= optionCallOpenInterest: 183787
<20090826 17:56:14.331000> id=1 symbol= optionPutOpenInterest: 150993
<20090826 17:56:14.345000> id=1 symbol= optionImpliedVol:
0.3800353909944552
<20090826 17:56:14.358000> id=1 symbol= averageVolume: 133558

If you look at the highlighted rows in the output, what strikes me as odd is
that:
1) it looks like the tickPrice function is called again before the message
could be printed. Is this correct, in other words are these functions
re-entrant?
2) where are the bid and ask prices?

I also tried overriding other functions in myWrapper like tickGeneric() and
tickString() but they also don't give me the bid/ask price.
I am probably doing something very wrong here but I can't figure out what it
is.

I am on windows (R: 2.8.1) and IBrokers version: IBrokers_0.2-2

Any help appreciated,

Regards,

-Mark-

	[[alternative HTML version deleted]]

