Skip to content
Prev 10525 / 15274 Next

IBrokers : quotes from futures combo and reqIds

I think see the problem. ?Looking at the TWS error log, I can see that IBrokers reqMkData() is requesting the following generic tick types by default: "100,101,104,106,165,221,225,236", (and this is documented in IBroker's reqMktData() DOH!!!) where

100:?Option Volume
101:?Option Open Interest 104:?Historical Volatility 106:?Option Implied Volatility 165:?Miscellaneous Stats 221:?Mark Price225:?Auction values236:?Shortable

Those tick types do not make sense for this BAG contract. ?The only thing that makes sense for this BAG contract is the spreads between bid, ask, or last. ? So when you call reqMktData() set?tickGenerics="". ?But when I try it, however, nothing seems to be happen.

I believe the eventWrapper argument or the CALLBACK argument to reqMktData() needs to be used in order to receive the (Java equivalent) tickPrice() events. ?Maybe someone with experience with those arguments can chime in.

--
Stergios Marinopoulos




----- Original Message -----
From: Stergios Marinopoulos <stergios_marinopoulos at yahoo.com>
To: G See <gsee000 at gmail.com>
Cc: "r-sig-finance at r-project.org" <r-sig-finance at r-project.org>
Sent: Thursday, July 19, 2012 11:28 AM
Subject: Re: [R-SIG-Finance] IBrokers : quotes from futures combo and reqIds

I took Garrett's example and tried to get it working using IBrokers. ?It's starts writing data to a file as expected, but then the error below is produced and quote data is no longer written to the file.?

2 1 320 Error reading request:-'wc' : cause - Unable format field -?




Here's the code:

library(IBrokers) ;
tws <- twsConnect(1)
bag <- twsBAG(
? ? twsComboLeg(
? ? ? ? conId = "756733", #conId("SPY"),
? ? ? ? ratio = "1",
? ? ? ? action = "BUY",
? ? ? ? exchange = "SMART"
? ? ) ?,
? ? twsComboLeg(
? ? ? ? conId = "73128548", #conId("DIA"),
? ? ? ? ratio = "1.06",
? ? ? ? action = "SELL",
? ? ? ? exchange = "SMART"
? ? )
)
bag.csv <- file("~/bag.csv", open="w")
reqMktData(tws, bag,?
? ? ? ? ? ?eventWrapper=eWrapper.MktData.CSV(1),?
? ? ? ? ? ?file=bag.csv)


--
Stergios Marinopoulos


----- Original Message -----
From: G See <gsee000 at gmail.com>
To: Stergios Marinopoulos <stergios_marinopoulos at yahoo.com>
Cc: omerle <omerle at laposte.net>; "r-sig-finance at r-project.org" <r-sig-finance at r-project.org>
Sent: Thursday, July 19, 2012 11:11 AM
Subject: Re: [R-SIG-Finance] IBrokers : quotes from futures combo and reqIds

On Thu, Jul 19, 2012 at 10:09 AM, Stergios Marinopoulos
<stergios_marinopoulos at yahoo.com> wrote:
I'm unable to get that to work.? If anyone else can get it to work,
please share your secret.

Thanks,
Garrett

_______________________________________________
R-SIG-Finance at r-project.org 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.