[R-SIG-Finance] reqMktDepth

Jeff Ryan jeff.a.ryan at gmail.com
Mon Dec 13 23:05:48 CET 2010


Stephen,

The issue is actually due to permissions NOT IBrokers.  ARCA and
ISLAND now require data subscriptions.  You don't get an error message
or an explanation unless you try it in the TWS itself.

>From IBrokers, you need to select an exchange, or in the TWS subscribe
to the exchanges that are causing the error for you.

This works for me randomly ...

> reqMktDepth(tws, twsSTK("AAPL",exch="BATS"))
TWS Message: 2 1 310 Can't find the subscribed market depth with tickerId:1
<20101213 15:59:04.646251>,id=1,pos=0,operation=insert,side=bid,price=321.86,size=1
<20101213 15:59:04.647362>,id=1,pos=0,operation=insert,side=ask,price=323.95,size=70
<20101213 15:59:42.995142>,id=1,pos=0,operation=delete,side=bid,price=0,size=0
<20101213 16:00:00.349464>,id=1,pos=0,operation=delete,side=ask,price=0,size=0

HTH,
Jeff

On Mon, Dec 13, 2010 at 2:24 PM, Jeff Ryan <jeff.a.ryan at gmail.com> wrote:
> I think the IB API has changed, I will look into it and get a patch out.
>
> Thanks for the report.
>
> Best,
> Jeff
>
> On Mon, Dec 13, 2010 at 1:29 PM, Stephen Choularton
> <stephen at organicfoodmarkets.com.au> wrote:
>> I'm trying to use market depth information but falling at the first fence.
>>
>> This code:
>>
>> library(IBroker)
>>
>> tws <- twsConnect(9)
>> tws
>>
>> #reqMktDepth(tws, list(twsEquity("CBA","ASX","AUD")))
>>
>>
>> #reqMktData(con, list(twsEquity("CBA","ASX","AUD")))
>>
>>
>> # write to a file
>> #reqMktDepth(tws, twsEquity("CBA","ASX","AUD"), file='c:/rMktDepth/out.dat')
>>
>> reqMktDepth(tws, twsEquity("GOOG"))
>> #reqMktDepth(tws, twsEquity("GOOG"), file='c:/rMktDepth/out.dat')
>>
>> closeAllConnections()
>>
>> Produces:
>>
>>> > tws <- twsConnect(9)
>>> tws
>> <twsConnection,9 @ 20101214 06:18:55 Eastern Standard Time (New South
>> Wales), nextId=1>
>>>
>>> #reqMktDepth(tws, list(twsEquity("CBA","ASX","AUD")))
>>>
>>>
>>> #reqMktData(con, list(twsEquity("CBA","ASX","AUD")))
>>>
>>>
>>> # write to a file
>>> #reqMktDepth(tws, twsEquity("CBA","ASX","AUD"),
>>> file='c:/rMktDepth/out.dat')
>>>
>>>reqMktDepth(tws, twsEquity("GOOG"))
>>> # reqMktDepth(tws, twsEquity("GOOG"), file='c:/rMktDepth/out.dat')
>> TWS Message: 2 -1 2104 Market data farm connection is OK:aufarm
>> TWS Message: 2 -1 2104 Market data farm connection is OK:usfarm
>>
>> [hanging so hit Esc]
>>
>>
>>>
>>> closeAllConnections()
>>>
>>>
>>
>> Can anyone see what I'm doing wrong?
>>
>>
>> --
>> Stephen Choularton Ph.D., FIoD
>>
>> _______________________________________________
>> 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
>



-- 
Jeffrey Ryan
jeffrey.ryan at lemnica.com

www.lemnica.com



More information about the R-SIG-Finance mailing list