[R-SIG-Finance] IBrokers Problem

Michael Smith my.r.help at gmail.com
Tue Dec 10 00:25:31 CET 2013


Does it work for you in the demo TWS version as well?

For me, `reqCurrentTime` works fine in the demo TWS version, like all
the other examples in the vignette, except for `twsFuture`.

> reqCurrentTime(tws)
TWS Message: 2 -1 2104 Market data farm connection is OK:ibdemo
TWS Message: 2 -1 2106 HMDS data farm connection is OK:demohmds
[1] "2013-12-10 07:14:29 HKT"

Interestingly, when I run the following code, I get some feedback from
the Unix shell that runs TWS.

> tws <- twsConnect()
> reqContractDetails(tws, twsEquity("QQQ")) # R hangs here.
^C
> twsDisconnect(tws)

So when I run `twsDisconnect` (only after running `reqContractDetails`)
in the example above, I get the following output in the Unix shell from
Java:

07:23:13:870 JTS-EServerSocket-157: [1:47:67:1:0:0:0:ERR] Message type
1.  Attempted read beyond end of socket stream -
07:23:13:870 JTS-EServerSocket-157: Anticipated error
jextend.c: Attempted read beyond end of socket stream -
	at jextend.tb.b(tb.java:307)
	at jextend.hf.eb(hf.java:1316)
	at jextend.hf.run(hf.java:1251)
	at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.EOFException
	at jextend.tb.c(tb.java:541)
	at jextend.tb.r(tb.java:183)
	at jextend.wd.a(wd.java:188)
	at jextend.tb.d(tb.java:613)
	at jextend.uc.a(uc.java:177)
	at jextend.tb.b(tb.java:304)
	... 3 more
07:23:13:871 JTS-EServerSocket-157: [1:47:67:1:0:0:0:SYS] Client{1}
terminated conversation.
07:23:13:871 JTS-EServerSocketNotifier-156: Terminating


Thanks,
Michael



On 12/09/2013 11:06 PM, G See wrote:
> I don't know; it works for me.  Does reqCurrentTime(tws) return the
> current time?
> 
> Garrett
> 
>> tws <- ibgConnect()
>> reqCurrentTime(tws)
> [1] "2013-12-09 09:04:37 CST"
>> reqContractDetails(tws, twsEquity("QQQ"))
> [[1]]
> List of 18
>  $ version       : chr "6"
>  $ contract      :List of 16
>   ..$ conId          : chr "43661924"
>   ..$ symbol         : chr "QQQ"
>   ..$ sectype        : chr "STK"
>   ..$ exch           : chr "SMART"
>   ..$ primary        : chr "NASDAQ"
>   ..$ expiry         : chr ""
>   ..$ strike         : chr "0"
>   ..$ currency       : chr "USD"
>   ..$ right          : chr ""
>   ..$ local          : chr "QQQ"
>   ..$ multiplier     : chr ""
>   ..$ combo_legs_desc: chr ""
>   ..$ comboleg       : chr ""
>   ..$ include_expired: chr "0"
>   ..$ secIdType      : chr ""
>   ..$ secId          : chr ""
>   ..- attr(*, "class")= chr "twsContract"
>  $ marketName    : chr "NMS"
>  $ tradingClass  : chr "NMS"
>  $ conId         : chr "43661924"
>  $ minTick       : chr "0.01"
>  $ orderTypes    : chr [1:49] "ACTIVETIM" "ADJUST" "ALERT" "ALGO" ...
>  $ validExchanges: chr [1:17] "SMART" "ISE" "CHX" "ARCA" ...
>  $ priceMagnifier: chr "1"
>  $ underConId    : chr "0"
>  $ longName      : chr "POWERSHARES QQQ NASDAQ 100"
>  $ contractMonth : chr ""
>  $ industry      : chr "Funds"
>  $ category      : chr "Equity Fund"
>  $ subcategory   : chr "Sector Fund-Technology"
>  $ timeZoneId    : chr "EST"
>  $ tradingHours  : chr "20131209:0400-2000;20131210:0400-2000"
>  $ liquidHours   : chr "20131209:0930-1600;20131210:0930-1600"
> 
> On Mon, Dec 9, 2013 at 7:47 AM, Michael Smith <my.r.help at gmail.com> wrote:
>> Thanks for the quick reply, but R still hangs after running this command
>> with the new ticker.
>>
>> Best,
>> Michael
>>
>>
>> On 12/09/2013 09:29 PM, G See wrote:
>>> The ticker for that ETF changed to QQQ on March 23, 2011
>>>
>>> Try reqContractDetails(tws, twsEquity("QQQ"))
>>>
>>> Best,
>>> Garrett
>>>
>>> On Mon, Dec 9, 2013 at 7:27 AM, Michael Smith <my.r.help at gmail.com> wrote:
>>>> All,
>>>>
>>>> I'm trying to better understand how to use the IBrokers package by going
>>>> through the `IBrokers.pdf` vignette. I'm using the demo version of TWS
>>>> (login `edemo`). TWS seems to be running fine. However, I get stuck at
>>>> the following command from the vignette:
>>>>
>>>> reqContractDetails(tws, twsEquity("QQQQ"))
>>>>
>>>> R just seems to hang and I don't get any further response. My
>>>> sessionInfo is below. I'm using the most current IBrokers from Google Code.
>>>>
>>>> Am I doing something wrong, or is this not supposed to work with the TWS
>>>> demo version?
>>>>
>>>> Thanks,
>>>> Michael
>>>>
>>>>
>>>>> sessionInfo()
>>>> R version 3.0.2 (2013-09-25)
>>>> Platform: x86_64-redhat-linux-gnu (64-bit)
>>>>
>>>> locale:
>>>>  [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C
>>>> LC_TIME=en_US.utf8
>>>>  [4] LC_COLLATE=en_US.utf8     LC_MONETARY=en_US.utf8
>>>> LC_MESSAGES=en_US.utf8
>>>>  [7] LC_PAPER=en_US.utf8       LC_NAME=C                 LC_ADDRESS=C
>>>>
>>>> [10] LC_TELEPHONE=C            LC_MEASUREMENT=en_US.utf8
>>>> LC_IDENTIFICATION=C
>>>>
>>>> attached base packages:
>>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>>>
>>>> other attached packages:
>>>> [1] IBrokers_0.9-11 xts_0.9-7       zoo_1.7-10      colorout_1.0-1
>>>>
>>>> loaded via a namespace (and not attached):
>>>> [1] grid_3.0.2      lattice_0.20-24 tools_3.0.2
>>>>
>>>> _______________________________________________
>>>> 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.



More information about the R-SIG-Finance mailing list