Learn R Programming

schwabr (version 0.1.3)

schwab_orderSearch: Search for orders by date

Description

Search for orders associated with a Schwab account over the previous 60 days. The result is a list of three objects:

  1. jsonlite formatted extract of all orders

  2. all entered orders with details

  3. a data frame of all executed orders with the executions

Usage

schwab_orderSearch(
  account_number,
  startDate = Sys.Date() - 30,
  endDate = Sys.Date(),
  maxResults = 50,
  orderStatus = "",
  accessTokenList = NULL
)

Value

a list of three objects: a jsonlite formatted extract of all orders, all entered orders with details, a data frame of all executed orders with the executions

Arguments

account_number

A Schwab account number associated with the Access Token

startDate

Orders from a certain date with. Format yyyy-mm-dd.

endDate

Filter orders that occurred before a certain date. Format yyyy-mm-dd

maxResults

the max results to return in the query

orderStatus

search by order status (ACCEPTED, FILLED, EXPIRED, CANCELED, REJECTED, etc). This can be left blank for all orders. See documentation for full list

accessTokenList

A valid Access Token must be set using the output from schwab_auth3_accessToken. The most recent Access Token will be used by default unless one is manually passed into the function.

Examples

Run this code
if (FALSE) {

# Get all orders run over the last 50 days (up to 500)
schwab_orderSearch(account_number = account_number,
            startDate = Sys.Date()-50,
            maxResults = 500, orderStatus = '')

}

Run the code above in your browser using DataLab