[R-SIG-Finance] retrieving option info from IB

Jeff Ryan jeff.a.ryan at gmail.com
Thu Jun 4 16:28:18 CEST 2009


Hi Wind,

Most of IBrokers behaves 1:1 with the "official" API from Interactive
Brokers.  That is meant to provide a smaller learning curve when
coming off the official API, but at the cost of being forced to deal
with some of the quirks of the platform as well.

That said, it is *not* a simple wrapper to the API though.  Many
design decisions were made to make it more productive for an R user,
as well as more productive from a trading perspective than the
standard API.  The eWrapper structure and using R in general makes it
more productive than all the other APIs in my opinion.

With respect to the contract information, that is really hit or miss.
I'll look into creating a 'best practices' or FAQ to help pool our
collective wisdom --- maybe a simple wiki would be a good start.

For getting snapshot information, IB's interface (API) is lacking.  I
have that on a list of things to try and put together from what the
API *can* do (it can't do what you want per se), and will be looking
to incorporate that into a future release.

The newest quantmod has a function called "getOptionChain" which pulls
from Yahoo.  Obviously yahoo data caveats apply, but it is a decent
start to getting snapshots.

More documentation for IBrokers and quantmod is coming, as well as a
presentation at the upcoming Rmetrics conference in Switzerland.  For
those not signed up yet, take a look at www.rmetrics.org for more
information.

HTH,
Jeff

On Thu, Jun 4, 2009 at 9:10 AM, Wind <windspeedo99 at gmail.com> wrote:
> I have successfully retrieved price info from IB via IBrokers for stocks and
> simple options.  The package is very efficient.Yet I could not get info on
> future option.
>
>> oc<-reqContractDetails(tws, twsOption(local="", right="",symbol="QQQQ"))
>> length(oc)
> [1] 1018
>> oc<-reqContractDetails(tws, twsOption(local="",right="",symbol="GC"))
> Error in reqContractDetails(tws, twsOption(local = "", right = "", symbol =
> "GC")) :
>  Unable to complete ContractDetails request
>> oc<-reqContractDetails(tws,
> twsOption(local="",right="",exch="NYMEX",symbol="GC"))
> Error in reqContractDetails(tws, twsOption(local = "", right = "", exch =
> "NYMEX",  :
>  Unable to complete ContractDetails request
>
> By the way, how could we retrieving the option chain,  just the current bid,
> ask, and size.  A snap shot only.
>  I have only find functions for data feed and historical data download.
>
> Any suggestion would be appreciated.
>
> Wind
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> 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.
>



-- 
Jeffrey Ryan
jeffrey.ryan at insightalgo.com

ia: insight algorithmics
www.insightalgo.com



More information about the R-SIG-Finance mailing list