[R-SIG-Finance] IBrokers : quotes from futures combo and reqIds
Stergios Marinopoulos
stergios_marinopoulos at yahoo.com
Thu Jul 19 17:28:17 CEST 2012
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:
> In Java, if you create a proper BAG Contract you can use it with reqMktData() or
> reqHistoricalData(). I imagine the same holds true in R as well. (I can send Java examples if interested.)
>
> Try using IBrokers twsBAG() function to create a combo contract, and use the returned object as the contract to IBrokers's equivalent of reqMktData() and data should start streaming.
>
I'm unable to get that to work. If anyone else can get it to work,
please share your secret.
Thanks,
Garrett
More information about the R-SIG-Finance
mailing list