Schwab icon

Schwab

Interact with Schwab Trader API

Overview

The "Replace Order" operation in the Schwab node allows users to update or replace an existing order on the Schwab Trader platform. This is useful when you need to modify details of a previously placed order, such as changing quantities, prices, order types, or other parameters without canceling and creating a new order from scratch.

Typical use cases include:

  • Adjusting an order's price or quantity based on market conditions.
  • Changing the duration or session of an order.
  • Updating complex order strategies or special instructions.
  • Managing active orders programmatically within automated trading workflows.

For example, if you initially placed a limit order but want to change it to a market order or adjust the stop price, this operation facilitates that replacement seamlessly.

Properties

Name Meaning
Account Number The encrypted ID of the account associated with the order.
Order Id The unique identifier of the order to be replaced.
Session The trading session for the order. Options: NORMAL, AM, PM, SEAMLESS.
Duration How long the order remains active. Options: DAY, GOOD TILL CANCEL, FILL OR KILL, IMMEDIATE OR CANCEL, END OF WEEK, END OF MONTH, NEXT END OF MONTH, UNKNOWN.
Order Type The type of order to place. Options include MARKET, LIMIT, STOP, STOP LIMIT, TRAILING STOP, CABINET, NON MARKETABLE, MARKET ON CLOSE, EXERCISE, TRAILING STOP LIMIT, NET DEBIT, NET CREDIT, NET ZERO, LIMIT ON CLOSE.
Cancel Time The time at which the order should be canceled if not executed.
Complex Order Strategy Type Specifies complex order strategies like NONE, COVERED, VERTICAL, BACK RATIO, CALENDAR, DIAGONAL, STRADDLE, STRANGLE, COLLAR SYNTHETIC, BUTTERFLY, CONDOR, IRON CONDOR, VERTICAL ROLL, COLLAR WITH STOCK, DOUBLE DIAGONAL, etc.
Quantity The total quantity of the order.
Filled Quantity The quantity of the order that has already been filled.
Remaining Quantity The quantity of the order remaining to be filled.
Destination Link Name The destination link name for routing the order.
Release Time The time when the order should be released.
Stop Price The stop price for stop orders.
Stop Price Link Basis Basis for linking the stop price. Options: MANUAL, BASE, TRIGGER, LAST, BID, ASK, ASK BID, MARK, AVERAGE.
Stop Price Link Type Type of link for stop price. Options: VALUE, PERCENT, TICK.
Stop Price Offset Offset applied to the stop price.
Stop Type Type of stop order. Options: STANDARD, BID, ASK, LAST, MARK.
Price Link Basis Basis for linking the price. Options: MANUAL, BASE, TRIGGER, LAST, BID, ASK, ASK BID, MARK, AVERAGE.
Price Link Type Type of link for price. Options: VALUE, PERCENT, TICK.
Price The price for the order.
Tax Lot Method Method used for tax lot identification. Options: FIFO, LIFO, HIGH COST, LOW COST, AVERAGE COST, SPECIFIC LOT, LOSS HARVESTER.
Order Leg Collection JSON array describing the legs of the order, including instruments involved.
Activation Price Price at which the order becomes active.
Special Instruction Special instructions for the order. Options: ALL OR NONE, DO NOT REDUCE, ALL OR NONE DO NOT REDUCE.
Order Strategy Type Strategy type for the order. Options: SINGLE, CANCEL, RECALL, PAIR, FLATTEN, TWO DAY SWAP, BLAST ALL, OCO, TRIGGER.
Cancelable Boolean indicating if the order can be canceled.
Editable Boolean indicating if the order can be edited.
Status Current status of the order. Options include AWAITING PARENT ORDER, AWAITING CONDITION, ACCEPTED, QUEUED, WORKING, REJECTED, CANCELED, FILLED, EXPIRED, NEW, UNKNOWN, etc.
Entered Time Timestamp when the order was entered.
Close Time Timestamp when the order was closed.
Order Activity Collection JSON array detailing activities related to the order, including execution legs.
Replacing Order Collection JSON array of orders that are replacing this order.
Child Order Strategies JSON array of child order strategies associated with this order.
Status Description Text description of the current status.
Additional Headers Optional custom HTTP headers to send with the request (e.g., third-party IDs). Authorization headers are handled automatically.

Output

The output of the Replace Order operation is a JSON object representing the updated order details returned by the Schwab Trader API. This includes all relevant fields reflecting the new state of the order after replacement, such as updated quantities, prices, statuses, and any nested collections like order legs or child strategies.

If multiple orders are returned (unlikely in this context), each will be output as separate items.

No binary data output is expected from this operation.

Dependencies

  • Requires an OAuth2 API credential configured for Schwab Trader API access.
  • The node sends requests to https://api.schwabapi.com/trader/v1.
  • Proper authorization tokens must be available and valid.
  • Optional additional HTTP headers can be set per request.

Troubleshooting

  • No routing found error: If the operation-resource combination is misconfigured or missing routing info, the node will throw an error. Ensure the operation and resource names match exactly.
  • Authentication errors: Invalid or expired OAuth2 tokens will cause request failures. Refresh or reauthorize credentials as needed.
  • Invalid input data: Missing required properties like Account Number or Order Id will cause the API to reject the request.
  • JSON parsing errors: For JSON-type inputs (e.g., orderLegCollection), ensure valid JSON syntax is provided.
  • API rate limits or server errors: These will be surfaced as error messages; consider implementing retry logic or checking API usage quotas.
  • Continue On Fail: If enabled, errors for individual items will be captured in the output instead of stopping execution.

Links and References

Discussion