Learn R Programming

charlesschwabapi (version 1.0.5)

replace_order: Replace Order for Specific Account

Description

Given the tokens object from the `get_authentication_tokens` function, the encrypted account ID, and the order ID and the request body, replace the specific order. Due to the complexity of the orders that can be created/replaced, currently this function allows maximum flexibility by not cultivating an easier solution to building the request body and assumes the user passes the appropriate JSON. Much like the `place_order` function, it is strongly encouraged to look at the documentation (in this package and on the Charles Schwab developer site) for how to build proper orders before attempting to replace any. The user of this function assumes all risk that trades could not be replaced (and then executed) exactly as intended.

Usage

replace_order(tokens, encrypted_account_id, order_id, request_body)

Value

Returns a numeric order number and a message informing the user if the order was successfully placed/created or if there was an error.

Arguments

tokens

token object from `get_authentication_tokens` function (list).

encrypted_account_id

encrypted ID of the account from `get_account_numbers` function (string).

order_id

order ID to be replaced (numeric).

request_body

valid request to API for replacing an order (JSON).

Author

Nick Bultman, njbultman74@gmail.com, July 2024