🖥️
AutoShares
  • Deploy Apps with AutoShares API
  • User guide
    • Introduction
    • Web Trader
      • Getting Started
      • Platform Layout
      • User Widgets
        • Account Information
        • Account Opening
          • Account Funding
            • ACH Transfers
            • Check Transfers
            • Wire Transfers
        • Chart
        • News
        • Trade Ticket
          • Mutual Funds Trade Ticket
        • Watchlists
        • Orders
        • Positions
        • Market Depth
        • Options
        • Hotkeys
    • Digital Advisor
      • Getting Started
      • Selecting an Investment Model
      • Portfolio Tab
      • Trading Tab
      • Activity Tab
      • Funding Tab
    • WebTrader for iOS
      • Getting Started
      • App Layout
      • Watchlist & Quotes View
        • Trade View
          • Stock Trading
          • Options Trading
      • Positions View
      • Orders View
      • Price Alerts View
      • Account View
      • Apple Watch Extension
    • Web Trader for Android
      • Getting Started
      • App Layout
      • Watchlist & Quote View
        • Trade View
      • Price Alerts
      • Accounts & Settings
    • Knowledge Base
      • Troubleshooting
        • Performance
          • Tips for Enhancing Performance
      • How-To Guides
        • Trading Accounts
          • How to Create a New Trading Account
        • Security
          • How to Enable Two-Factor Authentication
  • REST API
    • Introduction
    • Trading API
      • Overview
      • Authentication
        • Single-Factor Authentication
          • Syntax
        • Two-Factor Authentication
          • Syntax
      • User Registration
        • Get Required Fields
        • Register a User
      • Managing Users
        • Get User's Info
          • Syntax
        • Get User's Trading Settings
        • Get Mobile App Settings
        • Get User's Exchanges
        • Modify User's Settings
        • Update User's Password
      • Trading Accounts
        • Get Account's Balance Info
          • Syntax
        • Get Account's History
          • Syntax
        • List User's Accounts
          • Syntax
      • Password Reset
        • 1. Reset Trader's Password
        • 2. Retrieve the Secret Question
        • 3. Generate a Token For a New Password
        • 4. Update the Password
      • Trading Accounts
        • Open a New Trading Account
      • Account Funding
        • Create an ACH Relationship
        • Get an ACH Relationship
        • Get All ACH Relationships
        • Get the Default ACH Relationship
        • Modify an ACH Relationship
        • Delete an ACH Relationship
        • Approve an ACH Relationship
        • Deposit / Withdraw Funds via ACH
        • Cancel an ACH Transfer
        • Get All Transfers
      • Orders
        • Verify Order Placement
          • Syntax
        • Place Order
          • Syntax
        • Verify Order Replacement
          • Syntax
        • Replace Order
          • Syntax
        • Cancel an Order
          • Syntax
        • Get Order's Info
          • Syntax
        • Get Filtered Orders
          • Syntax
      • Positions
        • Get User's Positions
          • Syntax
        • Get User's Positions in a Security
          • Syntax
        • Get Market Value of all Security Groups
      • Securities
        • Get Equity Info by Internal ID
          • Syntax
        • Get Equity Info by Ticker
          • Syntax
        • Get Equity Info by Mask
          • Syntax
        • Get Filtered Equities
          • Syntax
        • Get Option Info by Internal ID
          • Syntax
        • Get Option Info by Ticker
          • Syntax
        • Get Options Expiration Dates
          • Syntax
        • Get an Option Chain
        • Get Filtered Options
          • Syntax
      • Watchlists
        • Add Security to Watchlist by ID
          • Syntax
        • Add Security to Watchlist by Ticker
          • Syntax
        • Create New Watchlist
          • Syntax
        • Delete Watchlist
          • Syntax
        • Get Specific Watchlist
          • Syntax
        • Get User's Watchlists
          • Syntax
        • Remove Security From Watchlist by ID
          • Syntax
        • Remove Security from Watchlist by Ticker
          • Syntax
        • Rename Watchlist
          • Syntax
      • Price Alerts
        • Create Price Alert
          • Syntax
        • Delete Price Alert
          • Syntax
        • Get Specific Alert
          • Syntax
        • Get User's Price Alerts
          • Syntax
        • Modify Price Alert
          • Syntax
      • Historical Data
        • Get Comparison Chart Data
          • Syntax
        • Get Candles and Indicators for a Security
          • Syntax
        • Get Chart Data in the Excel Format
          • Syntax
      • News
        • Get News for a Security
        • Get Corporate Actions for a Security
      • User Feedback
        • Submit Feedback
          • Syntax
      • Managing Transactions
        • Get Transactions
          • Syntax
      • Streaming Data
        • Quotes
        • Orders
        • Positions
        • Watchlists
        • Account Balances
      • Code Samples
        • Basic Authentication
        • Two-Factor Autentication
        • Placing New Orders
        • Get User Information
        • List User Positions
        • Get Trading Data for Charts
      • Terms and Definitions
        • Part I
        • Part II
        • Part III
Powered by GitBook
On this page
  • Overview
  • Request Body
  • Order Modification Verification Sample
  • Response
  • Common Mistakes
  • Requesting as a Non-Administrator
  • Failing to Specify the Et-App-Key Parameter
  • Providing an Incorrect Set of Parameters
  1. REST API
  2. Trading API
  3. Orders

Verify Order Replacement

Verify an order modification before committing changes

PreviousSyntaxNextSyntax

Last updated 4 years ago

Overview

This PUT endpoint enables you to verify an order replacement before using it to replace an existing order in Autoshares Trader. This might be useful for ensuring that the user has properly constructed an order and prevent any issues related with defective orders.

There are six required parameters that must be provided in the request:

  1. Et-App-Key (header). This is the unique key of your app that identifies your app when communicating with our service. Contact your administrator to get this key.

  2. Authorization (header). This is the authorization token from the very first .

  3. API version (path). Unless necessary, leave it at "1.0".

  4. Trading Account ID (path). This is the numeric ID of the trading account on which an existing order replacement must be verified.

  5. orderId (path). This is the id of the order which parameter replacement must be verified. You can retrieve IDs of orders of a particular trading account using this .

  6. modifyParams (body). This is a JSON file that contains the parameters that need to be modified in an existing order.

Here's the final template for this API request:

  • For orders that will only be verified by the API but not the execution venue (quick):

PUT apiURL/v1.0/accounts/{accountID}/preview/orders/{existingOrderID}
  • For orders that will be verified by the API and the execution venue too (slow):

PUT apiURL/v1.0/accounts/{accountID}/preview/syncorders/{existingOrderID}

Request Body

The body of this request represents the information that must verified before being replaced in an existing order. It must be sent in the JSON format with mandatory parameters about the order.

Order Modification Verification Sample

{
  "Id": 76320,
  "Quantity": 100,
  "Price": 240,
  "Comment": "Updating the limit price and target trading session",
  "TimeInforce": "GoodTillCancel",
  "ExtendedHours": "PREREG",
  "ExecutionInstructions" : {"Commission": "0.5"}
}

Response

In response to this request, you'll receive a JSON file confirming (or rejecting) that the order replacement has been properly constructed.

{
  "IsSuccessful": true,
  "Commission": 1.00000002,
  "Commissions": {
    "Per Trade Commission": 1,
    "Per Contract Commission": 2e-8
  },
  "Cost": 482,
  "NetCost": 483.00000002,
  "TotalCost": 1.00000002,
  "Quotes": [
    {
      "Ask": 266.7,
      "Bid": 266.61,
      "Last": 266.5,
      "Volume": 50,
      "OpenInterest": 0,
      "Symbol": "AAPL",
      "SecurityId": 4,
      "Timestamp": "2019-11-28T01:00:00Z"
    }
  ],
  "MarginChange": 0
}

where:

Parameter

Description

IsSuccessful

This field indicates if the order replacement has been successfully executed.

Commission

This is the total commission applicable to the order.

Commissions

This is an array that breaks down the applicable commissions.

Cost

This is the total cost of the order (including commission).

NetCost

This is the cost of the order less commission.

TotalCost

This is the gross commission applied to the order (including all other commissions).

Quotes

This is the last batch of quotes for this security (includes the security's ticker symbol, its internal identifier in Autoshares Trader, and the quote's timestamp).

MarginChange

This is the amount by which the trading account margin requirements will be affected once this order is filled.

Common Mistakes

Here are some of the common mistakes that developers make when attempting to verify an order replacement.

Requesting as a Non-Administrator

One of the most common mistakes that developers make when making this API request is to use the authorization token of a non-administrator. It's critical to understand that in order to be eligible for verifying order replacements, the requester must be an administrator. Otherwise you'll receive the 401 status code with the following message:

{
    "Message": "Authorization has been denied for this request."
}

So be sure to use the authorization token generated with an administrator's credentials.

Failing to Specify the Et-App-Key Parameter

If you specify the wrong Et-App-Key parameter or fail to include it in the header altogether, you'll get the following error:

{
    "error": "Application key is not defined or does not exist"
}

Providing an Incorrect Set of Parameters

Another common mistake made when sending this API request is failing to provide all mandatory parameters. Doing so will result in the 500 status code and the following error message:

{
  "message": "An error occurred while processing your request",
  "error": "Unexpected server error"
}

The following article covers the syntax for this API request in detail.

The first four parameters — ID, Quantity, Price, ExecutionInstructions, and Execution Instructions — are mandatory, while the remaining parameters should only be provided if necessary. Apart from these four parameters, the rest of the JSON should be constructed identically to the .

token request
API request
order placement JSON