[R-SIG-Finance] ibrokers - problems retrieving Indices/ETFs

Enrico Schumann es at enricoschumann.net
Wed Mar 20 08:10:35 CET 2013


Hi Matti,

On Tue, 19 Mar 2013, Matti Zemack <matti.zemack at gmail.com> writes:

> Hi all,
>
>
> First of all; Thanks Jeff for the ibrokers package. It's amazing.
>
> My simple first code looks like Jeffs demo;
>
> library(IBrokers)
> tws <- twsConnect()
> spy.csv <- file("SPY.csv", open="w")
> reqMktData(tws, twsEquity("SPY", exch="ARCA"),
> eventWrapper=eWrapper.MktData.CSV(1), file=spy.csv)
>
> Working perfectly fine.
>
> Now I try to read an Index/ETF from ibrokers to file. I get "2 1 300
> Can't find EId with tickerId:1"
> reqMktData(tws, ttwsEquity("SPX", exch="CBOE"),
> eventWrapper=eWrapper.MktData.CSV(1), file=spy.csv)
> I had this problem also previously for the first request, and then
> simply subscribing to correct data feed at IB helped me out. Newbie
> fault.
> This time I suspect I don't receive data is because twsEquity/twsSTK
> isn't made for Indices/ETFs. If this is so; could someone please nudge
> me some pointers to where in iBrokers package I could start trying to
> fix this.
>

did you really write "ttwsEquity"? Perhaps try ?twsContract (untested):

myCon <- twsContract(local = "SPX", sectype = "IND",
                     exch = "CBOE", currency = "USD",
                     include_expired = 1,
                     conId = "", symbol = "", primary = "", expiry = "",
                     strike = "", right = "", multiplier = "",
                     combo_legs_desc = "",
                     comboleg = "", secIdType = "", secId = "")



regards,
Enrico

>
> Thanks and Regards,
> Matti Zemack
>
> -----
> Matti Zemack, Broadcast Technology, Stockholm, Sweden
> matti.zemack at gmail.com
>

-- 
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net



More information about the R-SIG-Finance mailing list