[R-SIG-Finance] IBrokers: placing a combo order
censix
censix0 at gmail.com
Mon Jul 13 10:42:03 CEST 2015
Hi Robert
I believe that the current IBrokers package implementation may not be well
suited for the use of ComboOrders. I am saying this because when I was
implementing an update to some functions in the IBrokers package a couple
of month ago because there had been changes IB had made to API messaging on
their side.
https://github.com/censix/INTRADAY-PartAB/blob/master/INTRADAY-PartA/__IBapi-clientVer63-v002.r
While doing this I ignored everything that had to do with Combo orders,
because I do not use them AND the current IBrokers package does, to my
knowledge NOT handle them correctly....
So at least from my side there is no easy answer to your question and it
may be very likely that you will not get this to work.
But then again, someone else may have fixed this ...
regards
Soren
On Fri, Jul 10, 2015 at 3:20 PM, Robert Schien <robsch at robsch.eu> wrote:
> I want to place a combo order (futures calendar spread) and
> tried this:
>
> library(IBrokers)
> tws <- ibgConnect()
> contr1 <- twsFuture("ESTX50","DTB","201512",currency="EUR")
> contr2 <- twsFuture("ESTX50","DTB","201509",currency="EUR")
> cid1 <- reqContractDetails(tws,contr1)[[1]]$conId
> cid2 <- reqContractDetails(tws,contr2)[[1]]$conId
> leg1 <- twsComboLeg(conId=cid1,ratio="1",action="BUY",exchange="DTB")
> leg2 <- twsComboLeg(conId=cid2,ratio="1",action="SELL",exchange="DTB")
> bag <- twsBAG(list(leg1,leg2))
> order <- twsOrder(1,"BUY",1,"MKT")
> placeOrder(tws,bag,order)
>
> reqOpenOrders(tws) delivered the error message that the details
> of leg '0' were invalid.
> I don't know what leg '0' is but I assume that it is the
> first leg in the combo.
>
> Have I overlooked a detail?
>
> I apologize for asking in this list but on the yahoolist twsapi
> are only few R programmers and I received no answer there.
>
> Thank you in advance.
> Robert
>
> _______________________________________________
> 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.
>
[[alternative HTML version deleted]]
More information about the R-SIG-Finance
mailing list