Hi Preston,

There are a few issues in how the contracts are getting constructed.

I'll push a new version tonight, but you can try the following:

replace "as.list(...)" with "list(...)" in twsBAG

And then make sure you set designatedLocation="" in twsComboLeg  (it
presently defaults to NULL)

> str(twsBAG(leg1,leg2))
List of 16
 $ conId          : num 0
 $ symbol         : chr "USD"
 $ sectype        : chr "BAG"
 $ exch           : chr "SMART"
 $ primary        : chr ""
 $ expiry         : chr ""
 $ strike         : chr "0.0"
 $ currency       : chr "USD"
 $ right          : chr ""
 $ local          : chr ""
 $ multiplier     : chr ""
 $ combo_legs_desc: NULL
 $ comboleg       :List of 2
  ..$ :List of 11
  .. ..$ conId             : chr "76308624"
  .. ..$ ratio             : num 1
  .. ..$ action            : chr "SELL"
  .. ..$ exchange          : chr "GLOBEX"
  .. ..$ openClose         : num 0
  .. ..$ shortSaleSlot     : num 0
  .. ..$ designatedLocation: chr ""
  .. ..$ SAME              : num 0
  .. ..$ OPEN              : num 1
  .. ..$ CLOSE             : num 2
  .. ..$ UNKNOWN           : num 3
  .. ..- attr(*, "class")= chr "twsComboLeg"
  ..$ :List of 11
  .. ..$ conId             : chr "79028701"
  .. ..$ ratio             : num 1
  .. ..$ action            : chr "BUY"
  .. ..$ exchange          : chr "GLOBEX"
  .. ..$ openClose         : num 0
  .. ..$ shortSaleSlot     : num 0
  .. ..$ designatedLocation: chr ""
  .. ..$ SAME              : num 0
  .. ..$ OPEN              : num 1
  .. ..$ CLOSE             : num 2
  .. ..$ UNKNOWN           : num 3
  .. ..- attr(*, "class")= chr "twsComboLeg"
 $ include_expired: chr "0"
 $ secIdType      : chr ""
 $ secId          : chr ""
 - attr(*, "class")= chr "twsContract"

placeOrder(ibg, twsBAG(leg1,leg2), twsOrder(reqIds(ibg),"BUY",1,"MKT"))
> reqOpenOrders(ibg)
TWS OrderStatus: orderId=1 status=PendingSubmit filled=0 remaining=1
averageFillPrice=0

I'll test more completely tomorrow, but for now I think that should solve
the issue.

Best,
Jeff

On Mon, Aug 8, 2011 at 7:15 PM, psmith <preston.c.smith@gmail.com> wrote:

> If anyone has successfully placed a combination order with the IBrokers
> package, I'd appreciate it if you could post an example.  I have tried the
> code below but although there are no errors, there is no order in TWS.
>  Also
> if I follow this with a reqCurrentTime(tws), I get a bunch of warnings of
> the type:
>
> Warning: Unknown incoming message: °'. Please reset connection
> Warning: Unknown incoming message: °›õ . Please reset connection
>
> Thanks for any insight.
>
> require(IBrokers)
> tws <- twsConnect(1)
> order <- twsOrder( orderId=reqIds(tws), totalQuantity = "1",  lmtPrice =
> "1"
> )
> bag <- twsBAG(
>  list(
>    twsComboLeg(
>      conId = "79265697",
>      ratio = "1",
>      action = "BUY",
>      exchange = "SMART"
>    )
>    ,
>    twsComboLeg(
>      conId = "79265687",
>      ratio = "1",
>      action = "SELL",
>      exchange = "SMART"
>    )
>  )
> )
> placeOrder( tws, bag, order)
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Placing-Combo-orders-with-IBrokers-tp3728669p3728669.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> R-SIG-Finance@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.




-- 
Jeffrey Ryan
jeffrey.ryan@lemnica.com

www.lemnica.com
www.esotericR.com

	[[alternative HTML version deleted]]

