[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-finance
Subject:    [R-SIG-Finance] Place limit orders using IBrokers
From:       Qi Li <qi.li22 () gmail ! com>
Date:       2013-10-15 14:32:29
Message-ID: CABQr56UkMmTJoEp1xSJD8F3K1L4ZHk26gLzUvCC5BPWLWo61Ug () mail ! gmail ! com
[Download RAW message or body]

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]]

_______________________________________________
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.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic