[R-SIG-Finance] IBrokers : quotes from futures combo and reqIds
me
me at censix.com
Thu Jul 19 18:36:46 CEST 2012
Hi Stergios
I believe it is your ratios. They have to be integers.
your second one is
ratio = "1.06"
You will have to calculate the most feasible rational approximation to
your beta of
-1.06/1
One solution would be
-21/20 ~ -1.05
So you could set
leg1: ratio = "21"
leg2: ratio = "20"
That should do it.
Cheers
Soren
http://censix.com
On Thu, 19 Jul 2012 08:28:17 -0700 (PDT)
Stergios Marinopoulos <stergios_marinopoulos at yahoo.com> wrote:
> 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
>
> _______________________________________________
> 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.
------------------------------------------------------------------
Soren Wilkening
http://censix.com
More information about the R-SIG-Finance
mailing list