Perfect, that worked. Thanks a lot! M
On 12/21/2013 09:45 PM, G See wrote: > I'm away from a computer. > > Try > tws <- ibgConnect() > > Garrett > > On Dec 21, 2013 6:33 AM, "Michael Smith" <my.r.h...@gmail.com > <mailto:my.r.h...@gmail.com>> wrote: > > Hi Garrett, > > Gateway connects fine to the IB server. However, I have a problem > connecting IBrokers to Gateway. > > The error message for *Gateway* is the same as when I forget to click > "Enable ActiveX and Socket Clients" in the *TWS* settings. But in > Gateway I cannot find such a setting. > > > tws <- twsConnect() > Error in socketConnection(host = host, port = port, open = "ab", > blocking = blocking) : > cannot open the connection > In addition: Warning message: > In socketConnection(host = host, port = port, open = "ab", blocking = > blocking) : > localhost:7496 cannot be opened > > Do you use any special settings for Gateway? > > Thanks, > M > > > On 12/10/2013 07:51 AM, G See wrote: > > Yup. Works fine for me with the demo account on Ubuntu. > > > > Have you tried restarting the TWS? (while you're at it, you might > > consider using IB Gateway instead since it doesn't log you out every > > day) > > > >> sessionInfo() > > R version 3.0.2 (2013-09-25) > > Platform: x86_64-pc-linux-gnu (64-bit) > > > > locale: > > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > > [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > > [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 > > [7] LC_PAPER=en_US.UTF-8 LC_NAME=C > > [9] LC_ADDRESS=C LC_TELEPHONE=C > > [11] LC_MEASUREMENT=en_US.UTF-8 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-11 > > > > loaded via a namespace (and not attached): > > [1] grid_3.0.2 lattice_0.20-18 > > > > > > Sorry I can't be of more assistance, > > > > Garrett > > > > On Mon, Dec 9, 2013 at 5:25 PM, Michael Smith <my.r.h...@gmail.com > <mailto:my.r.h...@gmail.com>> wrote: > >> 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.h...@gmail.com <mailto:my.r.h...@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.h...@gmail.com <mailto:my.r.h...@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@r-project.org > <mailto:R-SIG-Finance@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. > _______________________________________________ R-SIG-Finance@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.