简体   繁体   中英

IBrokers Put in an Order at the Mid

I'm playing around with some ideas using R and IBrokers with a paper trading account. I'm looking at making orders through R, but was wondering if there's an easy way to make these orders at the mid price, since I'm not expecting to always buy and sell at the bid and ask.

I believe what I'm looking for is a Pegged-to-Midpoint order ( https://www.interactivebrokers.com/en/index.php?f=1058 ). I didn't see this as an order type in the R documentation for the IBrokers package. Does anyone know if this is doable?

According to the API documentation pegged midpoint the order type should be "PEG MID".

placeOrder(twsconn=tws,
            Contract=twsSTK("AAPL"), 
            Order=twsOrder(reqIds(tws),
                           action = "BUY", 
                           totalQuantity = 10, 
                           orderType = "PEG MID"))

Note: I have not tested this because it at the moment I have a live session going on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM