[R-SIG-Finance] IBrokers Package: wrong Clientid returns ?

Joshua Ulrich josh.m.ulrich at gmail.com
Thu Apr 2 01:56:56 CEST 2015


On Wed, Apr 1, 2015 at 5:45 AM, cen six <censix0 at gmail.com> wrote:
>
> Hi, I realize it has been a while, but essentially the problem is that the
> recent versions of the IB API (i.e. as per TWS build 9493) do require api
> clients to identify themselves with at least client-version63.  Now, the
> last I have seen of the IBrokers package however uses client-version47 or
> 49 which is why there are problems when R clients connect. i.e. they may
> not be assigned the clientId that they were requesting from the server,
> etc. etc.
>
> One way to fix this is to update the 'IBrokers' package. But I am not sure
> who the maintainer is at the moment.
>
R> packageDescription("IBrokers")[c("Version","Maintainer")]
$Version
[1] "0.9-12"

$Maintainer
[1] "Joshua M. Ulrich <josh.m.ulrich at gmail.com>"

The source is on GitHub.  Pull requests welcome.
https://github.com/joshuaulrich/IBrokers

> A workaround that I have found works reasonably well for me, is to include
> the following file into your R code, right after loading the 'IBrokers'
> package. You can download it from my repository here:
>
> https://github.com/censix/INTRADAY-PartAB/blob/master/INTRADAY-PartA/__IBapi-clientVer63-v002.r
>
> i.e. do something like
>
> *library(IBrokers)*
> *source("__IBapi-clientVer63-v002.r")*
>
> The file re-implements  some of the outdated IBrokers() function and
> overwrites them. A word of warning however!  This is only a PARTIAL IB api
> implementation. Only the most basic ordertypes have been implemented, so
> only use this if you know what you are doing.
>
> Regards
>
> Soren
>
>
>
> On Thu, Jan 22, 2015 at 1:38 AM, ce <zadig_1 at excite.com> wrote:
>
> >
> > I use stable version. I tried latest beta too, didn't help.
> > Indeed downgrade fixed clientid problem but my main problem (
> > https://groups.yahoo.com/neo/groups/TWSAPI/conversations/messages/33071 )
> > ,  event handler returns garbled data persists, instead of correct 2100
> > error I still get :
> >
> > paraml[[1]]= -1
> > paraml[[2]]= NA
> > paraml[[3]]= PF1
> > paraml[[4]]= API client has been unsubscribed from account data..NA
> >
> > I guess I need to contact IBrokers maintainer , I can't think of what else
> > to do .
> > best
> > ce
> >
> > -----Original Message-----
> > From: "cen six" [censix0 at gmail.com]
> > Date: 01/21/2015 11:24 AM
> > To: "ce" <zadig_1 at excite.com>
> > CC: "r-sig-finance at r-project.org" <r-sig-finance at r-project.org>
> > Subject: Re: [R-SIG-Finance] IBrokers Package: wrong Clientid returns ?
> >
> > Well, for sure a downgrade of the TWS would fix it, but its obviously not
> > a long term solution. Are you using a beta TWS version or a stable release ?
> >
> >
> > On Wed, Jan 21, 2015 at 4:07 AM, ce <zadig_1 at excite.com> wrote:
> >
> > I downgraded IBrokers version to 0.9-10, while keeping TWS Build 948.3c,
> > Jan 5, 2015 5:12:23 PM ,
> > still I got the wrong clientid from TWS.
> >
> > Then I downgraded TWS to  Build 945.2b, Jun 3, 2014 11:11:57 AM and it
> > worked correctly with IBrokers 0.9-10
> >
> > I see my clientid 96 is returned from TWS :
> >
> > TWS OpenOrder: orderId=2 clientId=96 conId=14321015 symbol=GBP
> > status=Filled
> >
> >
> > -----Original Message-----
> > From: "ce" [zadig_1 at excite.com]
> > Date: 01/20/2015 07:52 PM
> > To: censix0 at gmail.com
> > CC: r-sig-finance at r-project.org
> > Subject: Re: [R-SIG-Finance] IBrokers Package: wrong Clientid returns ?
> >
> >
> > Hi Cen six,
> >
> > I am using IBrokers 0.9.12 from cran r web site.
> > In fact I was testing the demo program from you emailed me. It was working
> > fine but one or two weeks ago event handler started to fail ( maybe after
> > IBrokers update )  as I explained in :
> > https://groups.yahoo.com/neo/groups/TWSAPI/conversations/messages/33071
> >
> > then I upgraded TWS but now clientid returned by event handler is wrong.
> > Maybe I should downgrade IBrokers or TWS ?
> >
> > ce
> >
> >
> > -----Original Message-----
> > From: "cen six" [censix0 at gmail.com]
> > Date: 01/20/2015 03:04 PM
> > To: "ce" <zadig_1 at excite.com>
> > CC: "r-sig-finance at r-project.org" <r-sig-finance at r-project.org>
> > Subject: Re: [R-SIG-Finance] IBrokers Package: wrong Clientid returns ?
> >
> > Are you using the IBrokers package version 0.9-10  or higher ? (from
> > code.google.com)
> >
> >
> > cheers
> >
> >
> > On Tue, Jan 20, 2015 at 2:38 AM, ce <zadig_1 at excite.com> wrote:
> >
> > Dear all,
> >
> > I just upgraded TWS to Build 948.3c, Jan 5, 2015 5:12:23 PM
> > My program that worked fine before started to return wrong clientid . I
> > set client ID to 96. but after sending the order, In order status , or
> > order execution events I get clientid 6  !!  Even I tried to set Master API
> > Client ID to 96 in TWS -> Configuration -> API.  didnt work.
> > If I set Clientid to 6,  TWS returns 0 as Clientid.
> >
> > Here is some piece of code :
> >
> > > ibClientId <- 96
> > >
> > >
> > > #global: create the connection to IB  (this can probably not be stored
> > anywhere, so
> > > #we have to recreate it within "IBexecuteStrategy.r"
> > > ibConnection<-NULL
> > > if (!is.twsConnection(ibConnection)) {
> > +    ibConnection<- twsConnect(clientId=ibClientId, host="localhost",
> > +                                       port=7496, verbose=TRUE,
> > +                                       timeout=15, filename=NULL)
> > + }
> > > print(ibConnection)
> > <twsConnection,96 @ 20150119 20:25:19 EST, nextId=4>
> >
> > TWS OpenOrder: orderId=3 clientId=6 conId=12087807 symbol=EUR
> > status=Submitted
> >
> > _______________________________________________
> > 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.
> >
> > _______________________________________________
> > 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 g
> >
> >
> >
> >
> >
> >
> >
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> 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.




-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com



More information about the R-SIG-Finance mailing list