Introduction

This SDK provides an easy-to-use client for the E*TRADE REST API, offering VC++ developers convenient access to our trading platform.

What you can do with E*TRADE VC++ SDK

The VC++ SDK allows you to programmatically execute trades directly through the E*TRADE REST API in your VC++ application. It provides libraries for the following functional areas:

  • Authentication
  • Accounts
  • Market Data
  • Orders
Requirements

Our VC++ SDK requires the Visual C++ 2010 Redistributable package from Microsoft and the Code Synthesis XSD compiler and libraries from Code Synthesis.

You can download the VC++ 2010 Redistributable package at: http://www.microsoft.com/en-us/download/details.aspx?id=5555.

You can download the XSD 3.3 installer at: http://www.codesynthesis.com/products/xsd/download.xhtml.

Installation
  1. Create a directory, e.g., "C:\VC++ SDK".
  2. Download the VC++ SDK zip file from our developer website.
  3. Extract the files into the directory you created.

Once this is done, you can start using the SDK.

For details on data structures, data types, options, and other details of individual API features, consult the E*TRADE REST API Reference.

Libraries
The VC++ SDK includes the following libraries for use with the E*TRADE Developer Platform.
Library Description
ETCommon.dll, ETCommon.lib Common resources required by all other libraries
ETOAuth.dll, ETOAuth.lib OAuth authorization library
ETAccount.dll, ETAccount.lib Access to account-related services, transaction history, and alerts.
ETMarket.dll, ETMarket.lib Interface to the E*TRADE Market API
ETOrder.dll, ETOrder.lib Interface to the E*TRADE Orders API
Authorization

The E*TRADE Developer Platform uses the OAuth 1.0a open authentication protocol. This library provides the necessary authorization functionality. Please refer to the guide on Authorization for important information on using OAuth with the E*TRADE Developer Platform.

Get Request Token
bool COAuthSDK::GetRequestToken(CClientDetails &objClientDetails) 

This API acquires an OAuth request token using the consumer key and consumer secret. It throws exception if m_strConsumerKey or m_strConsumerSecret parameter(s) is empty.

CClientDetails

Name IN/OUT Description
m_environment IN Optional. Possible values are SANDBOX (default) and LIVE.
m_strConsumerKey IN OAuth consumer key provided by E*TRADE
m_strConsumerSecret IN OAuth consumer secret provided by E*TRADE
m_strToken OUT Returned by the function if successful
m_strTokenSecret OUT Returned by the function if successful
m_strCallback IN Optional; default value is "oob"
Authorize Application
string COAuthSDK::AuthorizeUrl(CClientDetails &objClientDetails) 

This API redirects the user to the E*TRADE authorization site to log in and receive a verification code.

CClientDetails

Name IN/OUT Description
m_environment IN Optional. Possible values are SANDBOX (default) and LIVE.
m_strConsumerKey IN Consumer key provided by E*TRADE
m_strConsumerSecret IN Optional
m_strToken IN/OUT This parameter serves a dual purpose when called as IN parameter. Function sets this parameter to empty string if it is successful.
m_strTokenSecret IN/OUT Optional
m_strCallback IN Optional; default value is "oob".
Get Access Token
bool COAuthSDK::GetAccessToken(CClientDetails &objClientDetails,string strVerifier) 

This API is used to get an OAuth access token using consumer key, consumer secret, request token, and request secret. This function throws exception if m_strConsumerKey, m_strConsumerSecret, m_strToken, or m_strTokenSecret is empty.

CClientDetails

Name IN/OUT Description
m_environment IN Optional. Possible values are SANDBOX (default) and LIVE.
m_strConsumerKey IN Consumer key
m_strConsumerSecret IN Consumer secret
m_strToken IN/OUT This parameter serves a dual purpose. It accepts the request token as input and returns the access token.
m_strTokenSecret IN/OUT This parameter serves a dual purpose. It takes the request token secret as input and returns the access token secret.
m_strCallback IN Optional; default value is "oob".
strVerifier IN The verification code received by the user after authenticating with the E*TRADE platform
Access Protected Resources
string COAuthSDK::GetProtectedResource(CClientDetails &objClientDetails,string strUrl, HttpMethodConstants httpMethod , string postParameters)

This API can call any REST E*TRADE API. Function will return XML by default; for JSON response, add .json to the URL.

CClientDetails

Name IN/OUT Description
m_environment IN Optional. Possible values are SANDBOX (default) and LIVE.
m_strConsumerKey IN Consumer key
m_strConsumerSecret IN Consumer secret
m_strToken IN/OUT This parameter set by GetAccessToken
m_strTokenSecret IN/OUT This parameter set by GetAccessToken
m_strCallback IN Optional; default value is "oob".
strUrl IN This is the URL of the desired REST API, as described in the REST API reference documentation. For example: https://etws.etrade.com/accounts/rest/accountpositions/12345678?count=10
httpMethod IN The HTTP method to use. Possible values are:
• GETMethod (default)
• POSTMethod
• DELETEMethod
postParameters IN This parameter contains XML for the HTTP request body. It is required only if using the HTTP POST method. For example:
<PlaceEquityOrder xmlns="http://order.etws.etrade.com">
  <EquityOrderRequest>
    <accountId>12345678</accountId>
    <clientOrderId>
      test23
    </clientOrderId>
    <limitPrice>19</limitPrice>
    <quantity>90</quantity>
    <symbol>ETFC</symbol>
    <orderAction>BUY</orderAction>
    <priceType>LIMIT</priceType>
    <marketSession>
      REGULAR
    </marketSession>
    <orderTerm>GOOD_FOR_DAY</orderTerm>
  </EquityOrderRequest>
</PlaceEquityOrder>
Renew Access Token
void COAuthSDK:: RenewToken(CClientDetails &objClientDetails)

This API is used to renew an Access Token. If successful, it returns "Access Token has been renewed".

CClientDetails

Name IN/OUT Description
m_environment IN Optional. Possible values are SANDBOX (default) and LIVE.
m_strConsumerKey IN Consumer key
m_strConsumerSecret IN Consumer secret
m_strToken IN/OUT This parameter serves a dual purpose. It accepts the request token as input and returns the access token.
m_strTokenSecret IN/OUT This parameter serves a dual purpose. It takes the request token secret as input and returns the access token secret.
m_strCallback IN Optional; default value is "oob".
Revoke Access Token
void COAuthSDK::RevokeToken(CClientDetails &objClientDetails) throw (...)

This API is used to revoke an existing access token. If successful, it returns "Revoked Access Token", and the access token becomes unusable.

CClientDetails

Name IN/OUT Description
m_environment IN Optional. Possible values are SANDBOX (default) and LIVE.
m_strConsumerKey IN Consumer key
m_strConsumerSecret IN Consumer secret
m_strToken IN/OUT This parameter serves a dual purpose. It accepts the request token as input and returns the access token.
m_strTokenSecret IN/OUT This parameter serves a dual purpose. It takes the request token secret as input and returns the access token secret.
m_strCallback IN Optional; default value is "oob".
Accounts

The Accounts library provides methods to access account-related resources.

List Accounts
AccountList CAccountSDK:: GetAccountList()

This API returns a list of accounts associated with the user. It takes no parameters.

Get Account Balance
CAccountBalanceResponse CAccountSDK:: GetAccountBalance(CString strAccountId)
This API returns the current account balance details for a specified account.
Type Name Description
CString strAccountId Numeric account ID
Get Account Positions
CAccountPositionsResponse CAccountSDK:: GetAccountPositions (CAccountPositionsRequest accountPositionsRequest)

This API returns positions held in the account.

CAccountPositionsRequest

Type Name Description
CString m_AccountId Numeric account ID
CString m_Count Optional. The number of positions in the account. Default is 25.
CString m_Marker Additional positions in the account if there are more than 25 positions. This is optional parameter.
CString m_Symbol The market trading symbol for the stock being bought or sold.
CString m_TypeCode Type of derivative that the position reflects. There are two options for the derivative.
• EQ (equity)
• OPTN (option)
• INDX (index)
• MF (mutual fund)
• FI (fixed income)
CString m_CallPut Option parameter that allows the owner the right to either buy or sell an option. Possible values are: CALL, PUT. Required if type code is OPTN.
double m_StrikePrice The price at which an option can be exercised. Required if type code is OPTN.
CString m_ExpYear The year the option will expire. Required if type code is OPTN.
CString m_ExpMonth The month the option will expire. Required if type code is OPTN.
CString m_ExpDay The day the option will expire. Required if type code is OPTN.
List Alerts
AlertList CAccountSDK:: GetAlerts()

This API lists alerts for the current user. It takes no parameters.

Read Alert
CAlertDetailsResponse CAccountSDK:: GetAlertDetails(int nAlertID)
This API retrieves alert details.
Type Name Description
int nAlertID Numeric alert ID
Delete Alert
CDeleteAlertResponse CAccountSDK:: DeleteAlert(int nAlertID)
This API can be invoked to delete a particular alert.
Type Name Description
int nAlertID Numeric alert ID
Market Data

The Market library provides methods to access E*TRADE market data.

Get Option Chains
COptionChainResponse CMarketSDK:: GetOptionChains(COptionChainRequest OptionChainRequestObj)

This API returns a list of option chains associated with a specific underlier.

COptionChainRequest

Type Name Description
CString m_ExpirationDay The day the option will expire
CString m_ExpirationMonth The month the option will expire
CString m_ExpirationYear The year the option will expire
CString m_ChainType The type of option chain. Possible values are:
• CALL (default)
• PUT
• CALLPUT
CString m_SkipAdjusted Value that either shows or does not show adjusted options. Adjusted options are defined as options that have undergone a change and the option contract has been amended to modify this change. Possible values are: TRUE (default), FALSE.
CString m_Underlier The market trading symbol for the stock being bought or sold.
Get Option Expiration Dates
COptionExpireDateResponse CMarketSDK:: GetOptionExpireDate(COptionExpireDateRequestWrappe OptionExpireDateRequestObj)

This API returns a list of the expiration dates for options that have the specified underlier.

COptionExpireDateRequestWrappe

Type Name Description
CString m_symbol The symbol of the underlying security or index for the option.
Look Up Product
CProductLookupResponse CMarketSDK:: GetProductLookup (CProductLookupRequest ProductLookupRequestObj)

This API looks up basic information about a stock or other instrument.

CProductLookupRequest

Type Name Description
CString m_Company The name of the company.
CString m_Type The type of security. Possible values are:
• EQ (equity)
• MF (mutual fund)
Get Quote
CQuoteResponse  CMarketSDK:: GetQuote(CQuoteReqeust QuoteRequestObj)

This API returns current market information for equities and options.

CQuoteReqeust

Type Name Description
StringList m_SymbolList The market trading symbol for the stock being bought or sold. This is a list of symbols which can be any of the following:
• EQ (equity)
• OPTN - option
The OPTN symbol has the following format (with six components separated by a colon):
underlier:year:month:day:optionType:strikePrice
CString m_DetailFlag Optional parameter specifying which details to return in the response. The possible values are:
• ALL (default)
• FUNDAMENTAL
• INTRADAY
• OPTIONS
• WEEK_52
The last four return different subsets of the ALL option. Details for all five are listed under the Get Quote API in the REST API Reference.
Orders

The Orders library provides methods to preview, place, modify, and delete market orders.

List Orders
COrderListResponse COrderSDK:: GetOrderList(COrderListRequest OrderListRequestObj)

This API returns a list of orders that are currently open or were active during the current day.

COrderListRequest

Type Name Description
CString m_AccountId Numeric account ID
CString m_Marker Parameter that designates additional orders in the account if there are more than the requested number of orders.
CString m_Count Parameter that returns the number of list of open orders or orders updated today. If not specified, the default value is 25.
Preview Equity Order
CEquityOrderResponse COrderSDK:: GetPreviewEquityOrder(CEquityOrderRequest EquityOrderRequestObj)

This API returns a preview of an equity order.

CRequestBase

Type Name Description
CString m_AccountId Numeric account ID
CString m_ClientOrderId Not used when requesting a preview
double m_LimitPrice The price at which to buy a share at or below a certain price, or sell the stock when it reaches a specified price. Required if price type is LIMIT or STOP_LIMIT.
long long m_PreviewId This property is not used for requesting previews
double m_StopPrice The price at which a share is to be bought or sold if specified in a limit order. Required if price type is STOP or STOP_LIMIT.

CBasicOrderRequest

Type Name Description
CString m_AllOrNone If TRUE, the transactions must be executed all at once, or not at all. Possible values are: TRUE, FALSE. Case-insensitive.
long long m_Quantity The number of shares to be bought or sold.
CString m_ReserveOrder If TRUE, publicly displays only a limited number of shares (the reserve quantity), instead of the entire order, to avoid influencing other traders. If TRUE, must also specify the reserveQuantity. Possible values are: TRUE, FALSE. Case-insensitive.
long long m_ReserveQuantity The number of shares to be publicly displayed if this is a reserve order. Required if reserve order.

CEquityOrderRequest

Type Name Description
CString m_symbol The market trading symbol for the share being bought or sold.
CString m_orderAction User-specified action that instructs the broker what action to perform. Possible values are:
• BUY
• SELL
• BUY_TO_COVER
• SELL_SHORT
CString m_priceType The type of pricing. Possible values are:
• MARKET
• LIMIT
• STOP
• STOP_LIMIT
• MARKET_ON_CLOSE
CString m_routingDestination The exchange where a user wants to send orders to be executed. Exchanges that can be selected are:
• AUTO
• ARCA
• NSDQ
• NYSE
CString m_marketSession Session when the equity order will be place. Possible values are:
• REGULAR
• EXTENDED
CString m_orderTerm The length of time an equity order is enforced. Possible values are:
• GOOD_UNTIL_CANCEL
• GOOD_FOR_DAY
• IMMEDIATE_OR_CANCEL (only used for limit orders)
• FILL_OR_KILL (only used for limit orders)
Place Equity Order
CEquityOrderResponse COrderSDK:: GetPlaceEquityorder (CEquityOrderRequest EquityOrderRequestObj)

This API submits an equity order.

CRequestBase

Type Name Description
CString m_AccountId Numeric account ID
CString m_ClientOrderId A reference number generated by the developer. Used to ensure that a duplicate order is not being submitted. It can be any value of 20 alphanumeric characters or less, but must be unique within this account. It does not appear in any API responses.
double m_LimitPrice The highest price at which to buy or the lowest price at which to sell if specified in a limit order. Required if price type is LIMIT or STOP_LIMIT.
long long m_PreviewId If the order was not previewed, this parameter should not be specified. If the order was previewed, this parameter must specify the numeric preview ID from the preview, and other parameters of this request must match the parameters of the preview.
double m_StopPrice The price at which a share is to be bought or sold if specified in a limit order.
Required if price type is STOP or STOP_LIMIT.

CbasicOrderRequest - inherits from CRequestBase

Type Name Description
CString m_AllOrNone If TRUE, the transactions must be executed all at once, or not at all. Possible values are: TRUE, FALSE. Case-insensitive.
long long m_Quantity The number of shares to be bought or sold.
CString m_ReserveOrder If TRUE, publicly displays only a limited number of shares (the reserve quantity), instead of the entire order, to avoid influencing other traders. If TRUE, must also specify the reserve quantity. Possible values are: TRUE, FALSE. Case-insensitive.
long long m_ReserveQuantity The number of shares to be publicly displayed if this is a reserve order. Required if reserve order.

CEquityOrderRequest - inherits from CBasicOrderRequest

Type Name Description
CString m_symbol The market trading symbol for the security being bought or sold.
CString m_orderAction User-specified action that instructs the broker what action to perform. Possible values are:
• BUY
• SELL
• BUY_TO_COVER
• SELL_SHORT
CString m_priceType The type of pricing. Possible values are:
• MARKET
• LIMIT
• STOP
• STOP_LIMIT
• MARKET_ON_CLOSE
CString m_routingDestination The exchange where a user wants to send orders to be executed. Exchanges that can be selected are:
• AUTO
• ARCA
• NSDQ
• NYSE
CString m_marketSession Session when the equity order will be placed. Possible values are: REGULAR, EXTENDED.
CString m_orderTerm The length of time an equity order is enforced. Possible values are:
• GOOD_UNTIL_CANCEL
• GOOD_FOR_DAY
• IMMEDIATE_OR_CANCEL (only used for limit orders)
• FILL_OR_KILL (only used for limit orders)
Preview Equity Order Change
CChangeEquityOrderResponse COrderSDK:: GetPreviewChangeEquityOrder (CChangeEquityOrderRequest ChangeEquityOrderRequestObj)

This API returns a preview of a change to an equity order.

CChangeOrderBase

Type Name Description
CString m_AccountId Numeric account ID
long long m_OrderNum Order number
CString m_ClientOrderId Not used when requesting a preview
double m_LimitPrice The highest price at which to buy or the lowest price at which to sell if specified in a limit order. Required if price type is LIMIT or STOP_LIMIT.
long long m_PreviewId This property is not used for requesting previews
double m_StopPrice The price at which a share is to be bought or sold if specified in a limit order. Required if price type is STOP or STOP_LIMIT.
CString m_AllOrNone If TRUE, the transactions must be executed all at once, or not at all. Possible values are: TRUE, FALSE. Case-insensitive.
CString m_Quantity The number of shares to be bought or sold.
CString m_ReserveOrder If TRUE, publicly displays only a limited number of shares (the reserve quantity), instead of the entire order, to avoid influencing other traders. If TRUE, must also specify the reserveQuantity. Possible values are: TRUE, FALSE. Case-insensitive.
long long m_ReserveQuantity The number of shares to be publicly displayed if this is a reserve order. Required if reserve order.

CChangeEquityOrderRequest - inherits from CChangeOrderBase

Type Name Description
CString m_PriceType The price type. Possible values are:
• MARKET
• LIMIT
• STOP
• STOP_LIMIT
• MARKET_ON_CLOSE
CString m_OrderTerm The length of time an equity order is enforced. Possible values are:
• GOOD_UNTIL_CANCEL
• GOOD_FOR_DAY
• IMMEDIATE_OR_CANCEL (only used for limit orders)
• FILL_OR_KILL (only used for limit orders)
Place Equity Order Change

CChangeEquityOrderResponse COrderSDK:: GetPlaceChangeEquityOrder

(CChangeEquityOrderRequest ChangeEquityOrderRequestObj)

This API executes a change equity order request.

CChangeOrderBase

Type Name Description
CString m_AccountId Numeric account ID
long long m_OrderNum; Order number
CString m_ClientOrderId A reference number generated by the developer. Used to ensure that a duplicate order is not being submitted. It can be any value of 20 alphanumeric characters or less, but must be unique within this account. It does not appear in any API responses.
double m_LimitPrice The highest price at which to buy or the lowest price at which to sell if specified in a limit order. Required if price type is LIMIT or STOP_LIMIT.
long long m_PreviewId If the order was not previewed, this parameter should not be specified. If the order was previewed, this parameter must specify the numeric preview ID from the preview, and other parameters of this request must match the parameters of the preview.
double m_StopPrice The price at which a share is to be bought or sold if specified in a limit order. Required if price type is STOP or STOP_LIMIT.
CString m_AllOrNone If TRUE, the transactions must be executed all at once, or not at all. Possible values are: TRUE, FALSE. Case-insensitive.
CString m_Quantity The number of shares to be bought or sold.
CString m_ReserveOrder If TRUE, publicly displays only a limited number of shares (the reserve quantity), instead of the entire order, to avoid influencing other traders. If TRUE, must also specify the reserveQuantity. Possible values are: TRUE, FALSE. Case-insensitive.
long long m_ReserveQuantity The number of shares to be publicly displayed if this is a reserve order. Required if reserve order.

CchangeEquityOrderRequest - CChangeOrderBase

Type Name Description
CString m_PriceType The price type. Possible values are:
• MARKET
• LIMIT
• STOP
• STOP_LIMIT
• MARKET_ON_CLOSE
CString m_OrderTerm The length of time an equity order is enforced. Possible values are:
• GOOD_UNTIL_CANCEL
• GOOD_FOR_DAY
• IMMEDIATE_OR_CANCEL (only used for limit orders)
• FILL_OR_KILL (only used for limit orders)
Preview Option Order
COptionOrderResponse  COrderSDK:: GetPreviewOptionOrder (CoptionOrderRequest OptionOrderRequestObj)

This API returns a preview of an option order.

CRequestBase

Type Name Description
CString m_AccountId Numeric account ID
CString m_ClientOrderId Not used when requesting a preview
double m_LimitPrice The highest price at which to buy or the lowest price at which to sell if specified in a limit order. Required if price type is LIMIT or STOP_LIMIT.
long long m_PreviewId This property is not used for requesting previews
double m_StopPrice The price at which to buy or sell if specified in a stop order. Required if priceType is STOP.

CBasicOrderRequest - inherits from CRequestBase

Type Name Description
CString m_AllOrNone If TRUE, the transactions must be executed all at once, or not at all. Possible values are: TRUE, FALSE. Case-insensitive.
long long m_Quantity The number of shares to be bought or sold.
CString m_ReserveOrder If TRUE, publicly displays only a limited number of shares (the reserve quantity), instead of the entire order, to avoid influencing other traders. If TRUE, must also specify the reserveQuantity. Possible values are: TRUE, FALSE. Case-insensitive.
long long m_ReserveQuantity The number of shares to be publicly displayed if this is a reserve order. Required if reserve order.

COptionSymbol

Type Name Description
CString m_Symbol The market trading symbol for the option underlier.
CString m_CallOrPut Value that allows the owner of an option the right to either buy or sell an option. Possible values are: CALL, PUT.
double m_StrikePrice The price at which an option is exercised
long long m_ExpirationYear The year the option will expire
long long m_ExpirationMonth The month the option will expire
long long m_ExpirationDay The day the option will expire

CoptionOrderRequest - inherits from CBasicOrderRequest

Type Name Description
double m_StopLimitPrice The designated boundary price for a stop-limit order. Used for STOP_LIMIT orders.
COptionSymbol m_SymbolInfo Refer to COptionSymbol
CString m_OrderAction User-specified action that instructs the broker what action to perform. Possible values are:
• BUY_OPEN
• SELL_OPEN
• BUY_CLOSE
• SELL_CLOSE
CString m_PriceType The type of pricing. Possible values are:
• MARKET
• STOP
• LIMIT
• STOP_LIMIT
CString m_RoutingDestination The exchange where a user wants to send orders to be executed. Exchanges that can be selected are:
• AUTO
• AMEX
• BOX
• CBOE
• ISE
• NOM
• NYSE
• PHX
CString m_OrderTerm The length of time an option order is enforced. Possible values are:
• GOOD_UNTIL_CANCEL
• GOOD_FOR_DAY
• IMMEDIATE_OR_CANCEL (only used for limit orders)
• FILL_OR_KILL (only used for limit orders)
Place Option Order
COptionOrderResponse COrderSDK:: GetPlaceOptionOrder( COptionOrderRequest OptionOrderRequestObj)

This API submits an option order.

CRequestBase

Type Name Description
CString m_AccountId Numeric account ID
CString m_ClientOrderId A reference number generated by the developer. Used to ensure that a duplicate order is not being submitted. It can be any value of 20 alphanumeric characters or less, but must be unique within this account. It does not appear in any API responses.
double m_LimitPrice The maximum price at which to buy, or the minimum price at which to sell. Required if price type is LIMIT or STOP_LIMIT.
long long m_PreviewId If the order was not previewed, this parameter should not be specified. If the order was previewed, this parameter must specify the numeric preview ID from the preview, and other parameters of this request must match the parameters of the preview.
double m_StopPrice The price at which to buy or sell if specified in a limit order. Required for STOP orders.

CbasicOrderRequest - inherits from CRequestBase

Type Name Description
CString m_AllOrNone If TRUE, the transactions must be executed all at once, or not at all. Possible values are: TRUE, FALSE. Case-insensitive.
long long m_Quantity The number of shares to be bought or sold.
CString m_ReserveOrder If TRUE, publicly displays only a limited number of shares (the reserve quantity), instead of the entire order, to avoid influencing other traders. If TRUE, must also specify the reserveQuantity. Possible values are: TRUE, FALSE. Case-insensitive.
long long m_ReserveQuantity The number of shares to be publicly displayed if this is a reserve order. Required if reserve order.

COptionSymbol

Type Name Description
CString m_Symbol The market trading symbol for the option underlier
CString m_CallOrPut Value that allows the owner of an option the right to either buy or sell an option. Possible values are: CALL, PUT.
double m_StrikePrice The strike price for the option
long long m_ExpirationYear The year the option will expire
long long m_ExpirationMonth The month the option will expire
long long m_ExpirationDay The day the option will expire

CoptionOrderRequest - CBasicOrderRequest

Type Name Description
double m_StopLimitPrice The designated boundary price for a stop-limit order. Used for STOP_LIMIT orders.
COptionSymbol m_SymbolInfo Refer to COptionSymbol class definition.
CString m_OrderAction User-specified action that instructs the broker what action to perform. Possible values are:
• BUY_OPEN
• SELL_OPEN
• BUY_CLOSE
• SELL_CLOSE
CString m_PriceType The type of pricing. Possible values are:
• MARKET
• STOP
• LIMIT
• STOP_LIMIT
CString m_RoutingDestination The exchange where a user wants to send orders to be executed. Exchanges that can be selected are:
• AUTO
• AMEX
• BOX
• CBOE
• ISE
• NOM
• NYSE
• PHX
CString m_OrderTerm The length of time an option order is enforced. Possible values are:
• GOOD_UNTIL_CANCEL
• GOOD_FOR_DAY
• IMMEDIATE_OR_CANCEL (only used for limit orders)
• FILL_OR_KILL (only used for limit orders)
Preview Option Order Change
CChangeOptionOrderResponse COrderSDK:: GetPreviewChangeOptionOrder (CChangeOptionOrderRequest ChangeOptionOrderRequestObj)

This API returns a preview of a change to an option order.

CChangeOrderBase

Type Name Description
CString m_AccountId Numeric account ID
long long m_OrderNum Order number
CString m_ClientOrderId Not used when requesting a preview
double m_LimitPrice The price at which to buy a share at or below a certain price, or sell the stock when it reaches a specified price.
Required if price type is LIMIT.
long long m_PreviewId This property is not used for requesting previews
double m_StopPrice The price at which a contract is to be bought or sold if specified in a limit order.
Required if price type is STOP.
CString m_AllOrNone If TRUE, the transactions must be executed all at once, or not at all. Possible values are: TRUE, FALSE. Case-insensitive.
CString m_Quantity The number of shares to be bought or sold.
CString m_ReserveOrder If TRUE, publicly displays only a limited number of shares (the reserve quantity), instead of the entire order, to avoid influencing other traders. If TRUE, must also specify the reserveQuantity. Possible values are: TRUE, FALSE. Case-insensitive.
long long m_ReserveQuantity The number of shares to be publicly displayed if this is a reserve order. Required if reserve order.

CchangeOptionOrderRequest - inherits from CChangeOrderBase

Type Name Description
double m_StopLimitPrice The designated boundary price for a stop-limit order.
Required if price type is STOP_LIMIT.
CString m_PriceType The type of pricing. Possible values are:
• MARKET
• STOP
• LIMIT
• STOP_LIMIT
CString m_OrderTerm The length of time an equity order is enforced. Possible values are:
• GOOD_UNTIL_CANCEL
• GOOD_FOR_DAY
• IMMEDIATE_OR_CANCEL (only used for limit orders)
• FILL_OR_KILL (only used for limit orders)
Place Option Order Change
CChangeOptionOrderResponse GetPlaceChangeOptionOrder (CChangeOptionOrderRequest ChangeOptionOrderRequestObj)

This API executes a change to an option order.

CChangeOrderBase

Type Name Description
CString m_AccountId Numeric account ID
long long m_OrderNum Order number
CString m_ClientOrderId A reference number generated by the developer. Used to ensure that a duplicate order is not being submitted. It can be any value of 20 alphanumeric characters or less, but must be unique within this account. It does not appear in any API responses.
double m_LimitPrice The price at which to buy a share at or below a certain price, or sell the stock when it reaches a specified price.
Required if price type is LIMIT.
long long m_PreviewId If the order was not previewed, this parameter should not be specified. If the order was previewed, this parameter must specify the numeric preview ID from the preview, and other parameters of this request must match the parameters of the preview.
double m_StopPrice The price at which a contract is to be bought or sold if specified in a limit order.
Required if price type is STOP.
CString m_AllOrNone If TRUE, the transactions must be executed all at once, or not at all. Possible values are: TRUE, FALSE. Case-insensitive.
CString m_Quantity The number of shares to be bought or sold.
CString m_ReserveOrder If TRUE, publicly displays only a limited number of shares (the reserve quantity), instead of the entire order, to avoid influencing other traders. If TRUE, must also specify the reserveQuantity. Possible values are: TRUE, FALSE. Case-insensitive.
long long m_ReserveQuantity The number of shares to be publicly displayed if this is a reserve order. Required if reserve order.

CchangeOptionOrderRequest - inherits from CChangeOrderBase

Type Name Description
double m_StopLimitPrice The designated boundary price for a stop-limit order.
Required if price type is STOP_LIMIT.
CString m_PriceType The type of pricing. Possible values are:
• MARKET
• STOP
• LIMIT
• STOP_LIMIT
CString m_OrderTerm The length of time an equity order is enforced. Possible values are:
• GOOD_UNTIL_CANCEL
• GOOD_FOR_DAY
• IMMEDIATE_OR_CANCEL (only for limit orders)
• FILL_OR_KILL (only for limit orders)
Cancel Order
CCancelOrderResponse GetCancelOrder(CcancelOrderRequest CancelOrderRequestObj)

This API submits a cancel request for the indicated order.

CCancelOrderRequest

Type Name Description
CString m_AccountId Numeric account ID
long long m_OrderNum Order number
Error Handling

Common exceptions and error messages for the VC++ SDK.

CExceptionSDK

Type Name Description
int m_nHTTPErrorCode HTTP error response code
int m_nErrorCode SDK error code, as detailed in table of error codes below
CString m_strErrorMsg Error message

CError

Type Name Description
int m_nHTTPErrorCode HTTP error response code.
int m_nErrorCode SDK error code, as in table of error codes below
CString m_strErrorMsg Error message

SDK Error Codes

Code Error Description
1001 ERROR_ENVIRONMENT_EMPTY
1002 ERROR_COMSUMER_KEY_EMPTY
1003 ERROR_COMSUMER_SECRET_EMPTY
1004 ERROR_REQUEST_TOKEN_EMPTY
1005 ERROR_REQUEST_TOKEN_SECRET_EMPTY
1006 ERROR_ACCESS_TOKEN_EMPTY
1007 ERROR_ACCESS_TOKEN_SECRET_EMPTY
1008 ERROR_VERIFIER_EMPTY
1009 ERROR_URL_EMPTY
1010 ERROR_POST_PARAM_EMPTY
2000 ERROR_ACCOUNT_ID_EMPTY
2001 ERROR_NO_OF_POSITION_EMPTY
2002 ERROR_ALERT_ID__EMPTY
5000 ERROR_XML_PARSING
3000 ERROR_SYMBOL_EMPTY
3001 ERROR_COMPANY_NAME_EMPTY
3002 ERROR_TYPE_EMPTY
3003 ERROR_SYSMBOL_KEY_EMPTY
5000 ERROR_MISSING_REQUIRED_FIELD
PLEASE READ THE IMPORTANT DISCLOSURES BELOW

By using E*TRADE API ("API") and accepting the terms of the Application Programming Interface License Agreement and the Application Programming Interface User Agreement, you agree that API may employ security policies, procedures and systems of Third Party providers which may or may not be less stringent and secure than the policies, procedures and systems of E*TRADE Securities LLC ("E*TRADE") or its affiliates. Material provided on API may have been produced by independent third parties not affiliated or endorsed by E*TRADE or its affiliates ("Third Party"). To the extent that API or Third Party providers express opinions or make recommendations, you understand that such opinions or recommendations are expressed by the Third Party provider and are not the opinions or recommendations of E*TRADE or its affiliates. E*TRADE is not responsible for the accuracy of market data displayed on API or made available by Third Party providers. There may be latency between the time an order (or other information) is submitted from API and the time the order is received by E*TRADE. The E*TRADE Two Second Execution Guarantee or any similar guarantee does not apply for orders placed through API and Third Party provider web sites. The E*TRADE CompleteTM Protection Guarantee does not apply. Orders created and submitted through API are not vetted until they are received by E*TRADE. It is possible that E*TRADE may reject an order placed through API. Please see the Application Programming Interface License Agreement and the Application Programming Interface User Agreement for more information.


The E*TRADE family of companies provides financial services including trading, investing, and related banking products and services to retail investors.


Securities products and services offered by E*TRADE Securities LLC, Member FINRA/SIPC.


System response and account access times may vary due to a variety of factors, including trading volumes, market conditions, system performance, and other factors.