Dear all:

  I have a couple of questions on how to impose limit orders using IBrokers
and how to know the exact execution price by market order. I do not see any
explicit examples in the document.


  Examples:

  1. Market order works well: But how can I know the execute price using
market order?

library(IBrokers)
tws<-twsConnect()
id <- reqIds(tws)
sym <- "KEY"
contract <- twsEquity(sym,"SMART","ISLAND")
tradeAmount <- 100
actionString <- "BUY"
order <- twsOrder(id, action = actionString, totalQuantity =
abs(tradeAmount), orderType = "MKT")
placeOrder(tws, contract, order)
twsDisconnect(tws)

  2.   What I want is: to buy a stock at the top stack without specifying
limit price. Limit order without specifying price: Not working

library(IBrokers)
tws<-twsConnect()
id <- reqIds(tws)
sym <- "KEY"
contract <- twsEquity(sym,"SMART","ISLAND")
tradeAmount <- 100
actionString <- "BUY"
order <- twsOrder(id, action = actionString, totalQuantity =
abs(tradeAmount), orderType = "LMT")
placeOrder(tws, contract, order)
twsDisconnect(tws)

  3. Ideally, I want to first specify a limit order and then turn to a
market order automatically after a period of time such as 1 minute. Can we
do that using IBrokers functions?

  Thank you very much for you help.

  Regards,

Qi

	[[alternative HTML version deleted]]

