[R-SIG-Finance] reqMktDepth

Jeff Ryan jeff.a.ryan at gmail.com
Tue Dec 14 00:19:51 CET 2010


Read:

http://www.interactivebrokers.com/en/p.php?f=marketData

I don't know if depth exists on the ASX, but for the other exchanges
you need for example (per the page above):

NYSE (ex: IBM), full market depth	

- US Securities & Commodities Non-Professional Bundle
- NYSE Open Book Real Time
- NASDAQ Totalview
- Arcabook

Above is ~60 or so for non-pro, and a few hundred for pro...

Due note that this isn't R or IBrokers, this is IB, so questions
aren't on-topic for this forum.

HTH
Jeff

On Mon, Dec 13, 2010 at 5:03 PM, Stephen Choularton
<stephen at organicfoodmarkets.com.au> wrote:
> OK, so I have that generic US subscription that costs you nothing if you
> produce more than $30 commissions a month.  Do you think that means I have
> to go for the more specific subscriptions (which I think cost more)?
>
> Second, I am directly subscribed for ASX but didn't get the desired results
> I get this (the market was open at the time):
>
>
>> tws <- twsConnect(9)
>> tws
> <twsConnection,9 @ 20101214 10:01:45 Eastern Standard Time (New South
> Wales), nextId=>
>>
>> reqMktDepth(tws, list(twsEquity("CBA","ASX","AUD")))
> TWS Message: 2 -1 2104 Market data farm connection is OK:aufarm
> TWS Message: 2 -1 2106 HMDS data farm connection is OK:hkhmds2
> TWS Message: 2 -1 2106 HMDS data farm connection is OK:ushmds2a
> TWS Message: 2 1 200 No security definition has been found for the request
>
>>
>
> PS I can get data with reqMktData(con, list(twsEquity("CBA","ASX","AUD")))
>
>
> Stephen Choularton Ph.D., FIoD
>
> On 14/12/2010 9:05 AM, Jeff Ryan wrote:
>>
>> 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