[R-SIG-Finance] Fteching options data using package IBrokers and interactivebrokers

amol gupta amolgupta87 at gmail.com
Mon Jun 26 07:53:39 CEST 2017


Thanks .That worked. :-)

On Mon, Jun 26, 2017 at 1:16 AM, Enrico Schumann <es at enricoschumann.net>
wrote:

> On Sun, 25 Jun 2017, amol gupta writes:
>
> > Hello,
> >
> > I have been trying to fetch contract details and finally fetch contract
> > historical data. I have been able to do it with stock futures but I have
> > been failing with options. Here is a very small snippet.
> >
> >
> > c<-twsOPT(local = 'HDFC17JUN1780CE',strike = 1780, right = 'C',
> >           currency = 'INR',primary = 'NSE',multiplier = 1,
> >           conId = 271618757)
> > d<-reqContractDetails(tws,c)
> >
> > Warning message:
> > In reqContractDetails(tws, c) : error in contract details
> >
> >
> > here
> > <https://misc.interactivebrokers.com/cstools/contract_info/v3.9/
> index.php?action=Conid%20Info&wlId=IB&conid=271618719&lang=en>
> > are the contract details. Please help me figure out what am I doing
> wrong.
>
> Use 'twsContract' and specify only the local symbol, the
> exchange, the currency and the security type:
>
>    require("IBrokers")
>    c <- twsContract(local = 'HDFC17JUN1780CE', sectype = "OPT",
>                     currency = 'INR', exch = 'NSE',
>                     include_expired = 1,
>                     conId = "", symbol = "", primary = "", expiry = "",
>                     strike = "", right = "", multiplier = "",
>                     combo_legs_desc = "", comboleg = "", secIdType = "",
>                     secId = "")
>
>    tws <- twsConnect()
>    reqContractDetails(tws, c)
>
>    ## List of 18
>    ##  $ version       : chr "8"
>    ##  $ contract      :List of 16
>    ##   ..$ conId          : chr "271618757"
>    ##   ..$ symbol         : chr "HDFC"
>    ##   ..$ sectype        : chr "OPT"
>    ##   ..$ exch           : chr "NSE"
>    ## [....]
>
> See also
> https://github.com/enricoschumann/IButils#finding-the-contract-
> specification
>
> --
> Enrico Schumann
> Lucerne, Switzerland
> http://enricoschumann.net
>



-- 
Regards
Amol
+91-9897860992
+91-8889676918

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list