Fteching options data using package IBrokers and interactivebrokers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fteching options data using package IBrokers and interactivebrokers

amol gupta
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.


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

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] 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.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fteching options data using package IBrokers and interactivebrokers

Enrico Schumann-2
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

_______________________________________________
[hidden email] 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.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fteching options data using package IBrokers and interactivebrokers

amol gupta
Thanks .That worked. :-)

On Mon, Jun 26, 2017 at 1:16 AM, Enrico Schumann <[hidden email]>
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]]

_______________________________________________
[hidden email] 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.
Loading...