req_auto_open_orders: Request Auto Open Orders

View source: R/req_auto_open_orders.R

req_auto_open_ordersR Documentation

Request Auto Open Orders

Description

By default, orders placed within the TWS user interface are "unbound", meaning that they have no order ID. req_auto_open_orders() toggles this behavior, allowing the user to configure TWS to assign IDs to new orders cretaed from within the TWS or not.

req_auto_open_orders() cannot be used on orders that are already placed from the TWS. In other words, if you submit an order within the TWS without having first called req_auto_open_orders(), then that order is mostly inaccessable by anything other than TWS.

Any API script or app that needs to access all orders placed – whether within the TWS, via the API, or any other source – should call req_auto_open_orders() during initiation (or, if a script, near the beginning) so that orders created by users in the TWS have an order ID, and can therefore be accessible to be modified by place_order() and canceled with cancel_order().

IB's documentation may be found on the Open Orders page.

Usage

req_auto_open_orders(bAutoBind = TRUE)

Arguments

bAutoBind

Logical, length 1, default TRUE. If TRUE, all subsequent orders created from within TWS will have an order ID (IB refers to orders having an ID as being "bound" in the documentation). If set to FALSE, future orders will not have an order ID ("unbound").

Details

TWS client required: TWS will only bind newly opened orders so long as the socket connected on clientId = 0 continues to be open. Closing the TWS socket is equivalent to calling req_auto_open_orders(FALSE).

orderId =x= permId: Although by default, orders created in TWS have no orderId, they do have a permId. permId can be used to identify an order, but cannot be used by the API to cancel or modify it.

Value

NULL, invisibly

See Also

Other orders: cancel_order(), place_order(), req_all_open_orders(), req_completed_orders(), req_ids(), req_open_orders()


JakeVestal/InteractiveTradeR documentation built on June 5, 2024, 2:21 p.m.