req_all_open_orders: Request All Open Orders

View source: R/req_all_open_orders.R

req_all_open_ordersR Documentation

Request All Open Orders

Description

Update the treasury's ORDER_STATUSES and OPEN_ORDERS objects and, optionally, receive list of two tibbles containing the updated ORDER_STATUS and OPEN_ORDERS objects. req_all_open_orders() retreives information about every open order accessible by your username, regardless of the order's client ID (socket) or whether it was placed via the API or within the Trader Workstation (TWS).

Usage

req_all_open_orders(channel = NULL, return_data = is.null(channel))

Arguments

channel

One of the following:

  • Not Specified (Default): Opens a new connection to IB, uses it to issue the request and retrieve the response, and closes connection behind itself upon completion.

  • The Name of a Sock: Character vector, length 1. The name of an open, connected socket in the sock_drawer; e.g., "master", "tws", or "sock_123"

  • Numeric Client ID: Numeric, length 1. The client ID for which open orders are to be retrieved; e.g., 0, 874, 123. If a client ID is passed, and no socket in the sock_drawer is connected on that ID, then a new socket will be opened on that ID, and closed upon function exit.

  • A sockconn Connection: An open connection object of class "sockconn", connected to the IB API; e.g., sock_drawer$tws

return_data

Boolean of length 1. Defaults to TRUE unless argument channel is specified. If FALSE, data retrieved by the function will be returned as the funciton's output. If TRUE, then a Boolean succeses flag will be returned as the function's output indicating the success (TRUE) or failure (FALSE) of the function's attempt to transceive data to/from IB. Data in the treasury is always updated regardless of the value passed as return_data in the function call.

Value

This function is called for its side effect of updating the treasury, which takes place every time the function executes. Additionally, the function's return value depends upon the value passed in as return_data as follows:

  • If return_data == FALSE: A Boolean success flag, returned invisibly, indicating that the function executed correctly and updated the treasury with any new data retrieved.

  • If return_data == TRUE: Any new data retrieved will be returned in a tibble in addition to being added to the treasury. If no new data is available, returns NULL.

return_data defaults to TRUE unless channel is specified.

OPEN_ORDERS and ORDER_STATUSES Treasury Objects

This function updates the following treasury objects:

OPEN_ORDERS A tibble in which each row represents an order that, at the time it was last updated, had not fully filled. The column names are described in the Contract, Order, and OrderState sections of IB's documentation.

ORDER_STATUSES A tibble in which each row represents an order that, at the time it was last updated, had not fully filled. The column names are described in the Order Status section of IB's documentation.

See Also

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


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