[R-SIG-Finance] New IBrokers package on CRAN

Adrian Dragulescu adrian_d at eskimo.com
Sun Feb 24 21:22:59 CET 2008


Jeff,

Many thanks for putting together this package.  It should be very useful.

I am having trouble using it.  I know it's 0.0-1, but I would like to
start using it.  I have R 2.6.2, latest IB Workstation and latest API
9.40.  I use WinXP.

> require(IBrokers)
Loading required package: IBrokers
Loading required package: xts
Loading required package: zoo
IBrokers version 0.0-1: (pre-alpha)
See ?IBrokers for details
> con <- twsConnect()
Error in readChar(s, 1) : negative length vectors are not allowed
>

An IB window pops up and asks me if I want to accept incoming connection.
I press yes (but the error in the R GUI is already there).

If I try to understand where the error comes from:
> s <- socketConnection(port = 7496)
> s
       description              class               mode
text             opened
"->localhost:7496"           "socket"               "a+"
"text"           "opened"
          can read          can write
             "yes"              "yes"
> writeChar(as.character("1"), s)
> (curChar <- readChar(s, 1))

Another IB window pops up informing me that "The Socket client is out of
date and needs to be upgraded." And R GUI hangs up using 99% CPU.

Any suggestions are much appreciated.

In terms of the package wishlist, it would be nice to have access to the
Trades window and the Account window.

Adrian Dragulescu

I tried doing hooking R to IB using their Java API and got something
very rudimentary going on, but my Java wasn't that good to figure out how
to handle the multithreading features.





On Fri, 22 Feb 2008, Jeff Ryan wrote:

> R-Sig-Finance:
>
> I'd like to announce the alpha version of a new package IBrokers:
>
> Designed to provide native R access to Interactive Brokers' trading
> platform, it is currently in a very alpha stage.  I am releasing at
> this early stage it to gauge interest and feedback as to which API
> features should be considered priority.
>
> It is working, though very little error checking (read: none) is done
> at present.  I will be updating this aggressively.
>
> ?IBrokers
>
> R API to the Interactive Brokers Trader Workstation (TWS).
>
> Description:
>
>      A very limited R implementation of the TWS API.  At present it is
>      only able to access historic data from the Interactive Brokers
>      servers. Future additions will include more API access and
>      possible real-time charting via the 'quantmod' package.
>
>      A word of warning.  I wrote this in 3 days.  Much of the current
>      event loop is being rewritten/rethought to better handle errors, add
>      some sort of callback mechanism, as well as
>      speed up large data requests.  This version is mostly a
>      proof-of-concept and will be updated regularly.  That said, please
>      report any and all bugs/experiences to the maintainer so they can
>      be incorporated into development versions.
>
>      **DO NOT USE in an R session that you can't afford to lose!**
>
> Details:
>
>
>        Package:  IBrokers
>        Type:     Package
>        Version:  0.0-1
>        Date:     2008-02-21
>        License:  GPL-3
>
>      The current API methods supported are:
>
>      reqCurrentTime: The TWS server time in seconds since the epoch
>      reqHistoricalData: Fetch historical data
>
> Author(s):
>
>      Jeffrey A. Ryan
>
>      Maintainer: Jeffrey A. Ryan <jeff.a.ryan at gmail.com>
>
> References:
>
>      Interactive Brokers: <URL: www.interactivebrokers.com>
>
> --
> There's a way to do it better - find it.
> Thomas A. Edison
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>



More information about the R-SIG-Finance mailing list