Tda API Docs
Tda API Docs
Reference
Table of Contents
Foreword 0
Part I Introduction 11
1 Preface ................................................................................................................................... 11
2 Typeface Conventions
................................................................................................................................... 12
3 Revision History
................................................................................................................................... 13
Part V LogIn 24
1 LogIn Request
................................................................................................................................... 25
2 LogIn Parameters
................................................................................................................................... 25
3 LogIn Response
................................................................................................................................... 26
4 Request/Response
...................................................................................................................................
Examples 28
5 Response Errors
................................................................................................................................... 30
Part VI LogOut 30
5 Response Errors
................................................................................................................................... 34
Part IX MessageKey 34
1 MessageKey...................................................................................................................................
Request 35
2 MessageKey...................................................................................................................................
Response 35
3 Request/Response
...................................................................................................................................
Examples 36
4 Response Errors
................................................................................................................................... 36
Part XI SymbolLookup 50
1 SymboLookup
...................................................................................................................................
Request 50
2 SymboLookup
...................................................................................................................................
Parameters 51
3 SymboLookup
...................................................................................................................................
Response 51
4 Request/Response
...................................................................................................................................
Examples 52
5 Response Errors
................................................................................................................................... 52
3
4 Trading Platform API Reference
5 Request/Response
...................................................................................................................................
Samples 62
6 VolatilityHistory
...................................................................................................................................
Error Response 62
Part XV BinaryOptionChain 74
1 BinaryOptionChain
...................................................................................................................................
Request 74
2 BinaryOptionChain
...................................................................................................................................
Parameters 75
3 BinaryOptionChain
...................................................................................................................................
Response 76
BinaryOptionChain
..........................................................................................................................................................
Response - Without Quotes 76
BinaryOptionChain
..........................................................................................................................................................
Response - With Quotes 77
4 Request/Response
...................................................................................................................................
Examples 81
Sample - Without
..........................................................................................................................................................
Quotes 81
Sample - With..........................................................................................................................................................
Quotes 82
5 BinaryOptionChain
...................................................................................................................................
Error Response 83
5
6 Trading Platform API Reference
1 EquityTrade
...................................................................................................................................
Request 156
2 EquityTrade
...................................................................................................................................
Parameters 157
3 EquityTrade
...................................................................................................................................
Validation Rules 158
4 EquityTrade
...................................................................................................................................
Response 160
5 Request/Response
...................................................................................................................................
Samples 162
6 EquityTrade
...................................................................................................................................
Errors 163
4 ConditionalOptionTrade
...................................................................................................................................
Response 187
5 Request/Response
...................................................................................................................................
Samples 190
6 ConditionalOptionTrade
...................................................................................................................................
Errors 192
7
8 Trading Platform API Reference
5 Request/Response
...................................................................................................................................
Samples 235
6 ComboOptionTrade
...................................................................................................................................
Errors 236
2 GetWatchlists
...................................................................................................................................
Parameters 258
3 GetWatchlists
...................................................................................................................................
Response 258
4 Request/Response
...................................................................................................................................
Samples 260
5 GetWatchlists
...................................................................................................................................
Errors 262
9
10 Trading Platform API Reference
Index 329
1 Introduction
Trading Platform
API Reference
ã TD Ameritrade Think Tech
6940 Columbia Gateway Drive • Suite 200
Columbia, MD 21046-2788
Phone 443.539.2100 • Fax 240.568.5778
Market volatility, volume and system availability may delay account access and trade
executions. Prices change quickly in fast market conditions, resulting in an execution price
different from the quote displayed at order entry. If you experience difficulties, please
contact Client Services, available 24 hours a day, 7 days a week (excluding market
holidays).
1.1 Preface
This Document
This document, Trading Platform API Reference, describing the TD Ameritrade Trading
Platform Application Programming Interface (TDAPI) and functions, is provided for use by
third-party developers. It specifies an open, standard interface that can be implemented on
any platform using any programming language.
Intended Audience
The document is written for programmers well versed in stock market research and trading
and with expert knowledge of web application programming such as: XML Schema
Definition (XSD) language, XML data parsing and Representational State Transfer (REST)
architectural style. In addition, this release of the document defines a proprietary response
data stream for some functions the receiving application must interpret.
Programming Guide describes the architecture of the API request/response protocols and
formats, security features, and data characteristics, such as character encodings, currency,
date/time formats, and other information.
The reset of the sections describe individual TD Ameritrade request/response pairs for a
variety of business functions.
See Appendix A: URL Encoding for additional information about how to encode parameter
strings required by functions described in this API reference.
Notational Conventions
Typefaces and text effects are used to identify text characteristics. These styles and the
characteristics they imply are described below:
Typeface Conventions
2 Development Considerations
2.1 General Considerations
A central tenet of Web services is the use of standardized protocols. By supporting this
pervasive set of standards (REST for initiating requests and XML for results, layered on a
foundation of standard Internet protocols), TD Ameritrade reduces the amount of work that a
developer must do to integrate with the TD Ameritrade Trading Platform and allows the use
of a wide variety of existing trading and research functions.
An important and useful property of REST is that the developer can use the web browser as
a development and prototyping tool for functions returning XML streams. Without writing any
code, the developer can enter a request URL into the browser address bar and click
"Submit" (or equivalent) to make a request. The browser then creates an HTTPS GET
request to the TDAPI server and displays the result. If the developer is using Internet
Explorer, the XML data returned by TDAPI is displayed in a convenient and readable outline
form. You can expand and collapse logical sections of the data by clicking "+" and
"-"symbols displayed to the left of the actual data. You must have a valid account with TD
Ameritrade and have successfully logged in before testing the URLs. Other formats cannot
be tested in this manner.
As convenient as this process is, this is only the first step in the developer's development
strategy. If the developer is building a downloadable client application or server-based
application accessing the TD Ameritrade Trading Platform, he or she will ultimately write
code to make the request and to process results. The exact way to do this is, of course,
dependent upon the target operating system and programming language. Fortunately,
almost every operating system and programming language has the ability to issue an HTTP
GET request and to parse (process) the results. Quite often these capabilities are provided
as part of a "toolkit" or other add-on. Although space within this document precludes an
exhaustive treatment of this topic, here are some recommendations to get you started:
Resources
To support developers, TD Ameritrade provides the following resources:
· Updates to the API to support new or improved features,
· An online FAQ will provide answers to common development questions. Questions
and answers from common support requests, and
· eMail support at [email protected]
· developer message boards at http://apiforms.tdameritrade.com
API users should consult with the TD Ameritrade Developer Relations team before
deployment of a potentially high-volume application, to ensure that the package design does
not exceed the server capacity and impact the client base. Application user requirements will
be considered on a case by case basis and TDA will make adjustments to resources if
justified.
Use streamer functions to provide real-time quote information. Do not use the single quote
function with a high refresh rate to simulate real-time quotes.
2.4 Resources
To support developers, TD Ameritrade provides the following resources:
· Updates to the API to support new or improved features,
· A message board will provide answers to common development questions (
http://apiforums.tdameritrade.com ). Questions and answers from common support
requests, and
· eMail support at [email protected]
3 Programming Guide
TD Ameritrade Trading Platform API (TDAPI) allows the developer to access TD Ameritrade
data and functionality through a Web site or Web-enabled application. TDAPI follows the
standard Web services model: users of the service request data over HTTP (REST) and
data is returned by the service as a formatted stream of text.
Throughout this programming guide, we will include examples to use with a browser to
quickly and easily formulate calls to TDAPI and review results. We recommend an
Internet-enabled computer to test TDAPI requests and immediately see the power and
flexibility of TDAPI.
TDAPI can be incorporated in many different ways over a variety of Web sites and client
applications. It provides an efficient method for accessing TD Ameritrade data for your
clients and adding value to your products.
After the end-user is authenticated and account parameters are returned, the client may
initiate requests. Available requests are:
· Synchronous requests (request/response) – Snapshot Quotes, Balances and Positions,
Order Status, Trading and Order Cancel - use HTTPS protocol where the request takes
the form of an HTTPS GET or POST with parameters as required by the type of request.
The response is returned using XML format,
NOTE: If you are using a POST, you must add two newline characters (ascii 10) to the
end of the data being posted.
WITH COOKIES
© TD Ameritrade Think Tech
Programming Guide 19
Upon a successful LogIn Command, the server will set a cookie called JSESSIONID with the
same value as the LogIn XML response tag session-id. Once that cookie is set, you can
issue subsequent HTTPS commands without having to pass anything else in the URL, as
long as you automatically handle the cookies. If you need to connection multiple sessions,
you can store the session-id value from the login to each session and then set the
JSESSIONID cookie accordingly prior to EVERY HTTPS call.
WITHOUT COOKIES
Upon a successful LogIn Command, the server will return XML result tag session-id. You
then include jsessionid=#session-id# in every HTTPS URL call (NOT Including streaming
API commands). The way you add the parameter is a bit different than the regular
parameters. For example, to get quotes, the regular URL would be:
https://apis.tdameritrade.com/apps/100/Quote?source=<#sourceID#>&symbol=<#symbol#>
NOTES:
1) the jsessionid parameter is added BEFORE the question mark and is separated from the
path using a semicolon
2) the name of the cookie and parameter is case sensitive. It has to be UPPER CASE for
COOKIE and lower case if in the URL
3) The value of the sessionid is also case sensitive. It has to be entered exactly as it was
returned from LogIn
3.3 Source ID
Organizations are assigned a unique identifier to be passed as part of every request to the
TD Ameritrade Trading Platform generated by the organization's software packages. The
identifier is a string that indicates the company and product making the request. The support
team at TD Ameritrade uses this information to analyze traffic from a source and isolate
groups of data when a developer requests support. The business team aggregates data by
source for statistical reporting.
For example, Get Rich Quick LLC (a hypothetical company) provides a real time charting,
quote and trading software package, version 2.3, and a separate tool for back testing trading
strategy models, version 3.4.3. TDA creates two identifiers, one for each package. The first
identifier is XA and the second is XB.
The identifier is part of each request string and is referenced throughout this document.
4 URL Encoding
Many of the request strings require that the URL parameters be encoded before
transmission. Encoding is the process of substituting some characters in the request
parameters for other characters. This enables passing of the arguments with characters that
otherwise might be misinterpreted in the process. The background for encoding is based on
RFC 1738: Uniform Resource Locators (URL) specification.
The specification for URLs (RFC 1738, Dec. '94) poses a problem, in that it limits the use of
allowed characters in URLs to only a limited subset of the US-ASCII character set:
HTML, on the other hand, allows the entire range of the ISO-8859-1 (ISO-Latin) character
set to be used in documents. HTML4 expands the allowable range to include all of the
Unicode character set as well. In the case of non-ISO-8859-1 characters (characters above
FF hex/255 decimal in the Unicode set), they just cannot be used in URLs because there is
no safe way to specify character set information in the URL content [RFC2396.]
Non-ASCII characters
Why: These are by definition not legal in URLs since they are not in the
ASCII set.
Characters: Includes the entire "top half" of the ISO-Latin set 80-FF hex (128-255
decimal.)
"Reserved characters"
Why: URLs use some characters for special use in defining their syntax.
When these characters are not used in their special role inside a URL,
they need to be encoded.
Equals ("=") 3D 61
Question mark ("?") 3F 63
'At' symbol ("@") 40 64
"Unsafe characters"
Why: Some characters present the possibility of being misunderstood within URLs for
various reasons. These characters should also always be encoded.
Example
Space = decimal code point 32 in the ISO-Latin set.
32 decimal = 20 in hexadecimal
The URL encoded representation will be "%20"
¡ %A1 Ñ %D1
¢ %A2 Ò %D2
£ %A3 Ó %D3
%A4 Ô %D4
¥ %A5 Õ %D5
| %A6 Ö %D6
§ %A7 %D7
¨ %A8 Ø %D8
© %A9 Ù %D9
ª %AA Ú %DA
« %AB Û %DB
¬ %AC Ü %DC
¯ %AD Ý %DD
® %AE Þ %DE
¯ %AF ß %DF
° %B0 à %E0
± %B1 á %E1
² %B2 â %E2
³ %B3 ã %E3
´ %B4 ä %E4
µ %B5 å %E5
¶ %B6 æ %E6
· %B7 ç %E7
¸ %B8 è %E8
¹ %B9 é %E9
º %BA ê %EA
» %BB ë %EB
¼ %BC ì %EC
½ %BD í %ED
¾ %BE î %EE
¿ %BF ï %EF
5 LogIn
Service provides user login capability through the authorization processes. A successful
login returns fields required for additional access. Error messages are returned for failed
logon attempts.
Request URL
https://apis.tdameritrade.com/apps/100/LogIn?source=#sourceID#&version=#version number#
Parameters
The following parameters have to be POSTed:
userid=#userid#&password=#password#&source=#sourceID#&version=#version number#
NOTE that the source and version are repeated. They show up in both the URL parameters
and in the POST data.
BIG NOTE: You MUST have "Content-Type" HTTP Header specified otherwise the
login will fail:
Content-Type: application/x-www-form-urlencoded
password The Password used for entering YES The value is assigned to the
the TDA web site end-user and should be provided by
the end user in order to login to the
site
source The Application ID of the software YES The value is assigned by TD
client assigned by Ameritrade. AMERITRADE to the application
developer for the specific application
version The Version number of the client YES version number of the client software
software application. application.
e.g. version=1.0
<account>
......
</account>
</accounts>
</xml-log-in>
</amtd>
unified String/Bo true/false - Indicates if the account is enabled for Unified Site. If
olean not, then you will not be able to launch any URL commands with /u/
in them
preferences Complex Container for the Preferences for the given account
express-tradi String/Bo true/false - Indicates if the user has selected Express Trading
ng olean option on the web site (does not affect API)
options-direct String/Bo true/false - Indicates if the account is enabled for direct routing
-routing olean options orders
stock-direct-r String/Bo true/false - Indicates if the account is enabled for direct routing
outing olean stock orders
authorization Complex Container for the Authorizations for the given account
s
apex String/Bo true/false - denotes whether or not the account has APEX status
olean
level2 String/Bo true/false - Indicates whether the account is authorized for Level 2
olean quotes (NASDAQ Level II)
stock-trading String/Bo true/false - Indicates if the account is enabled for stock trading
olean
option-tradin String Indicates if the account is enabled for options trading. If so, then
g the type of permissions. Possible values are:
none
long covered
spread full
margin-tradin String/Bo true/false - Indicates if the account is enabled for MARGIN trading.
g olean If false, then its a CASH account
streamer String/Bo true/false - Indicates if the account is enabled for streaming data
olean access
streaming-ne String/Bo true/false - Indicates if the account is enabled for streaming news
ws olean
advanced-ma String/Bo true/false - Indicates if the account will use a new middleware
rgin olean (AMX-TIBCO) for margin computation
Request:
https://apis.tdameritrade.com/apps/100/LogIn?source=#sourceID#&version=#version
POST DATA
userid=#userid#&password=#password#&source=#sourceID#&version=#version
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<xml-log-in>
<session-id>OK</session-id>
<user-id>joeabandon13</user-id>
<cdi>A000000000001111</cdi>
<timeout>55</timeout>
<option-trading>long</option-trading>
<streamer>true</streamer>
<advanced-margin>true</advanced-margin>
</authorizations>
</account>
</accounts>
</xml-log-in>
</amtd>
Request:
https://apis.tdameritrade.com/apps/100/LogIn?userid=#userid#&password=#password#
&source=#sourceID#&version=#version
Response:
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Login Failed</error>
</amtd>
This will occur if you put all the parameters into the URL (use a GET to request the data).
All LOGIN Requests must be POSTs.
If the any of the required parameters is missing or incorrect, the following generic error
message is displayed:
Request:
https://apis.tdameritrade.com/apps/100/LogIn?source=#sourceID#&version=#version
POST DATA
userid=#userid#
Response:
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Unable to authorize access.</error>
</amtd>
6 LogOut
This call will invalidate the user session. It is a security feature that should be called when
the user wants to stop their current session or close the client application.
Request URL
https://apis.tdameritrade.com/apps/100/LogOut?source=#sourceID#
Parameters
Response:
<?xml version="1.0" ?>
<amtd>
<result>LoggedOut</result>
</amtd>
7 KeepAlive
If the login user is inactive for more than the timeout period, the session will expire and the
client will need to login again. This servlet is specifically designed to refresh the login user
session so that it does not expire.
Request URL
https://apis.tdameritrade.com/apps/KeepAlive?source=#sourceID#
Parameters
No parameters are needed other then the source
Response:
The response to the KeepAlive request will be a one world reply. Either "LoggedOn" or
"InvalidSession" without html or xml formatting. The content type is text/plain.
8 StreamerInfo
This service provides the Streamer data request information specific to the associated
logged in account. A successful StreamerInfo request returns fields required for access to
streaming data requests. Error messages are returned if the account is not enabled for
streaming data.
NOTE: The StreamerInfo parameters that are returned are good for 24 hours. You
would need to re-submit the StreamerInfo request if you are running your software
overnight.
ALSO NOTE: The info returned from StreamerInfo is account specific. The information
is returned for the associated account, even if there are many accounts linked for the given
login. Therefore, when using the information to request streaming data, you have to make
sure to send the associated account #, company and segment parameters, regardless of
which linked account may be the main one you are using.
Request URL
https://apis.tdameritrade.com/apps/100/StreamerInfo?source=<#SourceID#>
Parameters
The only parameter required is the source assigned by TD Ameritrade. The account id
parameter is optional.
<streamer-info>
<streamer-url></streamer-url>
<token></token>
<timestamp></timestamp>
<cd-domain-id></cd-domain-id>
<usergroup></usergroup>
<access-level></access-level>
<acl></acl>
<app-id></app-id>
<authorized></authorized>
<error-msg></error-msg>
</streamer-info>
</amtd>
Request:
https://apis.ameritrade.com/apps/100/StreamerInfo?source=#sourceID#
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<streamer-info>
<streamer-url>ameritrade02.streamer.com</streamer-url>
<token>1223749a1518c56c3b40c92123602a54a4d9ba2d</token>
<timestamp>1170615023913</timestamp>
<cd-domain-id>A000000018311352</cd-domain-id>
<usergroup>ACCT</usergroup>
<access-level>ACCT</access-level>
<acl>DRESGKMANSOLFNQ2QSTETFTOTTUAUR</acl>
<app-id>QT</app-id>
<authorized>Y</authorized>
<error-msg></error-msg>
</streamer-info>
</amtd>
Possible Errors
If the account is not enabled for streaming data, then user will get the following response:
NOTE: this would happen if the client is NON-Professional (or not yet declared) and one of
the exchange agreements is not signed
9 MessageKey
This service provides user the Encrypted Token for the accounts that can then be monitored
via Streamer ACCT_ACTIVITY request. A successful MessageKey request returns the key
for the accounts that were requested in the parameters and required for access to streaming
data requests. Error messages are returned if the specified accounts are not found or are
not permitted for the currently logged in User ID.
NOTE: The MessageKey token that is returned is good for 24 hours. You would need to
re-submit the MessageKey request if you are running your software overnight.
Request URL
https://apis.tdameritrade.com/apps/100/MessageKey?source=<#SourceID#
>&accountid=<#AccountNumber#>
Parameters
The request must contain the source ID assigned by TD Ameritrade. You can also specify
one or more account parameters to specify the accounts for which updates are to be
requested and thus the for which the message key is to be build. Only accounts that are
accessible for the logged in User ID can be specified.
If no account parameters are specified, the Message Key will be returned for all accounts
accounts accessible by the logged in User ID.
Request:
https://apis.ameritrade.com/apps/100/MessageKey?source=#sourceID#&account=
#accountNumber1#&account=#accountNumber2#
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<message-key>
<token>1223749a1518c56c3b40c92123602a54a4d9ba2d</token>
<timestamp>1170615023913</timestamp>
</message-key>
</amtd>
Possible Errors
If the account is not recognized or some other error occurred, then you would get the
following response:
</amtd>
NOTE: Use Streaming Data functions to provide real-time quote information whenever
possible. Do not use the single quote function with a high refresh rate to simulate real-time
quotes.
Request URL
https://apis.tdameritrade.com/apps/100/Quote?source=<#sourceID#>&symbol=<#symbol#>
Parameters
The quote parameter contains one or more symbols in a comma or space separated list.
<quote-list>
<error></error>
<quote>
<error></error>
<symbol></symbol>
<description></description>
<bid></bid>
<ask></ask>
<bid-ask-size></bid-ask-size>
<last></last>
<last-trade-size></last-trade-size>
<last-trade-date></last-trade-date>
<open></open>
<high></high>
<low></low>
<close></close>
<volume></volume>
<year-high></year-high>
<year-low></year-low>
<real-time></real-time>
<exchange></exchange>
<asset-type></asset-type>
<change></change>
<change-percent></change-percent>
</quote>
</quote-list>
</amtd>
Response Fields
All response fields will be different depending on the Asset Type of the symbol being quoted.
The fields for each specific asset type are documented at:
Stocks
Options
Indices
Mutual Funds
10.3.1 Quote Response - Stocks
last Doubl The price of the last trade for this symbol.
e
last-trade-siz Intege The number of shares traded at the last price.
e r
last-trade-dat String The date and time of the last trade. For example, "2006-06-30
e 14:36:27 EDT".
open Doubl The price of the first trade at normal market open. Extended hours'
e trading is not reflected in this value.
high Doubl The highest price trade for the symbol during the normal trading
e session. If the session is still open this represents the highest price to
the time of the quote.
low Doubl The lowest price trade for the symbol during the normal trading
e session. If the session is still open this represents the lowest price to
the time of the quote.
close Doubl The price of the last trade for the symbol at the end of the previous
e trading session.
volume Intege The number of shares traded for the symbol.
r
year-high Doubl The highest price trade for the symbol in the past 52 weeks
e
year-low Doubl The lowest price trade for the symbol in the past 52 weeks
e
real-time String Indicates whether the quote information is real-time or delayed.
true — Real-time quote if the account is subscribed to RT
false — Delayed quote if the account not subscribed to RT
exchange String Stock exchange where security symbol is listed. For example,
NASDAQ, AMEX, NYSE, OTC, PACX
asset-type String Type of asset the symbol represents (Equity in this case). It is a one
character code, such as:
E - Equity or ETF
F - Mutual Fund
I - Index.
O - Option
B - Bond
change Doubl The difference between the last trade price and the previous trading
e session's closing price. If the last trade price is greater than the
previous session's closing price, the value is returned without a leading
sign. If the last trade price is less than the previous session's closing
price the value is returned with "-" as the leading character.
change-perc String Percent change from the last trade price compared to the previous
ent session's closing price. For example, if the previous session closing
price is 14.48 and the last trade price is 14.88, the change is 0.40 and
the change percent is 2.76. The value is returned as 2.76%.
bid-ask-size String The size of the bid/ask shows how many contracts the market has
available at those prices. The value is displayed as "bid qty X ask qty".
For example, 390X41
last Doubl The price of the last trade for this symbol.
e
last-trade-siz Integ The number of contracts traded at the last price.
e er
last-trade-dat String The date and time of the last trade. For example, "2006-06-30
e 14:36:27 EDT".
open Doubl The price of the first trade at normal market open.
e
high Doubl The highest price trade for the symbol during the normal trading
e session. If the session is still open this represents the highest price to
the time of the quote.
low Doubl The lowest price trade for the symbol during the normal trading
e session. If the session is still open this represents the lowest price to
the time of the quote.
close Doubl The price of the last trade for the symbol at the end of the previous
e trading session.
volume Integ The number of shares traded for the symbol.
er
strike-price Doubl
e
open-interest Integ
er
expiration-mo Integ
nth er
expiration-da Integ
y er
expiration-ye Integ
ar er
real-time String Indicates whether the quote information is real-time or delayed.
true — Real-time quote if the account is subscribed to RT
false — Delayed quote if the account not subscribed to RT
exchange String Stock exchange where security symbol is listed. For example, OPRA,
AMEX
asset-type String Type of asset the symbol represents (Option in this case). It is a one
character code, such as:
E - Equity or ETF
F - Mutual Fund
I - Index.
O - Option
B - Bond
change Doubl The difference between the last trade price and the previous trading
e session's closing price. If the last trade price is greater than the
previous session's closing price, the value is returned without a leading
sign. If the last trade price is less than the previous session's closing
price the value is returned with "-" as the leading character.
change-perc String Percent change from the last trade price compared to the previous
ent session's closing price. For example, if the previous session closing
price is 14.48 and the last trade price is 14.88, the change is 0.40 and
the change percent is 2.76. The value is returned as 2.76%.
underlying-sy String
mbol
put-call String C or P
delta Doubl
e
gamma Doubl
e
theta Doubl
e
vega Doubl
e
rho Doubl
e
implied-volatil Doubl
ity e
days-to-expir Integ
ation er
time-value-in Doubl
dex e
multiplier Integ
er
error String Contains an error message, if any. For example, "The Security Symbol
is Invalid." would be returned if the symbol was not found. The error
container exists within each level and returns a message specific to the
layer.
quote Comp Container for detailed quote fields
lex
symbol String Symbol of the security being quoted. For example, $SPX.X
description String Contains a description of the symbol. For example, "NEW S & P 500
INDEX"
open Doubl The first quote for the session
e
high Doubl The highest price quote for the symbol during the normal trading
e session. If the session is still open this represents the highest price to
the time of the quote.
low Doubl The lowest price quote for the symbol during the normal trading
e session. If the session is still open this represents the lowest price to
the time of the quote.
last Doubl The price of the last quote for this symbol.
e
last-trade-dat String The date and time of the last update. For example, "2006-06-30
e 14:36:27 EDT".
close Doubl The price of the last quote for the symbol at the end of the previous
e trading session.
volume Integ
er
year-high Doubl The highest price quote for the symbol in the past 52 weeks
e
year-low Doubl The lowest price quote for the symbol in the past 52 weeks
e
real-time String Indicates whether the quote information is real-time or delayed.
true — Real-time quote if the account is subscribed to RT
false — Delayed quote if the account not subscribed to RT
exchange String Stock exchange where security symbol is listed. For example,
NASDAQ, AMEX, NYSE
asset-type String Type of asset the symbol represents (Index in this case). It is a one
character code, such as:
E - Equity or ETF
F - Mutual Fund
I - Index.
O - Option
B - Bond
change Doubl The difference between the last quote price and the previous trading
e session's closing price. If the last quote price is greater than the
previous session's closing price, the value is returned without a leading
sign. If the last quote price is less than the previous session's closing
pric,e the value is returned with "-" as the leading character.
change-perc String Percent change from the last quote price compared to the previous
ent session's closing price. For example, if the previous session closing
price is 14.48 and the last quote price is 14.88, the change is 0.40 and
the change percent is 2.76. The value is returned as 2.76%.
Request URL
https://apis.tdameritrade.com/apps/100/Quote?source=<#sourceID#
>&symbol=$SPX.X,AMTD_20070922P12.5,DELL,FFFEX
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<quote-list>
<error></error>
<quote>
<error></error>
<symbol>DELL</symbol>
<description>DELL INC COM Status Alert: Delinquent</description>
<bid>27.27</bid>
<ask>27.28</ask>
<bid-ask-size>2800X4600</bid-ask-size>
<last>27.28</last>
<last-trade-size>200</last-trade-size>
<last-trade-date>2007-06-12 10:03:11 EDT</last-trade-date>
<open>27.35</open>
<high>27.49</high>
<low>27.25</low>
<close>27.60</close>
<volume>2028822</volume>
<year-high>28.04</year-high>
<year-low>18.95</year-low>
<real-time>true</real-time>
<exchange>NASDAQ</exchange>
<asset-type>E</asset-type>
<change>-0.32</change>
<change-percent>-1.16%</change-percent>
</quote>
<quote>
<error></error>
<symbol>FFFEX</symbol>
<description>FID ABERDEEN ST TR FREEDM 2030</description>
<nav>16.75</nav>
<change>0.02</change>
<real-time>true</real-time>
<asset-type>F</asset-type>
</quote>
<quote>
<error></error>
<symbol>AMTD_20070922P12.5</symbol>
<description>AMTD Sep 22 2007 12.5 Put</description>
<bid>3.50</bid>
<ask>3.70</ask>
<bid-ask-size>244X61</bid-ask-size>
<last>3.70</last>
<last-trade-size>1</last-trade-size>
<last-trade-date>2007-06-12 10:45:27 EDT</last-trade-date>
<open>4.00</open>
<high>5.29</high>
<low>3.40</low>
<close>9.10</close>
<volume>5017</volume>
<strike-price>510.00</strike-price>
<open-interest>14775</open-interest>
<expiration-month>6</expiration-month>
<expiration-year>2007</expiration-year>
<real-time>true</real-time>
<exchange>OPRA</exchange>
<asset-type>O</asset-type>
<underlying-symbol>GOOG</underlying-symbol>
<delta>0.197</delta>
<gamma>0.008</gamma>
<theta>-1.193</theta>
<vega>0.139</vega>
<rho>0.01</rho>
<implied-volatility>68.074</implied-volatility>
<days-to-expiration>4</days-to-expiration>
<time-value-index>3.70</time-value-index>
<multiplier>100.00</multiplier>
</quote>
<quote>
<error></error>
<symbol>$SPX.X</symbol>
<description>NEW S & P 500 INDEX</description>
<high>1509.12</high>
<low>1497.69</low>
<last>1499.66</last>
<close>1509.12</close>
<year-high>1509.12</year-high>
<year-low>1219.29</year-low>
<real-time>true</real-time>
<asset-type>I</asset-type>
</quote>
</quote-list>
</amtd>
Request URL
https://apis.tdameritrade.com/apps/100/Quote?source=<#sourceID#>&symbol=DELL
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<quote-list>
<error></error>
<quote>
<error></error>
<symbol>DELL</symbol>
<description>DELL INC COM Status Alert: Delinquent</description>
<bid>27.27</bid>
<ask>27.28</ask>
<bid-ask-size>2800X4600</bid-ask-size>
<last>27.28</last>
<last-trade-size>200</last-trade-size>
<last-trade-date>2007-06-12 10:03:11 EDT</last-trade-date>
<open>27.35</open>
<high>27.49</high>
<low>27.25</low>
<close>27.60</close>
<volume>2028822</volume>
<year-high>28.04</year-high>
<year-low>18.95</year-low>
<real-time>true</real-time>
<exchange>NASDAQ</exchange>
<asset-type>E</asset-type>
<change>-0.32</change>
<change-percent>-1.16%</change-percent>
</quote>
</quote-list>
</amtd>
Request URL
https://apis.tdameritrade.com/apps/100/Quote?source=<#sourceID#
>&symbol=GOOG_032010C510
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<quote-list>
<error></error>
<quote>
<error></error>
<symbol>GOOG_032010C510</symbol>
<description>GOOG Mar 20 2010 510.0 Call</description>
<bid>3.50</bid>
<ask>3.70</ask>
<bid-ask-size>244X61</bid-ask-size>
<last>3.70</last>
<last-trade-size>1</last-trade-size>
<last-trade-date>2007-06-12 10:45:27 EDT</last-trade-date>
<open>4.00</open>
<high>5.29</high>
<low>3.40</low>
<close>9.10</close>
<volume>5017</volume>
<strike-price>510.00</strike-price>
<open-interest>14775</open-interest>
<expiration-month>6</expiration-month>
<expiration-day>15</expiration-day>
<expiration-year>2007</expiration-year>
<real-time>true</real-time>
<exchange>OPRA</exchange>
<asset-type>O</asset-type>
<underlying-symbol>GOOG</underlying-symbol>
<delta>0.197</delta>
<gamma>0.008</gamma>
<theta>-1.193</theta>
<vega>0.139</vega>
<rho>0.01</rho>
<implied-volatility>68.074</implied-volatility>
<days-to-expiration>4</days-to-expiration>
<time-value-index>3.70</time-value-index>
<multiplier>100.00</multiplier>
</quote>
</quote-list>
</amtd>
Request URL
https://apis.tdameritrade.com/apps/100/Quote?source=<#sourceID#>&symbol=$SPX.X
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<quote-list>
<error></error>
<quote>
<error></error>
<symbol>$SPX.X</symbol>
<description>NEW S & P 500 INDEX</description>
<open>1508.82</open>
<high>1509.12</high>
<low>1497.69</low>
<last>1499.66</last>
<close>1509.12</close>
<year-high>1509.12</year-high>
<year-low>1219.29</year-low>
<real-time>true</real-time>
<asset-type>I</asset-type>
</quote>
</quote-list>
</amtd>
Request URL
https://apis.tdameritrade.com/apps/100/Quote?source=<#sourceID#>&symbol=FFFEX
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<quote-list>
<error></error>
<quote>
<error></error>
<symbol>FFFEX</symbol>
<description>FID ABERDEEN ST TR FREEDM 2030</description>
<nav>16.75</nav>
<change>0.02</change>
<real-time>true</real-time>
<asset-type>F</asset-type>
</quote>
</quote-list>
</amtd>
Possible Errors
If the symbol is not valid you will get the following response:
<amtd>
<result>OK</result>
<quote-list>
<error></error>
<quote>
<error>The Security Symbol is Invalid.</error>
<symbol>XYZA</symbol>
<description></description>
<bid></bid>
<ask></ask>
<last></last>
<open></open>
<high></high>
<low></low>
<close></close>
<volume>0</volume>
<year-high></year-high>
<year-low></year-low>
<real-time>false</real-time>
<asset-type>E</asset-type>
<change></change>
<change-percent></change-percent>
</quote>
</quote-list>
</amtd>
11 SymbolLookup
Service provides the ability to lookup symbols for stocks and ETFs.
Request URL
https://apis.tdameritrade.com/apps/100/SymbolLookup?source=<#sourceID#>&matchstring=
some search string
Parameters
The matchstring parameter contains the text that you wish to search for.
error String Contains an error message, if any. For example, "The Security Symbol
is Invalid." would be returned if the symbol was not found. The error
container exists within each level and returns a message specific to the
layer.
search-string String The search string that was requested
symbol-result Comp Container for detailed fields for each result record
lex
symbol String Symbol of the security being returned as a possible match. For
example, DELL
description String Description of the symbol. For example, "DELL INC COM"
Request URL
https://apis.tdameritrade.com/apps/100/SymbolLookup?source=<#sourceID#
>&matchstring=bank%20of
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<symbol-lookup-result>
<error></error>
<search-string>bank of</search-string>
<symbol-result>
<symbol>BAC</symbol>
<description>BANK OF AMERICA CORPORATION COM</description>
</symbol-result>
<symbol-result>
<symbol>BAC-D</symbol>
<description>BANK OF AMERICA CORPORATION 1/1000 6.204%D</
description>
</symbol-result>
<symbol-result>
<symbol>BAC-L</symbol>
<description>BANK OF AMERICA CORPORATION 7.25%CNV PFD L</
description>
</symbol-result>
</symbol-lookup-result>
</amtd>
Possible Errors
If search string was not specified, you will get following response:
12 PriceHistory
This service provides the ability to retrieve historical intraday and end of day quote data
consolidated in OHLC format.
NOTE: in order to have the current session returned as part of the data, you must set the
enddate parameter to today
Request URL
https://apis.tdameritr ade.com/apps/100/PriceHistory?source=<##SourceID#
>&startdate=&enddate=&requestvalue=&intervaltype=&periodtype=&extended=&intervalduration
=&period=&requestidentifiertype=
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as the various
parameters defining the data being requested.
intervaldurati The size of the interval YES INTEGER. The valid values are
on (frequency) for the data dependent on the specified intervaltype
being requested. For :
example if intervaltype is MINUTE - 1, 5, 10, 15, 30
DAY, then 1 for 1 minute DAILY - 1
bars, 5 for 5 minute bars WEEKLY - 1
MONTHLY - 1
periodtype Indicates the units in which NO DAY,MONTH,YEAR,YTD
the "period" parameter will
be specified
period The number of periods for NO INTEGER. The valid values are
which the data is returned. dependent on the specified periodtype:
For example, if DAY - 1, 2, 3, 4, 5, 10
periodtype=DAY and MONTH - 1, 2, 3, 6
period=10, then the request YEAR - 1, 2, 3, 5 10, 15, 20
is for 10 days of data YTD - 1
PriceHistory Response
LENGTH
(8 BIT
FIELD TYPE BYTES) DESCRIPTION
Symbol Count Integer 4 Number of symbols for which data is being returned.
The subsequent sections are repeated this many
times
REPEATING SYMBOL DATA
close Float 4
high Float 4
low Float 4
open Float 4
volume Float 4 in 100's
timestamp Long 8 time in milliseconds from 00:00:00 UTC on January
1, 1970
END OF REPEATING PRICE DATA
Request:
Example requesting intraday data by specifying start and end date:
https://apis.tdameritrade.com/apps/100/PriceHistory?source=<#sourceID#>
&requestidentifiertype=SYMBOL&requestvalue=AMTD&intervaltype=MINUTE&intervalduration=1&e
xtended=true&startdate=20071107&enddate=20071126
NOTE: November 22, 2007 is a holiday, which is why only 2 days are returned for the above request
Possible Errors
Validation failed for 1 of 1 requests.Your request is not valid.
13 VolatilityHistory
This service provides the ability to retrieve historical implied volatility data.
Request URL
https://apis.tdameritr ade.com/apps/100/VolatilityHistory?source=<##SourceID#
>&requestidentifiertype=&requestvalue=&volatilityhistorytype=&intervaltype=&intervalduration=&
periodtype=&period=&startdate=&enddate=&daystoexpiration=&surfacetypeidentifier=&surfacety
pevalue=
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as the various
parameters defining the data being requested.
surfacetypeid Specifies the type of implied YES DELTA - The ratio comparing the
entifier volatility data to be returned. change in the price of the underlying
asset to the corresponding change in
the price
of a derivative.
The Contract Type will be "CALL" if the
delta is positive.
The Contract Type will be "PUT" if the
delta is negative.
DELTA_WITH_COMPOSITE - The
mean of 2 delta values, one CALL and
one PUT
daystoexpiration - If specified, must be one of these values: 30, 60, 90, 120, 150, 180
VolatilityHistory Response
LENGTH
(8 BIT
FIELD TYPE BYTES) DESCRIPTION
Symbol Count Integer 4 Number of symbols for which data is being returned.
The subsequent sections are repeated this many
times
REPEATING DATA
Value Float 4
Timestamp Long 8 time in milliseconds from 00:00:00 UTC on January
1, 1970
END OF REPEATING DATA
Request:
https://apis.tdameritrade.com/apps/100/VolatilityHistory?source=<#sourceID#>
&requestidentifiertype=SYMBOL&requestvalue=AMTD&intervaltype=DAILY&intervalduration=1&pe
riodtype=DAY&period=3&enddate=20071126&daystoexpiration=30&volatilityhistorytype=I&surfac
etypeidentifier=DELTA_WITH_COMPOSITE&surfacetypevalue=50%2C-50
Possible Errors
Validation failed for 1 of 1 requests.Your request is not valid.
14 OptionChain
Service provides option chain information with or without quotes on a single underlying
equity symbol.
Request URL
https://apis.tdameritrade.com/apps/200/OptionChain?source=<#sourceID#>&symbol=<
#symbol#>
Parameters
The symbol parameter contains the underlying symbol for the option chain being requested.
<strike-price></strike-price>
<standard-option></standard-option>
<put>
<option-symbol></option-symbol>
<description></description>
<bid></bid>
<ask></ask>
<bid-ask-size></bid-ask-size>
<last></last>
<last-trade-date></last-trade-date>
<volume></volume>
<open-interest></open-interest>
<real-time></real-time>
<underlying-symbol></underlying-symbol>
<delta></delta>
<gamma></gamma>
<theta></theta>
<vega></vega>
<rho></rho>
<implied-volatility></implied-volatility>
<time-value-index></time-value-index>
<multiplier></multiplier>
<change></change>
<change-percent></change-percent>
<in-the-money></in-the-money>
<near-the-money></near-the-money>
<theoretical-value></theoretical-value>
<deliverable-list>
<notes-description></notes-description>
<cash-in-lieu-dollar-amount></cash-in-lieu-dollar-amount>
<cash-dollar-amount></cash-dollar-amount>
<index-option></index-option>
<row>
<symbol></symbol>
<shares></shares>
</row>
<row>
<symbol></symbol>
<shares></shares>
</row>
...
</deliverable-list>
</put>
<call>
.... (Same fields as in the PUT record)
</call>
</option-strike>
...... (More option-strike records)
</option-date>
...... (More option-date records)
</option-chain-results>
</amtd>
Request URL
https://apis.tdameritrade.com/apps/200/OptionChain?source=<#sourceID#
>&symbol=AMTD&expire=200709
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<option-chain-results>
<error></error>
<symbol>AMTD</symbol>
<description>TD AMERITRADE HLDG CORP COM</description>
<option-date>
<date>20070922</date>
<expiration-type>R</expiration-type>
<days-to-expiration>4</days-to-expiration>
<option-strike>
<strike-price>12.50</strike-price>
<standard-option>true</standard-option>
<put>
<symbol>AMTD_092207P12.5</symbol>
<description>AMTD Sep 22 2007 12.5 Put</description>
</put>
<call>
<symbol>AMTD_092207C12.5</symbol>
<description>AMTD Sep 22 2007 12.5 Call</description>
</call>
</option-strike>
<option-strike>
<strike-price>15.00</strike-price>
<standard-option>true</standard-option>
<put>
<symbol>AMTD_092207P15</symbol>
<description>AMTD Sep 22 2007 15.0 Put</description>
</put>
<call>
<symbol>AMTD_092207C15</symbol>
<description>AMTD Sep 22 2007 15.0 Call</description>
</call>
</option-strike>
<option-strike>
<strike-price>20.00</strike-price>
<standard-option>true</standard-option>
<put>
<symbol>AMTD_092207P20</symbol>
<description>AMTD Sep 22 2007 20.0 Put</description>
</put>
<call>
<symbol>AMTD_092207C20</symbol>
<description>AMTD Sep 22 2007 20.0 Call</description>
</call>
</option-strike>
<option-strike>
<strike-price>22.50</strike-price>
<standard-option>true</standard-option>
<put>
<symbol>AMTD_092207P22.5</symbol>
<description>AMTD Sep 22 2007 22.5 Put</description>
</put>
<call>
<symbol>AMTD_092207C22.5</symbol>
<description>AMTD Sep 22 2007 22.5 Call</description>
</call>
</option-strike>
<option-strike>
<strike-price>25.00</strike-price>
<standard-option>true</standard-option>
<put>
<symbol>AMTD_092207P25</symbol>
<description>AMTD Sep 22 2007 25.0 Put</description>
</put>
<call>
<symbol>AMTD_092207C25</symbol>
<description>AMTD SEP 22 2007 25.0 Call</description>
</call>
</option-strike>
</option-date>
</option-chain-results>
</amtd>
Request URL
https://apis.tdameritrade.com/apps/200/OptionChain?source=<#sourceID#
>&symbol=AMTD&expire=200709"es=true
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<option-chain-results>
<error></error>
<symbol>AMTD</symbol>
<description>TD AMERITRADE HLDG CORP COM</description>
<bid>17.94</bid>
<ask>17.95</ask>
<bid-ask-size>400X2600</bid-ask-size>
<last>17.9401</last>
<open>17.94</open>
<high>18.12</high>
<low>17.69</low>
<close>17.78</close>
<volume>2402786.0</volume>
<change>0.1601</change>
<quote-punctuality>R</quote-punctuality>
<time>14:03:45</time>
<option-date>
<date>20071020</date>
<expiration-type>R</expiration-type>
<days-to-expiration>32</days-to-expiration>
<option-strike>
<strike-price>10.00</strike-price>
<standard-option>true</standard-option>
<put>
<option-symbol>AMTD_102007P10</option-symbol>
<description>AMTD Oct 20 2007 10.0 Put</description>
<bid></bid>
<ask>0.05</ask>
<bid-ask-size>0X619</bid-ask-size>
<last></last>
<volume>0</volume>
<open-interest>0</open-interest>
<real-time>false</real-time>
<underlying-symbol>AMTD</underlying-symbol>
<delta>-0.013</delta>
<gamma>0.007</gamma>
<theta>-0.003</theta>
<vega>0.002</vega>
<rho>0.00</rho>
<implied-volatility>95.18</implied-volatility>
<time-value-index>0.03</time-value-index>
<multiplier></multiplier>
<change>0.00</change>
<change-percent></change-percent>
<in-the-money>false</in-the-money>
<near-the-money>false</near-the-money>
<theoretical-value>0.03</theoretical-value>
<deliverable-list>
<row>
<cash-in-lieu-dollar-amount></cash-in-lieu-dollar-amount>
<cash-dollar-amount></cash-dollar-amount>
<index-option>false</index-option>
<symbol>AMTD</symbol>
<shares>100</shares>
</row>
</deliverable-list>
</put>
<call>
<option-symbol>AMTD_102007C10</option-symbol>
<description>AMTD Oct 20 2007 10.0 Call</description>
<bid>7.90</bid>
<ask>8.10</ask>
<bid-ask-size>210X121</bid-ask-size>
<last>7.50</last>
<last-trade-date>2007-09-07 10:03:34 EDT</last-trade-date>
<volume>0</volume>
<open-interest>139</open-interest>
<real-time>false</real-time>
<underlying-symbol>AMTD</underlying-symbol>
<delta>0.991</delta>
<gamma>0.005</gamma>
<theta>-0.003</theta>
<vega>0.001</vega>
<rho>0.009</rho>
<implied-volatility>88.79</implied-volatility>
<time-value-index>-0.44</time-value-index>
<multiplier></multiplier>
<change>0.00</change>
<change-percent></change-percent>
<in-the-money>true</in-the-money>
<near-the-money>false</near-the-money>
<theoretical-value>8.00</theoretical-value>
<deliverable-list>
<row>
<cash-in-lieu-dollar-amount></cash-in-lieu-dollar-amount>
<cash-dollar-amount></cash-dollar-amount>
<index-option>false</index-option>
<symbol>AMTD</symbol>
<shares>100</shares>
</row>
</deliverable-list>
</call>
</option-strike>
...... (More option-strike records)
</option-date>
</option-chain-results>
</amtd>
Possible Errors
If the symbol is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Please enter a valid symbol.</error>
</amtd>
15 BinaryOptionChain
Service provides option chain information with or without quotes on a single underlying
equity symbol in Binary format. Unlike the OptionChain request, BnaryOptionChain does not
support complex option chains
Request URL
https://apis.tdameritrade.com/apps/200/BinaryOptionChain?source=<#sourceID#>&symbol=<
#symbol#>
Parameters
The symbol parameter contains the underlying symbol for the option chain being requested.
A flag to request
quote data. The
quotes default behavior is NO true/false - Default is false if not specified
not to send quote
data.
LENGTH
(8 BIT
FIELD TYPE BYTES) DESCRIPTION
LENGTH
(8 BIT
FIELD TYPE BYTES) DESCRIPTION
Underlying Symbol Strin Variabl The description of the Underlying Symbol (Company
Description g e or Index Name)
Bid Doub 8
le
Ask Doub 8
le
Bid/Ask Size Length Short 2
Bid/Ask Size Strin Variabl
g e
Last Doub 8
le
Open Doub 8
le
High Doub 8
le
Low Doub 8
le
Close Doub 8
le
Volume Doub 8
le
Change Doub 8
le
Real Time Quote Char 2 R or D (2 bytes because it is Unicode)
Flag
Quote Time Length Short 2
Quote Time Strin Variabl
g e
Row Count Integ 4 Number of option symbols returned
er
REPEATING Block for each Option Symbol
LENGTH
(8 BIT
FIELD TYPE BYTES) DESCRIPTION
LENGTH
(8 BIT
FIELD TYPE BYTES) DESCRIPTION
LENGTH
(8 BIT
FIELD TYPE BYTES) DESCRIPTION
Request URL
https://apis.tdameritrade.com/apps/200/BinaryOptionChain?source=<#sourceID#
>&symbol=AMTD&expire=201005&strike=17.5
Response:
00 00 04 41 4D 54 44 00 1B 54 44 20 41 4D 45 52 49 54 52 41 44 45 20 48 4C
44 47 20 43 4F 52 50 20 43 4F 4D 00 00 00 02 00 08 32 30 31 30 30 35 32 32
00 01 52 40 31 80 00 00 00 00 00 01 00 43 00 11 54 51 41 5F 32 30 31 30 30
35 32 32 43 31 37 2E 35 00 19 54 51 41 20 4D 61 79 20 32 32 20 32 30 31 30
20 31 37 2E 35 20 43 61 6C 6C 00 08 32 30 31 30 30 35 32 32 00 01 52 40 31
80 00 00 00 00 00 01 00 50 00 11 54 51 41 5F 32 30 31 30 30 35 32 32 50 31
37 2E 35 00 18 54 51 41 20 4D 61 79 20 32 32 20 32 30 31 30 20 31 37 2E 35
20 50 75 74
NOTE: November 22, 2007 is a holiday, which is why only 2 days are returned for the above request
Request URL
https://apis.tdameritrade.com/apps/200/BinaryOptionChain?source=<#sourceID#
>&symbol=AMTD&expire=201005&strike=17.5"es=true
Response:
Sample not currently available
Possible Errors
If the symbol is not valid you will get
Response:
01 00 0E 49 6E 76 61 6C 69 64 20 53 79 6D 62 6F 6C
NOTE: November 22, 2007 is a holiday, which is why only 2 days are returned for the above request
NOTE: Invalid Session response will show up as an Internal Server Error with error code 500
in the HTTP Headers
Request URL
https://apis.tdameritrade.com/apps/100/BalancesAndPositions?source=<#sourceID#>
Parameters
The only parameter required is the source assigned by TD Ameritrade. You can also specify
the account id for which the data is to be returned and the type of data to be returned - only
balances, or only positions. Both are returned if not specified. If account is not specified,
then the data for the default "associated" account will be returned.
<change></change>
</long-stock-value>
<long-option-value>
<initial></initial>
<current></current>
<change></change>
</long-option-value>
.......
<in-call></in-call>
<in-potential-call></in-potential-call>
</balance>
<positions>
<error></error>
<account-id></account-id>
<stocks>
<position>
<error></error>
<quantity></quantity>
<security>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description> </description>
<asset-type></asset-type>
<cusip></cusip>
</security>
<account-type></account-type>
<close-price></close-price>
<position-type></position-type>
<average-price></average-price>
<current-value></current-value>
<underlying-symbol></underlying-symbol>
<put-call-indicator></put-call-indicator>
</position>
.........
</stocks>
<options>
.........
</options>
<funds>
.........
</funds>
<bonds>
.........
</bonds>
<money-market>
.........
</money-market>
<savings>
.........
</savings>
</positions>
</amtd>
Response Fields
The Positions response fields are the same for all asset types. The Balances however differ
depending on whether or not the account is enabled for Margin and for Options trading. The
fields are documented at:
Balances for CASH Account
Balances for MARGIN Account
Positions
<cash-balance>
<initial>45678.00</initial>
<current>45792.45</current>
<change>114.45</change>
</cash-balance>
For simplicity, the individual tags for initial, current and change will not be documented. The
table below will just list the container tag as Complex/ICC type and for CALL types,
Complex/IC (Initial, Current)
balance Complex Container for all balance information for the account
error String Contains error message, if any, related to retrieving the
balances
account-id String
day-trader String/Bo true/false
olean
round-trips Integer
resticted-closing-trans String/Bo true/false
actions-only olean
cash-balance Complex/ The amount of liquid funds in the account, including the
ICC monetary value of trades that may not have settled,
excluding any money market funds. There are two digits
to the right of the decimal point.
money-market-balanc Complex/
e ICC
long-stock-value Complex/ The total value of individual long stock positions based on
ICC the last price for those securities.
short-stock-value Complex/ The total value of individual short stock positions based
ICC on the last price for those securities.
long-option-value Complex/ The total value of individual long options positions based
ICC on the last price for those securities.
short-option-value Complex/
ICC
mutual-fund-value Complex/ The total current value of any mutual funds in the
ICC account. There may be up to six digits to the right of the
decimal point.
bond-value Complex/ The total current value of any bonds in the account.
ICC
account-value Complex/
ICC
pending-deposits Complex/
ICC
cash-for-withdrawal Double
unsettled-cash Double
savings-balance Complex/ Savings Balance - CURRENT sub-tag only
C
cash-debit-call-value Complex/
IC
available-funds-for-tra Double
ding
non-marginable-funds Double
in-call String/Bo true/false - Indicates if the account has any calls on it
olean (CURRENT)
in-potential-call String/Bo true/false - Indicates if the account has any Potential calls
olean on it (POTENTIAL)
<cash-balance>
<initial>45678.00</initial>
<current>45792.45</current>
<change>114.45</change>
</cash-balance>
For simplicity, the individual tags for initial, current and change will not be documented. The
table below will just list the container tag as Complex/ICC type and for CALL types,
Complex/ICP (Initial, Current, Potential) or Complex/IP (Initial, Potential)
balance Complex Container for all balance information for the account
error String Contains error message, if any, related to retrieving the
balances
account-id String
day-trader String/Bo true/false
olean
round-trips Integer
resticted-closing-trans String/Bo true/false
actions-only olean
cash-balance Complex/ The amount of liquid funds in the account, including the
ICC monetary value of trades that may not have settled,
excluding any money market funds. There are two digits
to the right of the decimal point.
money-market-balanc Complex/
e ICC
long-stock-value Complex/ The total value of individual long stock positions based on
ICC the last price for those securities.
long-option-value Complex/ The total value of individual long options positions based
ICC on the last price for those securities.
short-stock-value Complex/ The total value of individual short stock positions based
ICC on the last price for those securities.
short-option-value Complex/
ICC
mutual-fund-value Complex/ The total current value of any mutual funds in the
ICC account. There may be up to six digits to the right of the
decimal point.
bond-value Complex/ The total current value of any bonds in the account.
ICC
account-value Complex/
ICC
pending-deposits Complex/
ICC
savings-balance Complex/ Savings Balance - CURRENT sub-tag only
C
margin-balance Complex/ A negative number that represents a debit balance or the
ICC amount that is on loan. The debit balance is subject to
margin interest charges.
short-balance Complex/
ICC
long-marginable-value Complex/ The total value of the long marginable positions
ICC
option-buying-power Double
day-trading-buying-po Double
wer
available-funds-for-tra Double
ding
maintenance-requirem Complex/ The minimum amount of equity needed to hold the
ent ICC marginal positions in the account
maintenance-call-valu Complex/ Amount of equity needed to bring Margin Equity equal to
e ICP Maintenance Requirement
regulation-t-call-valueComplex/
ICP
day-trading-call-value Complex/
IP
day-equity-call-value Double
in-call String/Bo true/false - Indicates if the account has any calls on it
olean (CURRENT)
in-potential-call String/Bo true/false - Indicates if the account has any Potential calls
olean on it (POTENTIAL)
NOTE: You can have multiple position entries for the same symbol (one long and one
short for example). You will need to handle that accordingly.
put-call String
P or C - For Option symbols, indicates if its a PUT or a CALL.
Otherwise null
maintenance-requi Double The minimum amount of equity needed to hold the marginal
rement positions in the account
quote Comple Container for the quote fields for the symbol. Only returned if
x suppressquotes=false is requested or if suppressquotes is
not specified
NOTE:The Quote response will be the same as what you would get from the Quote
request for the same security, in the QUOTE container
Request:
https://apis.tdameritrade.com/apps/100/BalancesAndPositions?source=<#sourceID#>
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<balance>
<error></error>
<account-id>123456789</account-id>
<day-trader>true</day-trader>
<round-trips>20</round-trips>
<resticted-closing-transactions-only>false</resticted-closing-transactions-only>
<cash-balance>
<initial>970.08</initial>
<current>46329.83</current>
<change>45359.75</change>
</cash-balance>
<money-market-balance>
<initial>0</initial>
<current>0</current>
<change>0</change>
</money-market-balance>
<long-stock-value>
<initial>45129</initial>
<current>0</current>
<change>-45129</change>
</long-stock-value>
<long-option-value>
<initial>0</initial>
<current>0</current>
<change>0</change>
</long-option-value>
<short-option-value>
<initial>0</initial>
<current>0</current>
<change>0</change>
</short-option-value>
<mutual-fund-value>
<initial>0</initial>
<current>0</current>
<change>0</change>
</mutual-fund-value>
<bond-value>
<initial>0</initial>
<current>0</current>
<change>0</change>
</bond-value>
<account-value>
<initial>46142.25</initial>
<current>46373</current>
<change>230.75</change>
</account-value>
<pending-deposits>
<initial>0</initial>
<current>0</current>
<change>0</change>
</pending-deposits>
<in-call>false</in-call>
<in-potential-call>false</in-potential-call>
<short-balance>
<initial>43.17</initial>
<current>43.17</current>
<change>0</change>
</short-balance>
<margin-balance>
<initial>0</initial>
<current>0</current>
<change>0</change>
</margin-balance>
<short-stock-value>
<initial>0</initial>
<current>0</current>
<change>0</change>
</short-stock-value>
<long-marginable-value>
<initial>45129</initial>
<current>0</current>
<change>-45129</change>
</long-marginable-value>
<short-marginable-value>
<initial>0</initial>
<current>0</current>
<change>0</change>
</short-marginable-value>
<margin-equity>
<initial>46329.83</initial>
<current>46373</current>
<change>230.75</change>
</margin-equity>
<equity-percentage>
<initial>100.00</initial>
<current>100.00</current>
<change>0.00</change>
</equity-percentage>
<option-buying-power>46373</option-buying-power>
<stock-buying-power>132456.44</stock-buying-power>
<day-trading-buying-power>139440</day-trading-buying-power>
<available-funds-for-trading>46373</available-funds-for-trading>
<maintenance-requirement>
<initial>13538.7</initial>
<current>0</current>
<change>-13538.7</change>
</maintenance-requirement>
<maintenance-call-value>
<initial>0</initial>
<current>0</current>
<potential>0</potential>
</maintenance-call-value>
<regulation-t-call-value>
<initial>0</initial>
<current>0</current>
<potential>0</potential>
</regulation-t-call-value>
<day-trading-call-value>
<potential>0</potential>
<initial>0</initial>
</day-trading-call-value>
<day-equity-call-value>0</day-equity-call-value>
</balance>
<positions>
<error></error>
<account-id>123456789</account-id>
<stocks>
<position>
<error></error>
<quantity>100.0</quantity>
<security>
<symbol>CLN</symbol>
<symbol-with-type-prefix>CLN</symbol-with-type-prefix>
<description>CELSION CORPORATION COM</description>
<asset-type>E</asset-type>
<cusip>15117N305</cusip>
</security>
<account-type>2</account-type>
<close-price>6.36</close-price>
<position-type>LONG</position-type>
<average-price>0.00</average-price>
<current-value>629.88</current-value>
</position>
<position>
<error></error>
<quantity>200.0</quantity>
<security>
<symbol>MSFT</symbol>
<symbol-with-type-prefix>MSFT</symbol-with-type-prefix>
<description>MICROSOFT CORP COM</description>
<asset-type>E</asset-type>
<cusip>594918104</cusip>
</security>
<account-type>2</account-type>
<close-price>30.02</close-price>
<position-type>LONG</position-type>
<average-price>0.00</average-price>
<current-value>6022.00</current-value>
</position>
<position>
<error></error>
<quantity>100.0</quantity>
<security>
<symbol>OKE</symbol>
<symbol-with-type-prefix>OKE</symbol-with-type-prefix>
<description>ONEOK INC CM (NEW)</description>
<asset-type>E</asset-type>
<cusip>682680103</cusip>
</security>
<account-type>2</account-type>
<close-price>50.07</close-price>
<position-type>LONG</position-type>
<average-price>0.00</average-price>
<current-value>4990.00</current-value>
</position>
</stocks>
<options>
<position>
<error></error>
<quantity>5.0</quantity>
<security>
<symbol>FMD_20070930C8.70</symbol>
<symbol-with-type-prefix>FMD_032010C8.70</
symbol-with-type-prefix>
<description>FMD Feb 20 2007 8.70 Call</description>
<asset-type>O</asset-type>
<cusip>999FMDIF6</cusip>
</security>
<account-type>2</account-type>
<close-price>8.70</close-price>
<position-type>LONG</position-type>
<average-price>8.80</average-price>
<current-value>4150.00</current-value>
</position>
</options>
<funds>
<position>
<error></error>
<quantity>616.196</quantity>
<security>
<symbol>DODIX</symbol>
<symbol-with-type-prefix>DODIX</symbol-with-type-prefix>
<description>DODGE & COX INCOME FD COM</description>
<asset-type>F</asset-type>
<cusip>256210105</cusip>
</security>
<account-type>2</account-type>
<close-price>12.52</close-price>
<position-type>LONG</position-type>
<average-price>0.00</average-price>
<current-value>7714.77</current-value>
</position>
<position>
<error></error>
<quantity>1693.48</quantity>
<security>
<symbol>VIPSX</symbol>
<symbol-with-type-prefix>VIPSX</symbol-with-type-prefix>
<description>VANGUARD FIXED INCOME SECS FD INFLATION
PROTECTED SEC FD</description>
<asset-type>F</asset-type>
<cusip>922031869</cusip>
</security>
<account-type>2</account-type>
<close-price>11.77</close-price>
<position-type>LONG</position-type>
<average-price>0.00</average-price>
<current-value>19932.25</current-value>
</position>
<position>
<error></error>
<quantity>700.405</quantity>
<security>
<symbol>VUSTX</symbol>
<symbol-with-type-prefix>VUSTX</symbol-with-type-prefix>
<description>VANGUARD FIXED INCOME SECS FD LONG TERM
US TREASURY PORT</description>
<asset-type>F</asset-type>
<cusip>922031505</cusip>
</security>
<account-type>2</account-type>
<close-price>10.57</close-price>
<position-type>LONG</position-type>
<average-price>0.00</average-price>
<current-value>7403.28</current-value>
</position>
</funds>
<bonds>
<position>
<error></error>
<quantity>25.0</quantity>
<security>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description>WASHINGTON CNTY PA MUN FAC LEASE REV BDS
</description>
<asset-type>B</asset-type>
<cusip>938589BP2</cusip>
</security>
<account-type>2</account-type>
<close-price>132.173996</close-price>
<position-type>LONG</position-type>
<average-price>0.00</average-price>
<current-value>33043.50</current-value>
</position>
</bonds>
</positions>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
17 OrderStatus
This service provides detailed order status for an account, allowing filtering of orders by
status, entry date, order id, and other criteria. OrderStatus is a synchronous request. If you
need an update, you need to issue the request again.
NOTE: You would want to use this in conjunction with the streaming asyncronous Account
Activity request.
Request URL
https://apis.tdameritrade.com/apps/100/OrderStatus?source=<#sourceID#>
Parameters
The only parameter required is the source assigned by TD Ameritrade. You can also specify
the account id for which the data is to be returned as well as various other parameters to
filter the results.
orderid This will return the order or orders that NO any legitimate order ID for the
match the passed orderids. Multiple account being queried. If the
orderids can be passed. E.g. order is part of a conditional
orderid=1234&orderid=5678&orderid=999 order or complex option order,
9 the parent order will be
returned along with all child
NOTE: The orderid overrides the type, orders, including the one being
days, fromdate, and todate parameters. requested.
The days value is set to the maximum
days back. However, in the case where
time is paired with orderid, the days value
is set to 0
type returns all orders that match the status NO DEFAULT: all
type. If no date parameters are specified, all open
the orders are filtered from all orders with filled canceled pending
activity in the current day and all open
orders.
fromdate This will return all orders that were NO The date format is
/ received in the date range specified YYYYMMDD. Maximum 60
todate days back. Dates are Inclusive
days This returns all orders that were received NO DEFAULT: 0
beginning with the number of days back Integer 0 to 60
to the current day. If zero, and type
includes open orders, then all open orders
will be returned as well, regardless of
date. Refers to calander days, NOT
market days
<orderstatus>
<order-number></order-number>
<cancelable></cancelable>
<editable></editable>
<complex-option></complex-option>
<enhanced-order></enhanced-order>
<display-status></display-status>
<order-routing-status></order-routing-status>
<order-received-date-time></order-received-date-time>
<remaining-quantity></remaining-quantity>
<trailing-activation-price></trailing-activation-price>
<underlying-symbol></underlying-symbol>
<order>
<security>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description></description>
<asset-type></asset-type>
</security>
<quantity></quantity>
<order-id></order-id>
<action></action>
<trade-type></trade-type>
<requested-destination>
<routing-mode></routing-mode>
<option-exchange></option-exchange>
<response-description></response-description>
</requested-destination>
<actual-destination>
<routing-mode></routing-mode>
<option-exchange></option-exchange>
<response-description></response-description>
</actual-destination>
<routing-display-size></routing-display-size>
<order-type></order-type>
<limit-price></limit-price>
<stop-price></stop-price>
<trailing-stop-method></trailing-stop-method
<special-conditions></special-conditions>
<time-in-force>
<session></session>
</time-in-force>
</order>
</orderstatus>
</orderstatus-list>
</amtd>
Response Fields
The OrderStatus response fields have nested orders in them for complex option and
conditional orders. The table below will indicate fields that are specific to complex options or
conditional orders
NOTE:
"Pending" means the order is waiting to be manually
reviewed
"Review/Release" means the order is being manually
reviewed. Once reviewed it will either switch to Open or
Canceled
order-routing-statu String
s
order-received-dat String
e-time
reported-time String
strategy String The type of complex option that the order is part of. Possible
values are:
Spread
Straddle
Buy Write
Exercise
Combo
Exercise
Swap
Vertical
Back Ratio
Calendar
Diagonal
Butterfly
Condor
Iron Condor
Vertical Roll
Covered Stock
Collar With Stock
Collar Synthetic
Double Diagonal
Custom
(This field is only returned on complex option orders)
open-close String (This field is only returned on option orders)
O or C
put-call String P or C - For Option symbols, indicates if its a PUT or a CALL.
Otherwise null
(This field is only returned on option orders)
fills Complex Container for information about Fills that occurred on this
order. There will be one fills container for each fill for the given
order, so if there were 5 partial fills, there will be 5 fills
containers.
(This field is only returned on orders that have fills)
fill-id String (This field is only returned on orders that have fills)
fill-quantity Double (This field is only returned on orders that have fills)
fill-price Double (This field is only returned on orders that have fills)
execution-reported String Example of the Date/Time format is:
-date-time 2007-03-23 15:09:59 EDT
NOTE: Timezone may be EDT or EST for now
(This field is only returned on orders that have fills)
related-orders Complex Container for OrderStatus objects of related orders.
(This field is only returned on complex options orders and
conditional orders)
relationship-type String (This field is only returned on conditional orders)
Request:
https://apis.tdameritrade.com/apps/100/OrderStatus?source=<#sourceID#>
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<orderstatus-list>
<account-id>123456789</account-id>
<orderstatus>
<order-number>2967109823</order-number>
<cancelable>true</cancelable>
<editable>true</editable>
<complex-option>false</complex-option>
<enhanced-order>false</enhanced-order>
<display-status>Open</display-status>
<order-routing-status>Ready</order-routing-status>
<order-received-date-time>2007-06-13 20:18:03 EDT</
order-received-date-time>
<remaining-quantity>100.0</remaining-quantity>
<order>
<security>
<symbol>YHOO</symbol>
<symbol-with-type-prefix>YHOO</symbol-with-type-prefix>
<description></description>
<asset-type>E</asset-type>
</security>
<quantity>100</quantity>
<order-id>2967109823</order-id>
<action>B</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<actual-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</actual-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</order-type>
<limit-price>2.56</limit-price>
<stop-price>0.00</stop-price>
<special-conditions></special-conditions>
<time-in-force>
<session>D</session>
</time-in-force>
</order>
</orderstatus>
<orderstatus>
<order-number>2147591543</order-number>
<cancelable>false</cancelable>
<editable>false</editable>
<complex-option>false</complex-option>
<enhanced-order>false</enhanced-order>
<display-status>Pending Cancel</display-status>
<order-routing-status>Routed</order-routing-status>
<order-received-date-time>2007-05-24 13:42:43 EDT</
order-received-date-time>
<reported-time>2007-05-24 13:42:43 EDT</reported-time>
<cancel-date-time>2007-06-05 20:44:21 EDT</cancel-date-time>
<remaining-quantity>2.0</remaining-quantity>
<order>
<security>
<symbol>IBM</symbol>
<symbol-with-type-prefix>IBM</symbol-with-type-prefix>
<description></description>
<asset-type>E</asset-type>
</security>
<quantity>2</quantity>
<order-id>2147591543</order-id>
<action>B</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<actual-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</actual-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</order-type>
<limit-price>3.00</limit-price>
<stop-price>0.00</stop-price>
<special-conditions></special-conditions>
<time-in-force>
<session>GTD</session>
<expiration>2007-08-24</expiration>
</time-in-force>
</order>
</orderstatus>
<orderstatus>
<order-number>2147591539</order-number>
<cancelable>false</cancelable>
<editable>false</editable>
<complex-option>false</complex-option>
<enhanced-order>false</enhanced-order>
<display-status>Pending Replace</display-status>
<order-routing-status>Routed</order-routing-status>
<order-received-date-time>2007-05-24 13:42:34 EDT</
order-received-date-time>
<reported-time>2007-05-24 13:42:34 EDT</reported-time>
<cancel-date-time>2007-05-24 13:42:43 EDT</cancel-date-time>
<remaining-quantity>2.0</remaining-quantity>
<order>
<security>
<symbol>IBM</symbol>
<symbol-with-type-prefix>IBM</symbol-with-type-prefix>
<description></description>
<asset-type>E</asset-type>
</security>
<quantity>2</quantity>
<order-id>2147591539</order-id>
<action>B</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<actual-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</actual-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</order-type>
<limit-price>2.00</limit-price>
<stop-price>0.00</stop-price>
<special-conditions></special-conditions>
<time-in-force>
<session>GTD</session>
<expiration>2007-08-24</expiration>
</time-in-force>
</order>
</orderstatus>
<orderstatus>
<order-number>2147594455</order-number>
<cancelable>false</cancelable>
<editable>false</editable>
<complex-option>false</complex-option>
<enhanced-order>true</enhanced-order>
<enhanced-type>OTT</enhanced-type>
<display-status>Filled</display-status>
<order-routing-status>Routed</order-routing-status>
<order-received-date-time>2007-06-05 14:19:19 EDT</
order-received-date-time>
<reported-time>2007-06-05 14:19:22 EDT</reported-time>
<remaining-quantity>0.0</remaining-quantity>
<order>
<security>
<symbol>AMTD</symbol>
<symbol-with-type-prefix>AMTD</symbol-with-type-prefix>
<description></description>
<asset-type>E</asset-type>
</security>
<quantity>1500</quantity>
<order-id>2147594455</order-id>
<action>B</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<actual-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</actual-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</order-type>
<limit-price>11.00</limit-price>
<stop-price>0.00</stop-price>
<special-conditions></special-conditions>
<time-in-force>
<session>GTD</session>
<expiration>2007-07-31</expiration>
</time-in-force>
</order>
<fills>
<fill-id>214758730</fill-id>
<fill-quantity>600.0</fill-quantity>
<fill-price>11.00</fill-price>
<execution-reported-date-time>2007-06-05 14:19:22 EDT</
execution-reported-date-time>
</fills>
<fills>
<fill-id>2147594461</fill-id>
<fill-quantity>900.0</fill-quantity>
<fill-price>11.00</fill-price>
<execution-reported-date-time>2007-06-05 14:19:23 EDT</
execution-reported-date-time>
</fills><related-orders>
<orderstatus>
<order-number>2147594456</order-number>
<cancelable>false</cancelable>
<editable>false</editable>
<complex-option>false</complex-option>
<enhanced-order>true</enhanced-order>
<enhanced-type>OTT</enhanced-type>
<display-status>Canceled</display-status>
<order-routing-status>Received</order-routing-status>
<order-received-date-time>2007-06-05 14:22:03 EDT</
order-received-date-time>
<remaining-quantity>200.0</remaining-quantity>
<order>
<security>
<symbol>SCHW</symbol>
<symbol-with-type-prefix>SCHW</symbol-with-type-prefix
>
<description></description>
<asset-type>E</asset-type>
</security>
<quantity>1500</quantity>
<order-id>2147594456</order-id>
<action>S</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<actual-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</actual-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</order-type>
<limit-price>24.00</limit-price>
<stop-price>0.00</stop-price>
<special-conditions> </special-conditions>
<time-in-force>
<session>GTD</session>
<expiration>2007-07-31</expiration>
</time-in-force>
</order>
<relationship-type>Triggers</relationship-type>
</orderstatus>
<orderstatus>
<order-number>2147594457</order-number>
<cancelable>false</cancelable>
<editable>false</editable>
<complex-option>false</complex-option>
<enhanced-order>true</enhanced-order>
<enhanced-type>OTT</enhanced-type>
<display-status>Canceled</display-status>
<order-routing-status>Received</order-routing-status>
<order-received-date-time>2007-06-05 14:22:03 EDT</
order-received-date-time>
<remaining-quantity>1500.0</remaining-quantity>
<order>
<security>
<symbol>ETFC</symbol>
<symbol-with-type-prefix>ETFC</symbol-with-type-prefix>
<description></description>
<asset-type>E</asset-type>
</security>
<quantity>200</quantity>
<order-id>2147594457</order-id>
<action>S</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<actual-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</actual-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</order-type>
<limit-price>25.00</limit-price>
<stop-price>0.00</stop-price>
<special-conditions> </special-conditions>
<time-in-force>
<session>GTD</session>
<expiration>2007-07-31</expiration>
</time-in-force>
</order>
<relationship-type>Triggers</relationship-type>
</orderstatus>
</related-orders>
</orderstatus>
</orderstatus-list>
</amtd>
<trailing-activation-price>0</trailing-activation-price>
<order>
<symbol>YHOO</symbol>
<security>
<symbol>YHOO</symbol>
<symbol-with-type-prefix>YHOO</symbol-with-type-prefix>
<description> </description>
<asset-type>E</asset-type>
</security>
<quantity>100</quantity>
<order-id>4196528959</order-id>
<action>B</action>
<trade-type>2</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<actual-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</actual-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</order-type>
<limit-price>1.00</limit-price>
<stop-price> </stop-price>
<special-conditions> </special-conditions>
<time-in-force>
<session>XPM</session>
<expiration>2009-07-27</expiration>
</time-in-force>
</order>
</orderstatus>
</orderstatus-list>
</amtd>
<editable>false</editable>
<complex-option>false</complex-option>
<enhanced-order>true</enhanced-order>
<enhanced-type>OTT</enhanced-type>
<display-status>Filled</display-status>
<order-routing-status>Routed</order-routing-status>
<order-received-date-time>2007-06-05 14:19:19 EDT</
order-received-date-time>
<reported-time>2007-06-05 14:19:22 EDT</reported-time>
<remaining-quantity>0.0</remaining-quantity>
<order>
<symbol>AMTD</symbol>
<security>
<symbol>AMTD</symbol>
<symbol-with-type-prefix>AMTD</symbol-with-type-prefix>
<description></description>
<asset-type>E</asset-type>
</security>
<quantity>700</quantity>
<order-id>2147594455</order-id>
<action>B</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<actual-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</actual-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</order-type>
<limit-price>11.00</limit-price>
<stop-price>0.00</stop-price>
<special-conditions></special-conditions>
<time-in-force>
<session>GTD</session>
<expiration>2007-07-31</expiration>
</time-in-force>
</order>
<fills>
<fill-id>2147594461</fill-id>
<fill-quantity>400.0</fill-quantity>
<fill-price>10.99</fill-price>
<execution-reported-date-time>2007-06-05 14:19:21 EDT</
execution-reported-date-time>
</fills>
<fills>
<fill-id>2147594482</fill-id>
<fill-quantity>100.0</fill-quantity>
<fill-price>11.00</fill-price>
<expiration>2007-07-31</expiration>
</time-in-force>
</order>
<relationship-type>Triggers</relationship-type>
</orderstatus>
<orderstatus>
<order-number>2147594457</order-number>
<cancelable>false</cancelable>
<editable>false</editable>
<complex-option>false</complex-option>
<enhanced-order>true</enhanced-order>
<enhanced-type>OTT</enhanced-type>
<display-status>Canceled</display-status>
<order-routing-status>Received</order-routing-status>
<order-received-date-time>2007-06-05 14:22:03 EDT</
order-received-date-time>
<remaining-quantity>200.0</remaining-quantity>
<order>
<symbol>ETFC</symbol>
<security>
<symbol>ETFC</symbol>
<symbol-with-type-prefix>ETFC</symbol-with-type-prefix>
<description></description>
<asset-type>E</asset-type>
</security>
<quantity>200</quantity>
<order-id>2147594457</order-id>
<action>S</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<actual-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</actual-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</order-type>
<limit-price>25.00</limit-price>
<stop-price>0.00</stop-price>
<special-conditions></special-conditions>
<time-in-force>
<session>GTD</session>
<expiration>2007-07-31</expiration>
</time-in-force>
</order>
<relationship-type>Triggers</relationship-type>
</orderstatus>
</related-orders>
</orderstatus>
</orderstatus-list>
</amtd>
Note the nested orders under the related-orders tag, as well as the complex-option
and oe-strategy tags.
<special-conditions></special-conditions>
<time-in-force>
<session>D</session>
<expiration>2009-07-23</expiration>
</time-in-force>
<put-call>P</put-call>
<open-close>O</open-close>
</order>
<related-orders>
<orderstatus>
<order-number>4196528731</order-number>
<cancelable>false</cancelable>
<editable>false</editable>
<complex-option>true</complex-option>
<enhanced-order>false</enhanced-order>
<display-status>Open</display-status>
<order-routing-status>Routed</order-routing-status>
<order-received-date-time>2009-07-22 14:19:38 EDT</
order-received-date-time>
<remaining-quantity>1.0</remaining-quantity>
<trailing-activation-price>0</trailing-activation-price>
<strategy>Iron Condor</strategy>
<order>
<symbol>IBM_082210P110</symbol>
<security>
<symbol>IBM_082210P110</symbol>
<symbol-with-type-prefix>IBM_082210P110</symbol-with-type-prefix
>
<description>IBM Aug 22 2010 110.0 Put</description>
<asset-type>O</asset-type>
</security>
<quantity>1</quantity>
<order-id>4196528731</order-id>
<action>S</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<actual-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</actual-destination>
<routing-display-size>0</routing-display-size>
<order-type>M</order-type>
<limit-price></limit-price>
<stop-price></stop-price>
<special-conditions></special-conditions>
<time-in-force>
<session>D</session>
<expiration>2009-07-23</expiration>
</time-in-force>
<put-call>P</put-call>
<open-close>O</open-close>
</order>
</orderstatus>
<orderstatus>
<order-number>4196528730</order-number>
<cancelable>false</cancelable>
<editable>false</editable>
<complex-option>true</complex-option>
<enhanced-order>false</enhanced-order>
<display-status>Open</display-status>
<order-routing-status>Routed</order-routing-status>
<order-received-date-time>2009-07-22 14:19:38 EDT</
order-received-date-time>
<remaining-quantity>1.0</remaining-quantity>
<trailing-activation-price>0</trailing-activation-price>
<strategy>Iron Condor</strategy>
<order>
<symbol>IBM_082210C110</symbol>
<security>
<symbol>IBM_082210C110</symbol>
<symbol-with-type-prefix>IBM_082210C110</
symbol-with-type-prefix>
<description>IBM Aug 22 2010 110.0 Call</description>
<asset-type>O</asset-type>
</security>
<quantity>1</quantity>
<order-id>4196528730</order-id>
<action>S</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<actual-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</actual-destination>
<routing-display-size>0</routing-display-size>
<order-type>M</order-type>
<limit-price></limit-price>
<stop-price></stop-price>
<special-conditions> </special-conditions>
<time-in-force>
<session>D</session>
<expiration>2009-07-23</expiration>
</time-in-force>
<put-call>C</put-call>
<open-close>O</open-close>
</order>
</orderstatus>
<orderstatus>
<order-number>4196528729</order-number>
<cancelable>false</cancelable>
<editable>false</editable>
<complex-option>true</complex-option>
<enhanced-order>false</enhanced-order>
<display-status>Open</display-status>
<order-routing-status>Routed</order-routing-status>
<order-received-date-time>2009-07-22 14:19:38 EDT</
order-received-date-time>
<remaining-quantity>1.0</remaining-quantity>
<trailing-activation-price>0</trailing-activation-price>
<strategy>Iron Condor</strategy>
<order>
<symbol>IBM_20100822C110</symbol>
<security>
<symbol>IBM_082210C110</symbol>
<symbol-with-type-prefix>IBM_082210C110</
symbol-with-type-prefix>
<description>IBM Aug 22 2010 110.0 Call</description>
<asset-type>O</asset-type>
</security>
<quantity>1</quantity>
<order-id>4196528729</order-id>
<action>B</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<actual-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</actual-destination>
<routing-display-size>0</routing-display-size>
<order-type>M</order-type>
<limit-price></limit-price>
<stop-price></stop-price>
<special-conditions> </special-conditions>
<time-in-force>
<session>D</session>
<expiration>2009-07-23</expiration>
</time-in-force>
<put-call>C</put-call>
<open-close>O</open-close>
</order>
</orderstatus>
</related-orders>
</orderstatus>
</orderstatus-list>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
18 LastOrderStatus
This call returns the date and time of the last order status activity for the primary account
associated with the login userID, or the explicitly specified account.
Request URL
https://apis.tdameritrade.com/apps/100/LastOrderStatus?source=#sourceID#&accountid=123456
789
Parameters
No parameters are needed other then the source. AccountID is optional. If not specified,
then the result will be for the default associated account
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<last-order-status>
<account-id>123456789</account-id>
<last>2007-06-14 09:37:05 EDT</last>
</last-order-status>
</amtd>
or
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<last-order-status>
<account-id>123456789</account-id>
<last>No Orders</last>
</last-order-status>
</amtd>
19 History
This service provides detailed order status for an account, allowing filtering of orders by
status, entry date, order id, and other criteria.
Request URL
https://apis.tdameritrade.com/apps/100/History?source=<#sourceID#>&type=<#type#>
Parameters
The required parameters are the source assigned by TD Ameritrade and the type. You can
also specify the account id for which the data is to be returned as well as various other
parameters to filter the results.
<result></result>
<history>
<account-id></account-id>
<startDate></startDate>
<endDate></endDate>
<searchTransactionType></searchTransactionType>
<requestType></requestType>
<transaction-list>
<error></error>
<orderDateTime></orderDateTime>
<type></type>
<subType></subType>
<buySellCode></buySellCode>
<assetType></assetType>
<symbol></symbol>
<description></description>
<cusip></cusip>
<price></price>
<quantity></quantity>
<transactionId></transactionId>
<value></value>
<commission></commission>
<orderNumber></orderNumber>
<fees></fees>
<additionalFees></additionalFees>
<cashBalanceEffect></cashBalanceEffect>
<openClose></openClose>
<optionType></optionType>
<optionStrike></optionStrike>
<accruedInterest></accruedInterest>
<parentChildIndicator></parentChildIndicator>
<sharesBefore></sharesBefore>
<sharesAfter></sharesAfter>
<otherCharges></otherCharges>
<redemptionFee></redemptionFee>
<cdscFee></cdscFee>
<bondInterestRate></bondInterestRate>
</transaction-list>
</history>
</amtd>
Request:
https://apis.tdameritrade.com/apps/100/History?source=<#sourceID#>&type=1
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<history>
<account-id>123456789</account-id>
<startDate>Jan 01 2008</startDate>
<endDate>Apr 08 2008</endDate>
<searchTransactionType>1</searchTransactionType>
<requestType>T</requestType>
<transaction-list>
<error></error>
<orderDateTime>2008-03-26 15:04:14 EDT</orderDateTime>
<type>TR</type>
<subType>BY</subType>
<buySellCode>B</buySellCode>
<assetType>S</assetType>
<symbol>SSO</symbol>
<description>BUY TRADE</description>
<cusip>74347R107</cusip>
<price>68.70</price>
<quantity>800</quantity>
<transactionId>3759123456</transactionId>
<value>-54,965.00</value>
<commission>5.00</commission>
<orderNumber>3741234567</orderNumber>
<fees></fees>
<additionalFees></additionalFees>
<cashBalanceEffect>Y</cashBalanceEffect>
<openClose></openClose>
<optionType></optionType>
<optionStrike></optionStrike>
<accruedInterest></accruedInterest>
<parentChildIndicator></parentChildIndicator>
<sharesBefore></sharesBefore>
<sharesAfter></sharesAfter>
<otherCharges>0.00</otherCharges>
<redemptionFee></redemptionFee>
<cdscFee></cdscFee>
<bondInterestRate></bondInterestRate>
</transaction-list>
<transaction-list>
<error></error>
<orderDateTime>2008-03-25 15:36:33 EDT</orderDateTime>
<type>TR</type>
<subType>SL</subType>
<buySellCode>S</buySellCode>
<assetType>S</assetType>
<symbol>SDS</symbol>
<description>SELL TRADE</description>
<cusip>74347R883</cusip>
<price>61.1301</price>
<quantity>800</quantity>
<transactionId>3756123456</transactionId>
<value>48,898.54</value>
<commission>5.00</commission>
<orderNumber>3738123456</orderNumber>
<fees>0.54</fees>
<additionalFees></additionalFees>
<cashBalanceEffect>Y</cashBalanceEffect>
<openClose></openClose>
<optionType></optionType>
<optionStrike></optionStrike>
<accruedInterest></accruedInterest>
<parentChildIndicator></parentChildIndicator>
<sharesBefore></sharesBefore>
<sharesAfter></sharesAfter>
<otherCharges>0.00</otherCharges>
<redemptionFee></redemptionFee>
<cdscFee></cdscFee>
<bondInterestRate></bondInterestRate>
</transaction-list>
</history>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
20 QuoteDelayed
This service provides clients the ability to retrieve delayed quotes; used by the wireless site
to provide quotes to clients that are not logged in.
Request URL
https://apis.tdameritrade.com/apps/100/QuoteDelayed?source=<#sourceID#>&symbol=<
#symbol#>
For information on QuoteDelayed parameters, response, samples and errors, refer Snapshot (XML)
Quotes
21 MarketOverview
This service provides clients a snapshot of the five indices.
Request URL
https://apis.tdameritrade.com/apps/100/MarketOverview?source=AMTDTest&format=compact&su
bmit=Submit
Request Parameters
No parameters required.
No parameters required.
</markets>
</market-snapshot>
</amtd>
Request:
https://apis.tdameritrade.com/apps/100/MarketOverview?source=AMTDTest&format=compact&su
bmit=Submit
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<market-snapshot>
<quote-timestamp>2009-07-20 13:35:25 CDT</quote-timestamp>
<markets>
<index>
<error/>
<symbol>$COMPX</symbol>
<description>NASDAQ COMPOSITE</description>
<open>1896.99</open>
<high>1906.24</high>
<low>1890.00</low>
<last>1898.64</last>
<last-trade-date>2009-07-20 14:35:24 EDT</last-trade-date>
<close>1886.61</close>
<year-high>2485.00</year-high>
<year-low>1265.52</year-low>
<real-time>true</real-time>
<asset-type>I</asset-type>
<change>12.03</change>
<change-percent>0.64%</change-percent>
<volume>1336260384</volume>
</index>
<index>
<error />
<symbol>$DJI</symbol>
<description>DOW JONES INDUSTRIAL AVERAGE</description>
<open>8746.05</open>
<high>8827.07</high>
<low>8745.90</low>
<last>8809.46</last>
<last-trade-date>2009-07-20 14:35:23 EDT</last-trade-date>
<close>8743.94</close>
<year-high>12369.23</year-high>
<year-low>6469.95</year-low>
<real-time>true</real-time>
<asset-type>I</asset-type>
<change>65.52</change>
<change-percent>0.75%</change-percent>
<volume>129705882</volume>
</index>
<index>
<error />
<symbol>$NYA.X</symbol>
<description>NYSE COMPOSITE INDEX NEW</description>
<open>6038.11</open>
<high>6128.91</high>
<low>6038.11</low>
<last>6117.68</last>
<last-trade-date>2009-07-20 14:35:23 EDT</last-trade-date>
<close>6038.11</close>
<year-high>9408.30</year-high>
<year-low>4181.75</year-low>
<real-time>true</real-time>
<asset-type>I</asset-type>
<change>79.57</change>
<change-percent>1.32%</change-percent>
<volume>0</volume>
</index>
<index>
<error />
<symbol>$SPX.X</symbol>
<description>S&P 500 Index</description>
<open>942.07</open>
<high>948.90</high>
<low>940.99</low>
<last>946.70</last>
<last-trade-date>2009-07-20 14:35:23 EDT</last-trade-date>
<close>940.38</close>
<year-high>1370.63</year-high>
<year-low>666.79</year-low>
<real-time>true</real-time>
<asset-type>I</asset-type>
<change>6.32</change>
<change-percent>0.67%</change-percent>
<volume>0</volume>
</index>
<index>
<error />
<symbol>$XAX.X</symbol>
<description>AMEX COMPOSITE INDEX-XAX</description>
<open>1624.55</open>
<high>1638.02</high>
<low>1622.48</low>
<last>1636.18</last>
<last-trade-date>2009-07-20 14:35:19 EDT</last-trade-date>
<close>1624.55</close>
<year-high>2374.66</year-high>
<year-low>354.60</year-low>
<real-time>true</real-time>
<asset-type>I</asset-type>
<change>11.63</change>
<change-percent>0.72%</change-percent>
<volume>0</volume>
</index>
</markets>
</market-snapshot>
</amtd>
22 News
This service provides clients a list of the top news headlines. This command is provided "As
Is" from CBS MarketWatch with minimal documentation.
Request URL
https://apis.tdameritrade.com/apps/100/NewsManager?source=AMTDTest&type=A&format=comp
act&submit=Submit
Request Parameters
There is a “type” parameter associated with the news headline retrieval. Type = A or empty
means both the top ten and market headlines are returned. Type=M returns just the market
news, and type= T returns just the top ten news headlines.
Request:
https://apis.tdameritrade.com/apps/100/NewsManager?source=AMTDTest&type=A&format=comp
act&submit=Submit
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<LIST NEXTKEY="40016.68125-965868853">
<ITEM idDoc="965868853" idTrack="102" idTrackType="102">
<NEWSITEM>
<DOCTYPE ID="103">
<NAME>MarketWatch Databased News</NAME>
<PROVIDER>MarketWatch.com</PROVIDER>
</DOCTYPE>
<HEADLINE>U.S. stocks up on earnings, less so on revenue</HEADLINE>
<COLUMN>Market Snapshot</COLUMN>
<TARGETING PRIORITY="DAILY">
<CHANNEL NAME="News & Commentary" ID="1">
<SUBCHANNEL NAME="News & Commentary|Markets" ID="
1025" />
</CHANNEL>
</TARGETING>
<CODE-LIST NSURI="urn:marketwatch-com:Channel" CATEGORY="
Target">
<CODE>Markets</CODE>
</CODE-LIST>
<CODE-LIST NSURI="urn:marketwatch-com:Subchannel" CATEGORY="
Target">
<CODE>Markets|U.S. &Canada</CODE>
</CODE-LIST>
<PACKAGES> </PACKAGES>
<PLACEMENT-LIST>
<PLACEMENT>cbs</PLACEMENT>
</PLACEMENT-LIST>
<INDUSTRY-LIST> </INDUSTRY-LIST>
<ISSUE-LIST>
<ISSUE>Markets/Exchanges</ISSUE>
<ISSUE>Market News</ISSUE>
</ISSUE-LIST>
<FUNDTYPE-LIST> </FUNDTYPE-LIST>
<REGION-LIST> </REGION-LIST>
<PERSONALFINANCE-LIST> </PERSONALFINANCE-LIST>
<RELATED-LIST> </RELATED-LIST>
<ABSTRACT>
<PARAGRAPH TYPE="NORMAL">With quarterly financial results now
Possible Errors
If the CBS feed is down, user would get following error message:
"System Unavailable"
23 FullStoryNews
This service provides clients the full story of the headline they chose to view. This command
is provided "As Is" from CBS MarketWatch with minimal documentation.
Request URL
https://apis.tdameritrade.com/apps/100/FullStoryNews?source=AMTDTest&GUID={AB904891-9A
58-48E1-8B35-2C35EEA45913}&format=compact&submit=Submit
Request Parameters
The GUID is required to retrieve a specific story. The GUID is in the response from CBS
market Watch from the headline news.
FullStoryNews Parameters
The GUID is required to retrieve a specific story. The GUID is in the response from CBS
market Watch from the headline news.
The response to the FullStoryNews request will be in XML format, the response is passed
through as is from CBS MarketWatch.
Request:
https://apis.tdameritrade.com/apps/100/FullStoryNews?source=AMTDTest&GUID={AB904891-9A
58-48E1-8B35-2C35EEA45913}&format=compact&submit=Submit
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<LIST>
<ITEM idDoc="957828744" idTrack="103" idTrackType="103">
<NEWSITEM>
<DOCTYPE ID="103">
<NAME>MarketWatch Databased News</NAME>
<PROVIDER>MarketWatch.com</PROVIDER>
</DOCTYPE>
<HEADLINE>Investors warm to Geithner comments; banks stage
turnaround</HEADLINE>
<COLUMN>Financial Stocks</COLUMN>
<TARGETING PRIORITY="DAILY">
<CHANNEL NAME="News & Commentary" ID="1">
<SUBCHANNEL NAME="News & Commentary|Markets" ID="1025" />
</CHANNEL>
</TARGETING>
<PACKAGES> </PACKAGES>
<PLACEMENT-LIST>
<PLACEMENT>cbs</PLACEMENT>
</PLACEMENT-LIST>
<INDUSTRY-LIST>
<INDUSTRY>Banks</INDUSTRY>
<INDUSTRY>Financial Services</INDUSTRY>
</INDUSTRY-LIST>
<ISSUE-LIST>
<ISSUE>Markets/Exchanges</ISSUE>
<ISSUE>Market News</ISSUE>
</ISSUE-LIST>
<FUNDTYPE-LIST> </FUNDTYPE-LIST>
<REGION-LIST> </REGION-LIST>
<PERSONALFINANCE-LIST> </PERSONALFINANCE-LIST>
<RELATED-LIST> </RELATED-LIST>
<ABSTRACT>
<PARAGRAPH TYPE="NORMAL">The financial sector stages a dramatic
turnaround on soothing words from Treasury Secretary Timothy
Geithner, after banking stocks open lower with several key names
reporting disappointing quarterly results.
</PARAGRAPH>
</ABSTRACT>
<CREATED TIMESTAMP="39924.6902777778" ET-FORMAT="4:34 PM ET Apr
21, 2009" CTIME-FORMAT="1240353240">4/21/2009 4:34:00 PM
</CREATED>
<LASTUPDATED TIMESTAMP="39924.6902777778" ET-FORMAT="4:34 PM ET
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">Geithner, speaking before the
financial bailout package's congressional oversight panel, said most
U.S. banks have adequate capital and that there are signals that
credit markets are on the mend.
<CROSSREF GUID="{4F9086D2-7DAA-4037-9F80-7400B2C0D4FB}"
LASTUPDATE="39924.5847222222" ARCHIVE="20090421"
SLUG="bailout" HEADLINE="TARP funds sufficient to do the job, Treasury's
Geithner says">
Read more on Geithner's testimony.
</CROSSREF>
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">Investors were also mulling quarterly
results from a bevy of regional and custody banks, including Zions
Bancorp
<SYMBOL TICKER="ZION" COUNTRY="US" />
, Huntington Bancshares Inc.
<SYMBOL TICKER="HBAN" COUNTRY="US" />
, KeyCorp
<SYMBOL TICKER="KEY" COUNTRY="US" />
, Fifth Third Bancorp
<SYMBOL TICKER="FITB" COUNTRY="US" />
, Regions Financial Corp.
<SYMBOL TICKER="RF" COUNTRY="US" />
, Northern Trust Corp.
<SYMBOL TICKER="NTRS" COUNTRY="US" />
and Bank of New York Mellon Corp.
<SYMBOL TICKER="BK" COUNTRY="US" />
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">
The SPDR KBW Bank ETF
<SYMBOL TICKER="KBE" COUNTRY="US" />
, an exchange-traded fund tied to banking stocks, closed up nearly
7% after declining earlier in the session. The bank ETF lost about
15% on Monday when Bank of America Corp.'s
<SYMBOL TICKER="BAC" COUNTRY="US" />
warning about lingering credit losses spooked investors.
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">After opening lower Tuesday, the
financial sector shot higher in morning trading around the
time Geithner's prepared remarks were released.
</PARAGRAPH>
<SIDEBAR PADDING="7">
<PARAGRAPH TYPE="GRAPHIC">
<CHART APPEARANCE="S1" TITLE="KBE" TICKER="KBE"
ARGS="symb=KBE&time=4&freq=1&compidx=aaaaa:0&comp=&uf=0&lf=
1&lf2=0&lf3=0&state=0&sid=2814487&startdate=&enddate=39924&noset
tings=1">
<IMAGE WIDTH="125" HEIGHT="99" TRACK="201" />
</CHART>
</PARAGRAPH>
</SIDEBAR>
<PARAGRAPH TYPE="NORMAL">In earnings news, custody banks
Northern Trust and Bank of New York Mellon, which slashed its
dividend, saw their profits dinged by falling stock values.
<CROSSREF GUID="{E0F373CB-D359-4380-B6E5-58E149B3D3D9}"
LASTUPDATE="39924.3618055556" ARCHIVE="20090421"
SLUG="bk" HEADLINE="Custody banks' profits hit by falling stock values,
results show">
See earnings coverage.
</CROSSREF>
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">Several regional banks also released
quarterly results.</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">Zions Bancorp's shares fell after the
bank swung to a first-quarter net loss on a write-down of goodwill
and other charges, prompting Moody's Investors Service to slash
its ratings.
<CROSSREF GUID="{67495ACC-0E65-4B18-9A15-CA8B9FCD8513}"
LASTUPDATE="0" ARCHIVE="18991230" SLUG=""
HEADLINE="Zions Bancorp Swings To 1Q Loss; Moody's Cuts Ratings">
Read more on Moody's downgrade of Zions.
</CROSSREF>
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">KeyCorp of Cleveland reported a
quarterly loss of nearly $500 million and set plans to cut its
dividend to beef up its balance sheet.
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">Regions Financial's first-quarter net
income slid 77% on still-rising credit costs, while the company
reported deposit growth.
<CROSSREF GUID="{4F823F24-9CA4-4EAF-BEB3-7FDC1D592C70}"
LASTUPDATE="0" ARCHIVE="18991230" SLUG=""
HEADLINE="Regions Financial 1Q Net Down 77% On Credit Woes">See
complete article on Regions Financial.
</CROSSREF>
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">Also in regional banks, Ohio's
Huntington Bancshares said Tuesday that it swung to a $2.49
billion loss in the first quarter after it took a goodwill-impairment
charge and boosted losses for credit provisions.
<CROSSREF GUID="{E3070B25-94A2-4BE2-88D1-3A4C59A9CDC5}"
LASTUPDATE="39924.3381944444"
ARCHIVE="20090421" SLUG="hban" HEADLINE="Huntington Bancshares
swings to $2.5 billion loss">Read full story on Huntington Bancshares.
</CROSSREF>
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">Other financial-services firms
reporting quarterly results included U.S. Bancorp
<SYMBOL TICKER="USB" COUNTRY="US" />
, Comerica Inc.
<SYMBOL TICKER="CMA" COUNTRY="US" />
, BlackRock Inc
<SYMBOL TICKER="BLK" COUNTRY="US" />
and TD Ameritrade Holding Corp.
<SYMBOL TICKER="AMTD" COUNTRY="US" />
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">Aside from the crush of earnings
reports, traders were looking ahead to results from the
government's "stress tests" for banks, and also to a key Bank of
America shareholder meeting with Chief Executive Ken Lewis, who
is facing criticism over a string of high-profile acquisitions.
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">
Another bank CEO on the hot seat, Citigroup Inc.'s
<SYMBOL TICKER="C" COUNTRY="US" />
Vikram Pandit, made headlines Tuesday. Senior officials at the
Federal Deposit Insurance Corp. have privately discussed who
might replace Pandit as Citigroup's CEO if the bank needed more
government aid, the Financial Times reported, citing a person
familiar with the matter. Citi was holding its shareholder meeting
Tuesday.
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">Separately, a report by the TARP
watchdog said the Treasury Department should be more vigilant in
managing its financial bailout so taxpayer dollars are protected and
programs are more fraud-resistant, accountable and transparent.
<INTERNET
URL="http://online.wsj.com/article/SB124028315955338071.html"
LOCATION="EXTERNAL"TYPE="UNKNOWN">
See more coverage at WSJ.com
</INTERNET>
</PARAGRAPH>
<PARAGRAPH TYPE="NORMAL">Also, Morgan Stanley
<SYMBOL TICKER="MS" COUNTRY="US" />
is considering the acquisition of U.S. regional banks in a move to
boost the company's retail banking operations, according to a
published report.
<CROSSREF GUID="{5B05A6B5-3D01-4915-989B-9847571CA9AA}"
LASTUPDATE="39923.9388888889"
ARCHIVE="20090420" SLUG="ms" HEADLINE="Morgan Stanley mulling
buy of U.S. regional banks: report"> Read more on Morgan Stanley.
</CROSSREF>
</PARAGRAPH>
</SECTION>
<SECTION TYPE="FOOTER"> </SECTION TYPE="FOOTER">
</BODY>
</NEWSITEM>
</ITEM>
</LIST>
</amtd>
Possible Errors
If user has not entered the symbol, they would get the following message:
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Error -- No Symbol entered.</error>
</amtd>
"System Unavailable"
24 QuoteNews
This service displays to clients the top stories based on the symbol the client entered to
retrieve news on. This command is provided "As Is" from CBS MarketWatch with minimal
documentation.
Request URL
https://apis.tdameritrade.com/apps/100/QuoteNews?source=AMTDTest&symbol=AMTD
Request Parameters
PARA DESCRIPTION REQ POSSIBLE VALUES
METE UIRE
R D
Source The Application ID of the YES The value is assigned by TD AMERITRADE to
software client assigned by the application developer for the specific
Ameritrade. application
Symbol List of symbols for which the YES Any valid symbol. Symbols should be comma
quote news should be separated.
returned.
The response to the FullStoryNews request will be in XML format, the response is passed
through as is from CBS MarketWatch.
Request:
https://apis.tdameritrade.com/apps/100/QuoteNews?source=AMTDTest&symbol=AMT
D&format=compact&submit=Submit
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<XML_MULTISYMBOL_NEWS>
<LIST SYMBOL="AMTD" SID="2192348" NEXTKEY="
39924.7201388889-957833622">
<ITEM idDoc="965369676" idTrack="102" idTrackType="102">
<NEWSITEM>
<DOCTYPE ID="103">
<NAME>MarketWatch Databased News</NAME>
<PROVIDER>MarketWatch.com</PROVIDER>
</DOCTYPE>
<HEADLINE>Financials remain higher on CIT rescue</HEADLINE>
<COLUMN>Financial Stocks</COLUMN>
<TARGETING PRIORITY="DAILY">
<CHANNEL NAME="News & Commentary" ID="1">
<SUBCHANNEL NAME="News & Commentary|Markets" ID="
1025" />
</CHANNEL>
</TARGETING>
<CODE-LIST NSURI="urn:marketwatch-com:Channel" CATEGORY="
Target">
<CODE>Markets</CODE>
</CODE-LIST>
<CODE-LIST NSURI="urn:marketwatch-com:Subchannel" CATEGORY="
Target">
<CODE>Markets|U.S. &Canada</CODE>
</CODE-LIST>
<PACKAGES> </PACKAGES>
<PLACEMENT-LIST>
<PLACEMENT>cbs</PLACEMENT>
</PLACEMENT-LIST>
<INDUSTRY-LIST>
<INDUSTRY>Banks</INDUSTRY>
<INDUSTRY>Financial Services</INDUSTRY>
</INDUSTRY-LIST>
<ISSUE-LIST>
<ISSUE>Newsmakers</ISSUE>
<ISSUE>SEC</ISSUE>
<ISSUE>Earnings</ISSUE>
<ISSUE>Markets/Exchanges</ISSUE>
<ISSUE>Analyst</ISSUE>
<ISSUE>Company Announcements</ISSUE>
<ISSUE>Market News</ISSUE>
</ISSUE-LIST>
<FUNDTYPE-LIST> </FUNDTYPE-LIST>
<REGION-LIST>
<REGION>Washington DC</REGION>
<REGION>US</REGION>
</REGION-LIST>
<PERSONALFINANCE-LIST> </PERSONALFINANCE-LIST>
<RELATED-LIST> </RELATED-LIST>
<ABSTRACT>
<PARAGRAPH TYPE="NORMAL">Investors in financial firms
cheered news that CIT Group has secured financing, easing fears
for the time being that the business lender will file for
bankruptcy protection.
</PARAGRAPH>
</ABSTRACT>
<SUMMARY ID="">
<SUMMARY-BODY>
<HEADLINE>Financials remain higher on CIT rescue</HEADLINE>
<PARAGRAPH TYPE="NORMAL">Investors in financial firms
cheered news that CIT Group has secured financing, easing
fears for the time being that the business lender will file for
bankruptcy protection.
</PARAGRAPH>
</SUMMARY-BODY>
</SUMMARY>
<CREATED TIMESTAMP="40014.6666666667" ET-FORMAT="4:00 PM ET
Jul 20, 2009" CTIME-FORMAT="1248127200">7/20/2009 4:00:00 PM
</CREATED>
<LASTUPDATED TIMESTAMP="40014.6666666667" ET-FORMAT="4:00
PM ET Jul 20, 2009" CTIME-FORMAT=" 1248127200">
7/20/2009 4:00:00 PM</LASTUPDATED>
<AUTHOR GUID="{B1EC6A08-BFC2-0642-93E2-6DB9DCB28E7A}"
ORGANIZATION="MarketWatch" ADDRESS="
mailto:[email protected]" BIO="Ryan Williams is a
reporter for MarketWatch, based in New York.">Ryan Williams
</AUTHOR>
<GUID>{7A460343-08C5-4B1E-B870-57C3807C6BCF}</GUID>
<LOCATION>
<STORAGE GUID="{7A460343-08C5-4B1E-B870-57C3807C6BCF}"
SLUG="sector_financial" />
</LOCATION>
<SYMBOLS>
<SYMBOL COUNTRY="US" TICKER="XLF">XLF</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="CIT">CIT</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="STT">STT</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="WFC">WFC</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="AXP">AXP</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="MTB">MTB</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="AMTD">AMTD</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="SCHW">SCHW</SYMBOL>
</SYMBOLS>
</NEWSITEM>
</ITEM>
<ITEM idDoc="965356483" idTrack="102" idTrackType="102">
<NEWSITEM>
<DOCTYPE ID="103">
<NAME>MarketWatch Databased News</NAME>
<PROVIDER>MarketWatch.com</PROVIDER>
</DOCTYPE>
<HEADLINE>Financials get lift from CIT emergency rescue</HEADLINE
>
<COLUMN>Financial Stocks</COLUMN>
<TARGETING PRIORITY="DAILY">
<CHANNEL NAME="News & Commentary" ID="1">
<SUBCHANNEL NAME="News & Commentary|Markets" ID="
1025" />
</CHANNEL>
</TARGETING>
<CODE-LIST NSURI="urn:marketwatch-com:Channel" CATEGORY="
Target">
<CODE>Markets</CODE>
</CODE-LIST>
<CODE-LIST NSURI="urn:marketwatch-com:Subchannel" CATEGORY="
Target">
<CODE>Markets|U.S. &Canada</CODE>
</CODE-LIST>
<PACKAGES> </PACKAGES>
<PLACEMENT-LIST>
<PLACEMENT>cbs</PLACEMENT>
</PLACEMENT-LIST>
<INDUSTRY-LIST>
<INDUSTRY>Banks</INDUSTRY>
<INDUSTRY>Financial Services</INDUSTRY>
</INDUSTRY-LIST>
<ISSUE-LIST>
<ISSUE>Newsmakers</ISSUE>
<ISSUE>Earnings</ISSUE>
<ISSUE>Markets/Exchanges</ISSUE>
<ISSUE>Analyst</ISSUE>
<ISSUE>Company Announcements</ISSUE>
<ISSUE>Market News</ISSUE>
</ISSUE-LIST>
<FUNDTYPE-LIST> </FUNDTYPE-LIST>
<REGION-LIST>
<REGION>Washington DC</REGION>
<REGION>US</REGION>
</REGION-LIST>
<PERSONALFINANCE-LIST> </PERSONALFINANCE-LIST>
<RELATED-LIST> </RELATED-LIST>
<ABSTRACT>
<PARAGRAPH TYPE="NORMAL">The lenders efforts to get financing
are alleviating fears for the time being that the business lender
will file for bankruptcy protection.</PARAGRAPH>
</ABSTRACT>
<SUMMARY ID="">
<SUMMARY-BODY>
<HEADLINE>Financials get lift from CIT emergency rescue</
HEADLINE>
<PARAGRAPH TYPE="NORMAL">The lenders efforts to get financing
are alleviating fears for the time being that the business lender
will file for bankruptcy protection.</PARAGRAPH>
</SUMMARY-BODY>
</SUMMARY>
<CREATED TIMESTAMP="40014.5194444444" ET-FORMAT="12:28 PM
ET Jul 20, 2009" CTIME-FORMAT="1248114480">7/20/2009 12:28:00
PM
</CREATED>
<LASTUPDATED TIMESTAMP="40014.5194444444" ET-FORMAT="12:28
PM ET Jul 20, 2009" CTIME-FORMAT=" 1248114480">
7/20/2009 12:28:00 PM
</LASTUPDATED>
<AUTHOR GUID="{B1EC6A08-BFC2-0642-93E2-6DB9DCB28E7A}"
ORGANIZATION="MarketWatch" ADDRESS="
mailto:[email protected]" BIO="Ryan Williams is a
reporter for MarketWatch, based in New York.">Ryan Williams</
AUTHOR>
<GUID>{D897B551-84C4-49A1-BEEB-058D1BDA2DBC}</GUID>
<LOCATION>
<STORAGE GUID="{D897B551-84C4-49A1-BEEB-058D1BDA2DBC}
" SLUG="sector_financial" />
</LOCATION>
<SYMBOLS>
<SYMBOL COUNTRY="US" TICKER="XLF">XLF</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="CIT">CIT</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="STT">STT</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="WFC">WFC</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="AXP">AXP</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="MTB">MTB</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="AMTD">AMTD</SYMBOL>
<SYMBOL COUNTRY="US" TICKER="SCHW">SCHW</SYMBOL>
</SYMBOLS>
</NEWSITEM>
</ITEM>
</LIST>
</XML_MULTISYMBOL_NEWS>
</amtd>
Possible Errors
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<XML_MULTISYMBOL_NEWS>
<NOTFOUND>
<SYMBOL>111</SYMBOL>
</NOTFOUND>
</XML_MULTISYMBOL_NEWS>
</amtd>
If user has not entered the symbol, they would get the following message:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<XML_MULTISYMBOL_NEWS>
<ERROR>Please pass a symbol(s).</ERROR>
</XML_MULTISYMBOL_NEWS>
</amtd>
"System Unavailable"
25 EquityTrade
Service provides the ability to trade equities. EquityTrade is used for simple, single leg
orders. Conditional orders are handled by the ConditionalEquityTrade service
Request URL
https://apis.tdameritrade.com/apps/100/EquityTrade?source=<##SourceID#>&orderstring=<
#ORDERSTRING#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderstring parameters, each one defining one order being sent.
NOTE: The accountid is specified inside the orderstring, not as a separate parameter
if ordtype=market
· expire must be day or moc
· spinstructions must none
· price must be empty or 0
· actprice must be empty or 0
· routing must be auto
if ordtype=limit
· price must be a valid value
· actprice must be empty or 0
· expire must be day, day_ext, gtc, gtc_ext, am, or pm
o if expire=day, spinstructions must be non, aon, fok
o if expire=day_ext, gtc_ext, am, or pm, spinstructions must be none
o if expire=gtc, spinstructions must be none, aon, dnr, aon_dnr
if ordtype=stop_limit
· price must be a valid value
· actprice must be a valid value
· expire must be day or gtc
o if expire=day, spinstructions must be none
if ordtype=stop_market
· price must be empty or 0
· actprice must be a valid value
· expire must be day or gtc
·
if ordtype=tstoppercent
· price must be empty or 0
· actprice must be empty or 0
· tsparam must be a whole number between 1 and 99
if ordtype=tstopdollar
· price must be empty or 0
· actprice must be empty or 0
· tsparam must be greater than 0 and a decimal value (#.##)
· expire must be day or gtc
if expire=gtc or gtc_ext
· a valid expiration date (exday, exmont, and exyear) is required
if displaysize is not empty (display size is not a required field and is only related to
INET orders)
· display size must be a valid quantity
· the minimum display size is 100
· the maximum display size is the quantity
if spinstructions is dnr
· , then expire must be gtc
if routing=inet or ecn_arca
· the maximum quantity is 250000
· the ordtype must be limit
· the expire must be day or day_ext
· the spinstructions must be none
Response Fields
XML Type Definitions
Attribute
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
order-wrapper Comp Container for the order information that is being submitted
lex
client-order-id String The ID Generated by the client software and submitted with the order.
Used for order matching.
orderstring String The orderstring used to submit this order
error String Error message if an error occurred when placing the order
order Comp Container for detailed information about the order
lex
accountid String The account id in which the order was placed
security Comp Container for detailed information about the security
lex
symbol String Contains symbol. For example, AMTD.
symbol-with-ty String
pe-prefix
description String
asset-type String Type of asset the symbol represents. It is a one character code: E —
Equity
exchange String
quantity Doubl
Number of units ordered. Field may have up to three digits to the right
e of the decimal point.
order-id String
A unique number identifying the order. Generated by the servers
action String
Code indicating the order action requested. Values returned are:
B — Buy
S — Sell
SS — Short Sell
BC — Buy to Cover
E — Exchange
EX — Exercise Option
trade-type Intege Valid values are:
r 1 — Normal Market
2 — External Hour Market
4 — German Market
8 — AM Session
16 — Seamless Session
requested-des Comp
tination lex
routing-mode String
market-maker String
-id
response-des String
cription
routing-displa Intege
y-size r
expiration String
Request:
https://apis.tdameritrade.com/apps/100/EquityTrade?source=<#sourceID#
>&orderstring=action%3Dbuy%7Equantity%3D400%7Esymbol%3DDELL%7Eordtype%3DLimit%7
Eprice%3D27.49%7Eactprice%3D%7Etsparam%3D%7Eexpire%3Dday%7Espinstructions%3Dnon
e%7Erouting%3Dauto%7Edisplaysize%3D%7Eexmonth%3D%7Eexday%3D%7Eexyear%3D%7Ea
ccountid%3D123456789
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<order-wrapper>
<orderstring>
action=buy~quantity=400~symbol=DELL~ordtype=Limit~price=27.49~
actprice=~tsparam=~expire=day~spinstructions=none~routing=auto~d
isplaysize=~exmonth=~exday=~exyear=~accountid=123456789
</orderstring>
<error></error>
<order>
<account-id>123456789</account-id>
<security>
<symbol>DELL</symbol>
<symbol-with-type-prefix>DELL</symbol-with-type-prefix>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
<error>Please check your portfolio and/or open orders. Your sell order is
greater than the quantity held in your account.</error>
</order-wrapper>
</amtd>
26 OptionTrade
Service provides the ability to trade options. OptionTrade is used for simple, single leg
orders. Complex option orders and Conditional orders will be implemented separately
Request URL
https://apis.tdameritrade.com/apps/100/OptionTrade?source=<##SourceID#>&orderstring=<
#ORDERSTRING#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderstring parameters, each one defining one order being sent.
NOTE: The accountid is specified inside the orderstring, not as a separate parameter
exday Two NO
digit
expiratio
n day,
only
specifie
d if
expire is
set to
gtc
otherwis
e null
exmont Two NO
h digit
expiratio
n
month,
only
specifie
d if
expire is
set to
gtc
otherwis
e null.
exyear Two NO
digit
expiratio
n year,
only
specifie
d if
expire is
set to
gtc
otherwis
e null.
ordtype Case YES market, limit,
sensitiv stop_market, stop_limit
e value
for
order
type
price Limit NO
price for
limit or
stop
limit
orders
otherwis
e null
quantity The YES
number
of
shares
being
bought
or sold
in the
transacti
on
routing User NO auto, isex, cboe, amex, phlx, pacx, bosx
specifie
d order
routing
destinati
on.
Default
is auto
spinstru Special NO none, fok, aon
ctions Instructi
ons for
the
order
executio
n. Set to
none if
not
specifie
d
symbol Symbol YES
being
bought
or sold.
UPPER
CASE
if ordtype=market
· expire must be day
if ordtype=limit
· price must be valid
· actprice must be empty or 0
· expire must be day or gtc
o if expire=gtc, spinstructions must be none or aon
o if expire=day, spinstructions must be none, aon, fok
if ordertype=stop_market
· price must be empty or 0
· actprice must be valid
· expire must be day or gtc
· spinstructions must be none or aon
if ordtype=stop_limit
· price must be valid
· actprice must be valid
· expire must be day or gtc
· spinstructions must be none or aon
if expire=gtc or gtc_ext
· a valid expiration date (exday, exmont, and exyear) is required
<order-wrapper>
<client-order-id></client-order-id>
<orderstring></orderstring>
<error></error>
<order>
<account-id></account-id>
<security>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description></description>
<asset-type></asset-type>
<exchange></exchange>
</security>
<quantity></quantity>
<order-id></order-id>
<action></action>
<trade-type></trade-type>
<requested-destination>
<routing-mode></routing-mode>
<option-exchange></option-exchange>
<response-description></response-description>
</requested-destination>
<routing-display-size></routing-display-size>
<order-type></order-type>
<limit-price></limit-price>
<stop-price></stop-price>
<time-in-force>
<session></session>
</time-in-force>
<put-call></put-call>
<open-close></open-close>
</order>
</order-wrapper>
</amtd>
Response Fields
XML Attribute Type Definitions
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
order-wrapper Compl Container for the order information that is being submitted
ex
client-order-id String The ID Generated by the client software and submitted with the
order. Used for order matching.
orderstring String The orderstring used to submit this order
error String Error message if an error occurred when placing the order
order Compl Container for detailed information about the order
ex
special-conditi String
ons
time-in-force Compl
ex
session String
expiration String
put-call String
open-close String
Request:
https://apis.tdameritrade.com/apps/100/OptionTrade?source=<#sourceID#
>&orderstring=action%3Dselltoclose%7Equantity%3D10%7Esymbol%3DKQM_082210P6.30%7Eo
rdtype%3DLimit%7Eprice%3D6.3%7Eactprice%3D%7Eexpire%3Dday%7Espinstructions%3Dnone
%7Erouting%3Dauto%7Eexmonth%3D%7Eexday%3D%7Eexyear%3D%7Eaccountid%3D1234567
89
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<order-wrapper>
<orderstring>
action=selltoclose~quantity=10~symbol=KQM_082210P6.30~ordtype=L
imit~price=6.3~actprice=~expire=day~spinstructions=none~routing=a
uto~exmonth=~exday=~exyear=~tabid=0~accountid=123456789
</orderstring>
<error></error>
<order>
<account-id>123456789</account-id>
<security>
<symbol>KQM_082210P6.30</symbol>
<symbol-with-type-prefix>KQM_082210P6.30</
symbol-with-type-prefix>
<description>KQM Feb 20 2010 6.30 Put</description>
<asset-type>O</asset-type>
<exchange>OPRA</exchange>
</security>
<quantity>10</quantity>
<order-id>2148878993</order-id>
<action>S</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<market-maker-id>Auto</market-maker-id>
<response-description>AutoRoute</response-description>
</requested-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</order-type>
<limit-price>6.30</limit-price>
<stop-price></stop-price>
<time-in-force>
<session>D</session>
</time-in-force>
<put-call>P</put-call>
<open-close>C</open-close>
</order>
</order-wrapper>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
27 EditOrder
Service provides the ability to modify unfilled or partially filled orders. Only certain fields may
be modified for an existing order. If non-modifiable fields require modification the order must
be cancelled and replaced.
NOTE: If editing an order that was just edited, make sure that the original order's status is
"Canceled" before submitting a new EditOrder command
Request URL
https://apis.tdameritrade.com/apps/100/EditOrder?source=<#SourceID#>&orderstring=<
#ORDERSTRING#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderstring parameters, each one defining one order being sent.
Note: This operation can now be used on Equity, Option and Complex Option orders.
clientorde Generated by the client NO Any integer value. Should be unique for
rid software. It gets returned that client
in the response for order
matching.
orderid The Order ID of an YES One of the existing open orders that is in
existing open order one of the logged in accounts. The orderid
would be either returned from EquityTrade
or OptionTrade, or retrievied from the
OrderStatus Response When editing a
complex option order use the orderid of the
first leg of the order.
actprice The stop price for stop NO
market or stop limit
orders
accountid The Account ID of the YES One of the account IDs returned from the
account in which the trade LogIn service. The default is the
is being made associated account
expire Time in force YES day, day_ext, gtc, gtc_ext, am, pm
exday Two digit expiration day, NO
only specified if expire is
set to gtc otherwise null
exmonth Two digit expiration NO
month, only specified if
expire is set to gtc
otherwise null.
exyear Two digit expiration year, NO
only specified if expire is
set to gtc otherwise null.
ordtype Case sensitive value for YES market, limit, stop_market, stop_limit,
order type tstoppercent, tstopdollar, net_credit,
net_debit
price Limit price for limit, stop NO
limit, net_credit, or
net_debit orders
otherwise null
quantity The number of shares YES In cases where the original order was
being bought or sold in partially filled, the specified quantity needs
the transaction to be the REMAINING quantity
For the order to be eligible for editing the following conditions must be met:
· originalOrder assetType = Option or Equity
· originalOrder status=Open, Pending, or Partially Filled
if ordtype=stop_limit
· price must be a valid value
· actprice must be a valid value
if ordtype=stop_market
· price must be empty or 0
· actprice must be a valid value
if ordtype=tstoppercent or ordtype=tstopdollar
· not allowed to be edited
if expire=gtc or gtc_ext
· a valid expiration date (exday, exmont, and exyear) is required
Note: You can not edit Complex Option Order. You just need to cancel the order.
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
If the order was already filled, you will get the following response
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<order-wrapper>
<orderstring>
action=sell~quantity=100~symbol=DELL~ordtype=Limit~price=27.4~ac
tprice=~tsparam=~expire=day~spinstructions=none~routing=auto~dis
playsize=~exmonth=~exday=~exyear=~accountid=123456789</
orderstring>
<error>Order cannot be replaced.</error>
</order-wrapper>
</amtd>
28 OrderCancel
Service provides the ability to cancel one or more open orders or the balance of partially
filled orders.
NOTE: If canceling an order that was just edited, make sure that the original order's status is
"Canceled" before submitting the OrderCancel command
Request URL
https://apis.tdameritrade.com/apps/100/OrderCancel?source=<#SourceID#>&orderid=<
#order-id#>&orderid=<#order-id#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderid parameters for existing open orders
<error><error>
</order>
</cancel-order-messages>
</amtd>
Response Fields
XML Attribute Type Definitions
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
cancel-order-m Compl Container for the canceled order information that was submitted
essages ex
account-id String The account ID in which the order was placed
order String Container for the order information
order-id String Unique ID identifying the order being canceled
message String Status message to be displayed to the user if the OrderCancel was
successfully submitted:
NOTE: This does NOT mean the order was successfully canceled.
Just successfully submitted
error String Error message if an error occurred when submitting the
OrderCancel request. Null otherwise
Request:
https://apis.tdameritrade.com/apps/100/OrderCancel?source=<#sourceID#
>&orderid=2148881399&orderid=2147949999&orderid=2147949948
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<cancel-order-messages>
<account-id>123456789</account-id>
<order>
<order-id>2148881399</order-id>
<message>The order was submitted for cancellation. Please check its
status.</message>
<error></error>
</order>
<order>
<order-id>2147949999</order-id>
<message></message>
<error>The order could not found. Please check its status.</error>
</order>
</cancel-order-messages>
</amtd>
Note: If you want to cancel Complex Option Order, you need to pass Primary Legged Order
ID.
Possible Errors
If the session is invalid, you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Invalid Session</error>
</amtd>
if the order was closed or could not be found, you will get the following errors:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<cancel-order-messages>
<account-id>123456789</account-id>
<order>
<order-id>2147949999</order-id>
<message></message>
<error>The order could not found. Please check its status.</error>
</order>
</cancel-order-messages>
</amtd>
29 ConditionalEquityTrade
Service provides the ability to trade equities. Unlike EquityTrade, this one is used to enter
multi-leg conditional orders - where the execution of one order will trigger one or more other
orders or cancellation of one or more orders
Request URL
https://apis.tdameritrade.com/apps/100/ConditionalEquityTrade?source=<##SourceID#
>&orderstring=<#ORDERSTRING#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderstring parameters, each one defining one order group being sent.
if ordticket=oca
· expire must be the same for both legs
· ordtype cannot be Market for either leg
· symbol + action + ordertype cannot be the exact same for both legs
· if symbol is the same for both legs and either leg has an ordtype=limit
o other leg ordertype=stop_limit, stop_market, tstoppercent, tstopdollar
· if symbol and action on both legs are the same and action is buy and if one leg is limit and
other leg is stop limit or stop market
o stop price must be higher than the limit price
· if symbol and action on both legs are the same and action is sell and if one leg is limit and
other leg is stop limit or stop market
o stop price must be lower than the limit price
NOTE: the structure of the ORDER section is the same as what you get from EquityTrade
Response
<trade-type></trade-type>
<requested-destination>
<routing-mode></routing-mode>
<market-maker-id></market-maker-id>
<response-description></response-description>
</requested-destination>
<routing-display-size></routing-display-size>
<order-type></order-type>
<limit-price></limit-price>
<stop-price></stop-price>
<time-in-force>
<session></session>
</time-in-force>
</order>
<order>
....
</order>
....
</enhancled-order>
</order-wrapper>
</amtd>
Response Fields
XML Type Definitions
Attribute
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
order-wrapper Comp Container for the order information that is being submitted
lex
client-order-id String The ID Generated by the client software and submitted with the order.
Used for order matching.
orderstring String The orderstring used to submit this order
error String Error message if an error occurred when placing the order
enhanced-ord Comp Container for detailed information about the enhanced order
er lex
eot-type String The type of conditional order
order Comp Container for detailed information about the order
lex
accountid String The account id in which the order was placed
security Comp Container for detailed information about the security
lex
symbol String Contains symbol. For example, AMTD.
symbol-with-ty String
pe-prefix
description String
asset-type String Type of asset the symbol represents. It is a one character code: E —
Equity
exchange String
quantity Doubl Number of units ordered. Field may have up to three digits to the right
e of the decimal point.
order-id String Unique order number assigned by the Trading Platform
action String Code indicating the order action requested. Values returned are:
B — Buy
S — Sell
SS — Short Sell
BC — Buy to Cover
E — Exchange
EX — Exercise Option
trade-type Intege Valid values are:
r 1 — Normal Market
2 — External Hour Market
4 — German Market
8 — AM Session
16 — Seamless Session
requested-des Comp
tination lex
routing-mode String
market-maker String
-id
response-des String
cription
routing-displa Intege
y-size r
order-type String Values returned are:
M — Market
L — Limit
S — Stop
X — Stop Limit
T — Trailing Stop
EX — Exercise Option
limit-price Doubl
e
stop-price Doubl
e
special-conditi String
ons
time-in-force Comp
lex
session String
expiration String
Request:
https://apis.tdameritrade.com/apps/100/ConditionalEquityTrade?orderstring=ordticket%3Dota%7Etotle
gs%3D2%7Eaction1%3Dbuy%7Equantity1%3D2%7Esymbol1%3Dibm%7Eordtype1%3Dlimit%7Epric
e1%3D2%7Eactprice1%3D%7Etsparam1%3D%7Eexpire1%3Dday%7Espinstructions1%3Dnone%7Er
outing1%3Dauto%7Edisplaysize1%3D%7Eexmonth1%3D%7Eexday1%3D%7Eexyear1%3D%7Eactio
n2%3Dbuy%7Equantity2%3D4%7Esymbol2%3Ddis%7Eordtype2%3Dlimit%7Eprice2%3D25%7Eactpr
ice2%3D%7Etsparam2%3D%7Eexpire2%3Dday%7Espinstructions2%3Dnone%7Erouting2%3Dauto
%7Eexmonth2%3D%7Eexday2%3D%7Eexyear2%3D%7Eaccountid%3D123456789%7Eclientorderid
%3D1
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<order-wrapper>
<client-order-id>1</client-order-id>
<orderstring>
ordticket=ota~totlegs=2~action1=buy~quantity1=2~symbol1=ibm~ordt
ype1=limit~price1=2~actprice1=~tsparam1=~expire1=day~spinstructio
ns1=none~routing1=auto~displaysize1=~exmonth1=~exday1=~exyear
1=~action2=buy~quantity2=4~symbol2=dis~ordtype2=limit~price2=25
~actprice2=~tsparam2=~expire2=day~spinstructions2=none~routing2=
auto~exmonth2=~exday2=~exyear2=~accountid=
123456789~clientorderid=1</orderstring>
<error></error>
<enhanced-order>
<eot-type>OTA</eot-type>
<order>
<security>
<symbol>IBM</symbol>
<symbol-with-type-prefix>IBM</symbol-with-type-prefix>
<description>INTERNATIONAL BUSINESS MACHS COM</
description>
<asset-type>E</asset-type>
<exchange>NYSE</exchange>
</security>
<quantity>2</quantity>
<order-id>2148123456</order-id>
<action>B</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</ order-type >
<limit-price>2.00</limit-price>
<stop-price> </stop-price>
<stop-limit-price>2.00</stop-limit-price>
<time-in-force>
<session>D</session>
</time-in-force>
</order>
<order>
<security>
<symbol>DIS</symbol>
<symbol-with-type-prefix>DIS</symbol-with-type-prefix>
<description>DISNEY WALT CO COM DISNEY</description>
<asset-type>E</asset-type>
<exchange>NYSE</exchange>
</security>
<quantity>4</quantity>
<order-id>2148123457</order-id>
<action>B</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</ order-type >
<limit-price>25.00</limit-price>
<stop-price> </stop-price>
<stop-limit-price>25.00</stop-limit-price>
<time-in-force>
<session>D</session>
</time-in-force>
</order>
</enhanced-order>
</order-wrapper>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
30 ConditionalOptionTrade
Service provides the ability to trade options. Unlike OptionTrade, this one is used to enter
multi-leg conditional orders - where the execution of one order will trigger one or more other
orders or cancellation of one or more orders.
NOTE: This should not be confused with complex option orders (Vertical Spreads,
Buy/Write, Butterflies, etc). Those are implemented separately
Request URL
https://apis.tdameritrade.com/apps/100/ConditionalOptionTrade?source=<##SourceID#
>&orderstring=<#ORDERSTRING#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderstring parameters, each one defining one order group being sent.
if ordticket=oca
· expire must be the same for both legs
· ordtype cannot be Market for either leg
· symbol + action + ordertype cannot be the exact same for both legs
· if symbol is the same for both legs and either leg has an ordtype=limit
o other leg ordertype=stop_limit, stop_market
· if symbol and action on both legs are the same and action is buy and if one leg is limit and
other leg is stop limit or stop market
o stop price must be higher than the limit price
· if symbol and action on both legs are the same and action is sell and if one leg is limit and
other leg is stop limit or stop market
o stop price must be lower than the limit price
NOTE: the structure of the ORDER section is the same as what you get from OptionTrade
Response
<exchange></exchange>
</security>
<quantity></quantity>
<order-id></order-id>
<action></action>
<trade-type></trade-type>
<requested-destination>
<routing-mode></routing-mode>
<option-exchange></option-exchange>
<response-description></response-description>
</requested-destination>
<routing-display-size></routing-display-size>
<order-type></order-type>
<limit-price></limit-price>
<stop-price></stop-price>
<time-in-force>
<session></session>
</time-in-force>
<put-call></put-call>
<open-close></open-close>
</order>
<order>
....
</order>
....
</enhancled-order>
</order-wrapper>
</amtd>
Response Fields
XML Type Definitions
Attribute
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
order-wrapper Comp Container for the order information that is being submitted
lex
client-order-id String The ID Generated by the client software and submitted with the order.
Used for order matching.
orderstring String The orderstring used to submit this order
error String Error message if an error occurred when placing the order
enhanced-ord Comp Container for detailed information about the enhanced order
er lex
eot-type String The type of conditional order
order Comp Container for detailed information about the order
lex
accountid String The account id in which the order was placed
market-maker String
-id
response-des String
cription
routing-displa Intege
y-size r
order-type String Values returned are:
M — Market
L — Limit
S — Stop
X — Stop Limit
T — Trailing Stop
EX — Exercise Option
limit-price Doubl
e
stop-price Doubl
e
special-conditi String
ons
time-in-force Comp
lex
session String
expiration String
Request:
https://apis.tdameritrade.com/apps/100/ConditionalOptionTrade?orderstring=ordticket%3Dota%7Etotle
gs%3D2%7Eaction1%3Dbuytoopen%7Equantity1%3D2%7Esymbol1%3DGOOG_071010C520%7Eor
dtype1%3Dlimit%7Eprice1%3D10%7Eactprice1%7Eexpire1%3Dday%7Espinstructions1%3Dnone%7
Erouting1%3Dauto%7Eexmonth1%3D%7Eexday1%3D%7Eexyear1%3D%7Eaction2%3Dbuytoopen%
7Equantity2%3D4%7Esymbol2%3DGOOG_071010C520%7Eordtype2%3Dlimit%7Eprice2%3D8%7E
actprice2%3D%7Eexpire2%3Dday%7Espinstructions2%3Dnone%7Erouting2%3Dauto%7Eexmonth2
%3D%7Eexday2%3D%7Eexyear2%3D%7Eaccountid%3D123456789%7Eclientorderid%3D1
(Order String is URL Encoded version of
ordticket=ota~totlegs=2~action1=buytoopen~quantity1=2~symbol1=GOOG_0
71010C520~ordtype1=limit~price1=10~actprice1~expire1=day~spinstructions
1=none~routing1=auto~exmonth1=~exday1=~exyear1=~action2=buytoopen
~quantity2=4~symbol2=GOOG_071010C520~ordtype2=limit~price2=8~actpri
ce2=~expire2=day~spinstructions2=none~routing2=auto~exmonth2=~exday2
=~exyear2=~accountid=123456789~clientorderid=1)
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<order-wrapper>
<client-order-id>1</client-order-id>
<orderstring>
ordticket=ota~totlegs=2~action1=buytoopen~quantity1=2~symbol1=G
OOG_071010C520~ordtype1=limit~price1=10~actprice1~expire1=day~
spinstructions1=none~routing1=auto~exmonth1=~exday1=~exyear1=~
action2=buytoopen~quantity2=4~symbol2=GOOG_071010C520~ordtype
2=limit~price2=8~actprice2=~expire2=day~spinstructions2=none~routi
ng2=auto~exmonth2=~exday2=~exyear2=~accountid=123456789~clie
ntorderid=1</orderstring>
<error></error>
<enhanced-order>
<eot-type>OTA</eot-type>
<order>
<security>
<symbol>GOOG_071010C520</symbol>
<symbol-with-type-prefix>GOOG_071010C520</
symbol-with-type-prefix>
<description>GOOG Jul 10 2010 520.0 Call</description>
<asset-type>O</asset-type>
<exchange>OPRA</exchange>
</security>
<quantity>2</quantity>
<order-id>2148883013</order-id>
<action>B</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</ order-type >
<limit-price>10.00</limit-price>
<stop-price> </stop-price>
<stop-limit-price>10.00</stop-limit-price>
<time-in-force>
<session>D</session>
</time-in-force>
<put-call>C</put-call>
<open-close>O</open-close>
</order>
<order>
<security>
<symbol>GOOG_071010C520</symbol>
<symbol-with-type-prefix>GOOG_071010C520</
symbol-with-type-prefix>
<description>GOOG Jul 10 2010 520.0 Call</description>
<asset-type>O</asset-type>
<exchange>OPRA</exchange>
</security>
<quantity>4</quantity>
<order-id>2148883014</order-id>
<action>B</action>
<trade-type>1</trade-type>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<routing-display-size>0</routing-display-size>
<order-type>L</ order-type >
<limit-price>8.00</limit-price>
<stop-price> </stop-price>
<stop-limit-price>8.00</stop-limit-price>
<time-in-force>
<session>D</session>
</time-in-force>
<put-call>C</put-call>
<open-close>O</open-close>
</order>
</enhanced-order>
</order-wrapper>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
31 BuyWriteOptionTrade
Service provides the ability to trade complex orders. Unlike OptionTrade, this one is used to
enter a buy on the underlying symbol and a sell of the corresponding option in one
transaction.
NOTE: This should not be confused with conditional option orders (where execution of one
order can trigger one or more other orders). Those are implemented separately
Request URL
https://apis.tdameritrade.com/apps/100/BuyWriteOptionTrade?source=<##SourceID#
>&orderstring=<#ORDERSTRING#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderstring parameters, each one defining one order group being sent.
clientord Generat NO Any integer value. Should be unique for that client
erid ed by
the
client
software
. It gets
returned
in the
respons
e for
order
matchin
g.
accounti The YES One of the account IDs returned from the LogIn service.
d Account The default is the associated account
ID of
the
account
in which
the
trade is
being
made
action Equity YES buy, sell
Order
action
action2 Option YES selltoopen, buytoclose
Order
action
ordtype Case YES net_debit,net_credit,market
sensitiv
e value
for
order
type
price Limit NO
price for
net_deb
it or
net_cre
dit
orders.
Otherwi
se null
exmont Two NO
h digit
expiratio
n day,
only
specifie
d if
expire is
set to
GTC
otherwis
e null
exyear Two NO
digit
expiratio
n day,
only
specifie
d if
expire is
set to
GTC
otherwis
e null
· action, action2, symbol, symbol2, ordtype, quantity, and accountid are required
parameters
· if action=buy
action2 must be selltoopen
ordtype must be net_debit or market
· if action=sell
action2 must be buytoclose
ordtype must be net_credit or market
· The underlying symbol of the option leg must be the same as the equity leg.
NOTE: the structure of the ORDER section is the same as what you get from OptionTrade
Response
</order-wrapper>
</amtd>
Response Fields
XML Type Definitions
Attribute
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
order-wrappe Complex Container for the order information that is being submitted
r
client-order-id String The ID Generated by the client software and submitted with
the order. Used for order matching.
orderstring String The orderstring used to submit this order
error String Error message if an error occurred when placing the order
order Complex Container for detailed information about the order
accountid String The account id in which the order was placed
security Complex Container for detailed information about the EQUITY security
symbol String Contains the EQUITY symbol. For example, DELL
symbol-with-t String
ype-prefix
description String
asset-type String Type of asset the symbol represents. It is a one character
code: E — Equity
exchange String
quantity Double Number of shares ordered of the Equity leg of the order
order-id String Unique order number assigned to this order
action String Code indicating the order action requested. Values returned
are:
B — Buy
S — Sell
(NOTE: Look at the OPEN-CLOSE tag too)
requested-de Complex
stination
routing-mode String
market-make String
r-id
response-des String
cription
routing-displa Integer
y-size
time-in-force Complex
session String
put-call String
Request:
https://apis.tdameritrade.com/apps/100/BuyWriteOptionTrade?orderstring=accountid%3D123456789
%7Esymbol%3DIBM%7Eordtype%3Dnet_debit%7Eaction%3Dbuy%7Equantity%3D100%7Esymbol2I
BM_111010C113.5%7Eaction2%3Dselltoopen%7Eprice%3D113.54%7Eclientorderid%3D1
(Order String is URL Encoded version of
accountid=123456789~symbol=IBM~ordtype=net_debit~action=buy~quantity
=100~symbol2=IBM_111010C113.5~action2=selltoopen~price=113.54~client
orderid=1)
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<order-wrapper>
<client-order-id>1</client-order-id>
<orderstring>
accountid=123456789~symbol=IBM~ordtype=net_debit~action=buy~qu
antity=100~symbol2=IBM_111010C113.5~action2=selltoopen~price=11
3.54~clientorderid=1</orderstring>
<error></error>
<order>
<account-id>123456789</account-id>
<security>
<symbol>IBM</symbol>
<symbol-with-type-prefix>IBM</symbol-with-type-prefix>
<description>INTERNATIONAL BUSINESS MACHS COM</description>
<asset-type>E</asset-type>
</security>
<quantity>100</quantity>
<order-id>2147607354</order-id>
<action>B</action>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<routing-display-size>0</routing-display-size>
<order-type>D</order-type>
<time-in-force>
<session>D</session>
</time-in-force>
<put-call>C</put-call>
<open-close></open-close>
<strategy>Buy Write</strategy>
<premium>113.54</premium>
<action2>S</action2>
<open-close2>O</open-close2>
<security2>
<symbol>IBM_111010C113.5</symbol>
<symbol-with-type-prefix>IBM_111010C113.5</
symbol-with-type-prefix>
<description>IBM Nov 10 2010 113.5 Call</description>
<asset-type>O</asset-type>
<exchange>OPR</exchange>
</security2>
</order>
</order-wrapper>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
32 SpreadOptionTrade
Service provides the ability to trade complex orders. Unlike OptionTrade, this one is used to
enter a buy on one option symbol and a sell of another option in one transaction.
NOTE: This should not be confused with conditional option orders (where execution of one
order can trigger one or more other orders). Those are implemented separately
Request URL
https://apis.tdameritrade.com/apps/100/SpreadOptionTrade?source=<##SourceID#
>&orderstring=<#ORDERSTRING#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderstring parameters, each one defining one order group being sent.
exyear Two NO
digit
expiratio
n day,
only
specifie
d if
expire is
set to
GTC
otherwis
e null
· action, action2, symbol, symbol2, ordtype, quantity, and accountid are required
parameters
· if action=buytoopen or buytoclose
action2 must be selltoopen or selltoclose
· if action=selltoopen or selltoclose
action2 must be buytoopen or buytoclose
NOTE: the structure of the ORDER section is the same as what you get from OptionTrade
Response
<error></error>
<order>
<account-id></account-id>
<security>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description></description>
<asset-type></asset-type>
<exchange></exchange>
</security>
<quantity></quantity>
<order-id></order-id>
<action></action>
<requested-destination>
<routing-mode></routing-mode>
<option-exchange></option-exchange>
<response-description></response-description>
</requested-destination>
<routing-display-size></routing-display-size>
<order-type></order-type>
<time-in-force>
<session></session>
</time-in-force>
<put-call></put-call>
<open-close></open-close>
<strategy></strategy>
<premium></premium>
<action2></action2>
<open-close2></open-close2>
<security2>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description></description>
<asset-type></asset-type>
<exchange></exchange>
</security2>
</order>
</order-wrapper>
</amtd>
Response Fields
XML Type Definitions
Attribute
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
order-wrappe Complex Container for the order information that is being submitted
r
client-order-id String The ID Generated by the client software and submitted with
the order. Used for order matching.
orderstring String The orderstring used to submit this order
error String Error message if an error occurred when placing the order
order Complex Container for detailed information about the order
accountid String The account id in which the order was placed
security Complex Container for detailed information about the OPTION security
for LEG 1
symbol String Contains OPTION symbol for Leg 1. For example,
AMTD_092209P12.5
symbol-with-t String Contains OPTION symbol for Leg 1. For example,
ype-prefix AMTD_092209P12.5
description String Description of the Leg 1 option symbol. For example: AMTD
Sep 22 2009 12.5 Call
asset-type String Type of asset the symbol represents. It is a one character
code: O — Option
exchange String
quantity Double Number of contracts ordered of the first leg of the order
order-id String Unique order number assigned to this order
action String Code indicating the order action requested for Leg 1 of the
order. Values returned are:
B — Buy
S — Sell
(NOTE: Look at the OPEN-CLOSE tag too)
requested-de Complex
stination
routing-mode String
market-make String
r-id
response-des String
cription
routing-displa Integer
y-size
order-type String Values returned are:
D — Net Debit
C — Net Credit
M — Market
limit-price Double
stop-price Double
time-in-force Complex
session String
Request:
https://apis.tdameritrade.com/apps/100/StraddleOptionTrade?orderstring=accountid%3D123456789%
7EsymbolIBM_061910C110%7Eordtype%3Dnet_debit%7Eaction%3Dbuytoopen%7Equantity%3D2%7
Esymbol2IBM_061910C120%7Eaction2%3Dselltoopen%7Eprice%3D3.9%7Eclientorderid%3D1
accountid=123456789~symbol=IBM_061910C110~ordtype=net_debit~action=
buytoopen~quantity=2~symbol2=IBM_061910C120~action2=selltoopen~price
=3.9~clientorderid=1)
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<order-wrapper>
<client-order-id>1</client-order-id>
<orderstring>
accountid=123456789~symbol=IBM_061910C110~ordtype=net_debit~a
ction=buytoopen~quantity=2~symbol2=IBM_061910C120~action2=sellt
oopen~price=3.9~clientorderid=1</orderstring>
<error></error>
<order>
<account-id>123456789</account-id>
<security>
<symbol>IBM_061910C110</symbol>
<symbol-with-type-prefix>IBM_061910C110</symbol-with-type-prefix
>
<description>IBM Jun 19 2010 110.0 Call</description>
<asset-type>O</asset-type>
<exchange>OPR</exchange>
</security>
<quantity>2</quantity>
<order-id>2147607354</order-id>
<action>B</action>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<routing-display-size>0</routing-display-size>
<order-type>D</order-type>
<time-in-force>
<session>D</session>
</time-in-force>
<put-call>C</put-call>
<open-close>O</open-close>
<strategy>Spread</strategy>
<premium>3.90</premium>
<action2>S</action2>
<open-close2>O</open-close2>
<security2>
<symbol>IBM_061910C120</symbol>
<symbol-with-type-prefix>IBM_061910C120</symbol-with-type-prefix
>
<description>IBM Jun 19 2010 120.0 Call</description>
<asset-type>O</asset-type>
<exchange>OPR</exchange>
</security2>
</order>
</order-wrapper>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
<error>Invalid Session</error>
</amtd>
33 StraddleOptionTrade
Service provides the ability to trade complex orders. Unlike OptionTrade, this one is used to
enter a buy or a sell on two options on the same underlying symbol in one transaction.
NOTE: This should not be confused with conditional option orders (where execution of one
order can trigger one or more other orders). Those are implemented separately
Request URL
https://apis.tdameritrade.com/apps/100/StraddleOptionTrade?source=<##SourceID#
>&orderstring=<#ORDERSTRING#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderstring parameters, each one defining one order group being sent.
exyear Two NO
digit
expiratio
n day,
only
specifie
d if
expire is
set to
GTC
otherwis
e null
· action, action2, symbol, symbol2, ordtype, quantity, and accountid are required
parameters
· if action=buytoopen or buytoclose
action2 must be buytoopen or buytoclose
· if action=selltoopen or selltoclose
action2 must be selltoopen or selltoclose
NOTE: the structure of the ORDER section is the same as what you get from OptionTrade
Response
<error></error>
<order>
<account-id></account-id>
<security>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description></description>
<asset-type></asset-type>
<exchange></exchange>
</security>
<quantity></quantity>
<order-id></order-id>
<action></action>
<requested-destination>
<routing-mode></routing-mode>
<option-exchange></option-exchange>
<response-description></response-description>
</requested-destination>
<routing-display-size></routing-display-size>
<order-type></order-type>
<time-in-force>
<session></session>
</time-in-force>
<put-call></put-call>
<open-close></open-close>
<strategy></strategy>
<premium></premium>
<action2></action2>
<open-close2></open-close2>
<security2>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description></description>
<asset-type></asset-type>
<exchange></exchange>
</security2>
</order>
</order-wrapper>
</amtd>
Response Fields
XML Type Definitions
Attribute
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
order-wrappe Complex Container for the order information that is being submitted
r
client-order-id String The ID Generated by the client software and submitted with
the order. Used for order matching.
orderstring String The orderstring used to submit this order
error String Error message if an error occurred when placing the order
order Complex Container for detailed information about the order
accountid String The account id in which the order was placed
security Complex Container for detailed information about the OPTION security
for LEG 1
symbol String Contains OPTION symbol for Leg 1. For example,
AMTD_092209P12.5
symbol-with-t String Contains OPTION symbol for Leg 1. For example,
ype-prefix AMTD_092209P12.5
description String Description of the Leg 1 option symbol. For example: AMTD
Sep 22 2009 12.5 Call
asset-type String Type of asset the symbol represents. It is a one character
code: O — Option
exchange String
quantity Double Number of contracts ordered of the first leg of the order
order-id String Unique order number assigned to this order
action String Code indicating the order action requested for Leg 1 of the
order. Values returned are:
B — Buy
S — Sell
(NOTE: Look at the OPEN-CLOSE tag too)
requested-de Complex
stination
routing-mode String
market-make String
r-id
response-des String
cription
routing-displa Integer
y-size
order-type String Values returned are:
D — Net Debit
C — Net Credit
M — Market
limit-price Double
stop-price Double
time-in-force Complex
session String
Request:
https://apis.tdameritrade.com/apps/100/StraddleOptionTrade?orderstring=accountid%3D123456789%
7Esymbol%3DIBM_071710C110%7Eordtype%3Dnet_debit%7Eaction%3Dbuytoopen%7Equantity%3
D2%7Esymbol2%3DIBM_071710P110%7Eaction2%3Dbuytoopen%7Eprice%3D4.15%7Eclientorderid
%3D1
(Order String is URL Encoded version of
accountid=123456789~symbol=IBM_071710C110~ordtype=net_debit~action=
buytoopen~quantity=2~symbol2=IBM_071710P110~action2=buytoopen~price
=4.15~clientorderid=1)
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<order-wrapper>
<client-order-id>1</client-order-id>
<orderstring>
accountid=123456789~symbol=IBM_071710C110~ordtype=net_debit~a
ction=buytoopen~quantity=2~symbol2=IBM_071710P110~action2=buyt
oopen~price=4.15~clientorderid=1</orderstring>
<error></error>
<order>
<account-id>123456789</account-id>
<security>
<symbol>IBM_071710C110</symbol>
<symbol-with-type-prefix>IBM_071710C110</symbol-with-type-prefix
>
<description>IBM Jul 17 2010 110 Call</description>
<asset-type>O</asset-type>
<exchange>OPR</exchange>
</security>
<quantity>100</quantity>
<order-id>2147607354</order-id>
<action>B</action>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<routing-display-size>0</routing-display-size>
<order-type>D</order-type>
<time-in-force>
<session>D</session>
</time-in-force>
<put-call>C</put-call>
<open-close>O</open-close>
<strategy>Straddle</strategy>
<premium>4.15</premium>
<action2>B</action2>
<open-close2>O</open-close2>
<security2>
<symbol>IBM_071710P110</symbol>
<symbol-with-type-prefix>IBM_071710P110</symbol-with-type-prefix
>
<description>IBM Jul 17 2010 110 Put</description>
<asset-type>O</asset-type>
<exchange>OPR</exchange>
</security2>
</order>
</order-wrapper>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
34 StrangleOptionTrade
Service provides the ability to trade complex orders. Unlike OptionTrade, this one is used to
enter a buy or a sell on two options on the same underlying symbol in one transaction.
NOTE: This should not be confused with conditional option orders (where execution of one
order can trigger one or more other orders). Those are implemented separately
Request URL
https://apis.tdameritrade.com/apps/100/StrangleOptionTrade?source=<##SourceID#
>&orderstring=<#ORDERSTRING#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderstring parameters, each one defining one order group being sent.
exyear Two NO
digit
expiratio
n day,
only
specifie
d if
expire is
set to
GTC
otherwis
e null
· action, action2, symbol, symbol2, ordtype, quantity, and accountid are required
parameters
· if action=buytoopen or buytoclose
action2 must be buytoopen or buytoclose
· if action=selltoopen or selltoclose
action2 must be selltoopen or selltoclose
· the order cannot be a straddle order, i.e. the first and second legs cannot have the
same strike price in the same expiration month
NOTE: the structure of the ORDER section is the same as what you get from OptionTrade
Response
<client-order-id></client-order-id>
<orderstring></orderstring>
<error></error>
<order>
<account-id></account-id>
<security>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description></description>
<asset-type></asset-type>
<exchange></exchange>
</security>
<quantity></quantity>
<order-id></order-id>
<action></action>
<requested-destination>
<routing-mode></routing-mode>
<option-exchange></option-exchange>
<response-description></response-description>
</requested-destination>
<routing-display-size></routing-display-size>
<order-type></order-type>
<time-in-force>
<session></session>
</time-in-force>
<put-call></put-call>
<open-close></open-close>
<strategy></strategy>
<premium></premium>
<action2></action2>
<open-close2></open-close2>
<security2>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description></description>
<asset-type></asset-type>
<exchange></exchange>
</security2>
</order>
</order-wrapper>
</amtd>
Response Fields
XML Type Definitions
Attribute
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
order-wrappe Complex Container for the order information that is being submitted
r
client-order-id String The ID Generated by the client software and submitted with
the order. Used for order matching.
orderstring String The orderstring used to submit this order
error String Error message if an error occurred when placing the order
order Complex Container for detailed information about the order
accountid String The account id in which the order was placed
security Complex Container for detailed information about the OPTION security
for LEG 1
symbol String Contains OPTION symbol for Leg 1. For example,
AMTD_092209P12.5.
symbol-with-t String Contains OPTION symbol for Leg 1. For example,
ype-prefix AMTD_092209P12.5.
description String Description of the Leg 1 option symbol. For example: AMTD
Sep 22 2009 12.5 Call
asset-type String Type of asset the symbol represents. It is a one character
code: O — Option
exchange String
quantity Double Number of contracts ordered of the first leg of the order
order-id String Unique order number assigned to this order
action String Code indicating the order action requested for Leg 1 of the
order. Values returned are:
B — Buy
S — Sell
(NOTE: Look at the OPEN-CLOSE tag too)
requested-de Complex
stination
routing-mode String
market-make String
r-id
response-des String
cription
routing-displa Integer
y-size
order-type String Values returned are:
D — Net Debit
C — Net Credit
M — Market
limit-price Double
stop-price Double
time-in-force Complex
session String
Request:
https://apis.tdameritrade.com/apps/100/StrangleOptionTrade?orderstring=accountid%3D123456789%
7EsymbolIBM_061910C110%7Eordtype%3Dnet_credit%7Eaction%3Dselltoopen%7Equantity%3D100
%7Esymbol2IBM_061910P100%7Eaction2%3Dselltoopen%7Eprice%3D3.7%7Eclientorderid%3D1
(Order String is URL Encoded version of
accountid=123456789~symbol=IBM_061910C110~ordtype=net_credit~action
=selltoopen~quantity=100~symbol2=IBM_061910P100~action2=selltoopen~p
rice=3.7~clientorderid=1)
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<order-wrapper>
<client-order-id>1</client-order-id>
<orderstring>
accountid=123456789~symbol=IBM_061910C110~ordtype=net_credit~
action=selltoopen~quantity=100~symbol2=IBM_061910P100~action2=s
elltoopen~price=3.7~clientorderid=1</orderstring>
<error></error>
<order>
<account-id>123456789</account-id>
<security>
<symbol>IBM_061910C110</symbol>
<symbol-with-type-prefix>IBM_061910C110</symbol-with-type-prefix
>
<description>IBM Jun 19 2010 110.0 Call</description>
<asset-type>O</asset-type>
<exchange>OPR</exchange>
</security>
<quantity>100</quantity>
<order-id>2147694954</order-id>
<action>S</action>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<routing-display-size>0</routing-display-size>
<order-type>C</order-type>
<time-in-force>
<session>D</session>
</time-in-force>
<put-call>C</put-call>
<open-close>O</open-close>
<strategy>Strangle</strategy>
<premium>3.70</premium>
<action2>S</action2>
<open-close2>O</open-close2>
<security2>
<symbol>IBM_061910P100</symbol>
<symbol-with-type-prefix>IBM_061910P100</symbol-with-type-prefix
>
<description>IBM Jun 19 2010 100.0 Put</description>
<asset-type>O</asset-type>
<exchange>OPR</exchange>
</security2>
</order>
</order-wrapper>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
<amtd>
<result>FAIL</result>
<error>Invalid Session</error>
</amtd>
35 ComboOptionTrade
Service provides the ability to trade complex orders. Unlike the other complex option order
commands (BuyWrite, Straddle, etc), This one will accept any two option legs without
specifying the strategy
NOTE: This should not be confused with conditional option orders (where execution of one
order can trigger one or more other orders). Those are implemented separately
Request URL
https://apis.tdameritrade.com/apps/100/ComboOptionTrade?source=<##SourceID#
>&orderstring=<#ORDERSTRING#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderstring parameters, each one defining one order group being sent.
exyear Two NO
digit
expiratio
n day,
only
specifie
d if
expire is
set to
GTC
otherwis
e null
NOTE: the structure of the ORDER section is the same as what you get from OptionTrade
Response
<quantity></quantity>
<order-id></order-id>
<action></action>
<requested-destination>
<routing-mode></routing-mode>
<option-exchange></option-exchange>
<response-description></response-description>
</requested-destination>
<routing-display-size></routing-display-size>
<order-type></order-type>
<time-in-force>
<session></session>
</time-in-force>
<put-call></put-call>
<open-close></open-close>
<premium></premium>
<action2></action2>
<open-close2></open-close2>
<security2>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description></description>
<asset-type></asset-type>
<exchange></exchange>
</security2>
</order>
</order-wrapper>
</amtd>
Response Fields
XML Type Definitions
Attribute
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
order-wrappe Complex Container for the order information that is being submitted
r
client-order-id String The ID Generated by the client software and submitted with
the order. Used for order matching.
orderstring String The orderstring used to submit this order
error String Error message if an error occurred when placing the order
order Complex Container for detailed information about the order
accountid String The account id in which the order was placed
security Complex Container for detailed information about the OPTION security
for LEG 1
symbol String Contains OPTION symbol for Leg 1. For example,
AMTD_092209P12.5.
market-make String
r-id
response-des String
cription
routing-displa Integer
y-size
order-type String Values returned are:
D — Net Debit
C — Net Credit
M — Market
limit-price Double
stop-price Double
time-in-force Complex
session String
put-call String P or C depending if the Leg 1 OPTION order is a Put or a Call
open-close String O or C depending if the Leg 1 OPTION order is to Open or
Close
premium String
Code indicating the order action requested for Leg 2 of the
order. Values returned are:
action2 String B — Buy
S — Sell
(NOTE: Look at the OPEN-CLOSE2 tag too)
O or C depending if the Leg 2 OPTION order is to Open or
open-close2 String
Close
Request:
https://apis.tdameritrade.com/apps/100/ComboOptionTrade?orderstring=accountid%3D123456789%7
Esymbol%3DIBM_091010C120%7Eordtype%3Dnet_debit%7Eaction%3Dbuytoopen%7Equantity%3D
10%7Esymbol2%3DIBM_081010P110%7Eaction2%3Dbuytoopen%7Eprice%3D3.5%7Eclientorderid
%3D1
(Order String is URL Encoded version of
accountid=123456789~symbol=IBM_091010C120~ordtype=net_debit~action=
buytoopen~quantity=10~symbol2=IBM_081010P110~action2=buytoopen~pric
e=3.5~clientorderid=1)
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<order-wrapper>
<client-order-id>1</client-order-id>
<orderstring>
accountid=123456789~symbol=IBM_091010C120~ordtype=net_debit~a
ction=buytoopen~quantity=10~symbol2=IBM_20100810P110~action2=
buytoopen~price=3.5~clientorderid=1</orderstring>
<error></error>
<order>
<account-id>123456789</account-id>
<security>
<symbol>IBM_091010C120</symbol>
<symbol-with-type-prefix>IBM_091010C120</symbol-with-type-prefix
>
<description>IBM Sep 10 2010 120.0 Call</description>
<asset-type>O</asset-type>
<exchange>OPR</exchange>
</security>
<quantity>10</quantity>
<order-id>1234567890</order-id>
<action>B</action>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<routing-display-size>0</routing-display-size>
<order-type>D</order-type>
<time-in-force>
<session>D</session>
</time-in-force>
<put-call>C</put-call>
<open-close>O</open-close>
<premium>3.50</premium>
<action2>B</action2>
<open-close2>O</open-close2>
<security2>
<symbol>IBM_081010P110</symbol>
<symbol-with-type-prefix>IBM_081010P110</symbol-with-type-prefix
>
<description>IBM Aug 10 2010 110.0 Put</description>
<asset-type>O</asset-type>
<exchange>OPR</exchange>
</security2>
</order>
</order-wrapper>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
<error>Your order was not accepted. Funds are not available for this
transaction of a non-marginable security. </error>
</order-wrapper>
</amtd>
36 MultiLegOptionTrade
Service provides the ability to trade complex orders. Unlike other complex option order
commands (BuyWrite, Straddle, etc), this will accept multiple option legs.
NOTE: This should not be confused with conditional option orders (where execution of one
order can trigger one or more other orders). Those are implemented separately.
Request URL
https://apis.tdameritrade.com/apps/100/MultiLegOptionTrade?source=<##SourceID#
>&message=<#messagexml#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
message parameters, each one defining one order group being sent.
<action></action>
<requested-destination>
<routing-mode></routing-mode>
<option-exchange></option-exchange>
<response-description></response-description>
</requested-destination>
<routing-display-size></routing-display-size>
<order-type></order-type>
<limit-price> </limit-price>
<stop-price> </stop-price>
<time-in-force>
<session></session>
</time-in-force>
<put-call></put-call>
<open-close></open-close>
<premium></premium>
<legs>
<order-leg>
<action></action>
<quantity></quantity>
<open-close></open-close>
<security>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description/>
<asset-type></asset-type>
</security>
</order-leg>
<order-leg>
<action></action>
<quantity></quantity>
<open-close></open-close>
<security>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description/>
<asset-type>O</asset-type>
</security>
</order-leg>
</legs>
</order>
</order-wrapper>
</amtd>
Response Fields
XML Type Definitions
Attribute
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
order-wrappe Complex Container for the order information that is being submitted
r
client-order-id String The ID Generated by the client software and submitted with
the order. Used for order matching.
order Complex Container for detailed information about the order
accountid String The account id in which the order was placed
symbol String Contains OPTION symbol. For example,
AMTD_092210P12.5.
security Complex Container for detailed information about the OPTION security
for LEG 1
symbol-with-t String Contains OPTION symbol. For example,
ype-prefix AMTD_092210P12.5.
description String Description of the OPTION symbol. For example: AMTD Sep
22 2010 12.5 Call
asset-type String Type of asset the symbol represents. It is a one character
code: O — Option
exchange String
quantity Double Number of contracts ordered of the first leg of the order
order-id String Unique order number assigned to this order
action String Code indicating the order action requested for Leg 1 of the
order. Values returned are:
B — Buy
S — Sell
(NOTE: Look at the OPEN-CLOSE tag too)
requested-de Complex
stination
routing-mode String
optionexchan
ge
response-des String
cription
routing-displa Integer
y-size
order-type String Values returned are:
D — Net Debit
C — Net Credit
M — Market
limit-price Double
stop-price Double
time-in-force Complex
session String
Request:
https://apis.tdameritrade.com/apps/100/MultiLegOptionTrade
POSTED DATA:
source=<##SourceID#>&message=<#messagexml#>
<complex-option-order-request>
<account-id>123456789</account-id>
<strategy>Butterfly</strategy>
<order-type>net_debit</order-type>
<price>3.00</price>
<client-order-id>1</client-order-id>
<expiration>day</expiration>
<legs>
<order-leg>
<symbol>IBM_061910C85</symbol>
<action>buytoopen</action>
<quantity>1</quantity>
<asset-type>O</asset-type>
</order-leg>
<order-leg>
<symbol>IBM_061910C115</symbol>
<action>selltoopen</action>
<quantity>2</quantity>
<asset-type>O</asset-type>
</order-leg>
<order-leg>
<symbol>IBM_061910C140</symbol>
<action>buytoopen</action>
<quantity>1</quantity>
<asset-type>O</asset-type>
</order-leg>
</legs>
</complex-option-order-request>
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<order-wrapper>
<client-order-id>4196530660</client-order-id>
<request>
<complex-option-order-request>
<account-id>123456789</account-id>
<strategy>Butterfly</strategy>
<order-type>net_debit</order-type>
<price>3.00</price>
<client-order-id>1</client-order-id>
<expiration>D</expiration>
<legs>
<order-leg>
<symbol>IBM_061910C85</symbol>
<action>buytoopen</action>
<quantity>1</quantity>
<asset-type>O</asset-type>
</order-leg>
<order-leg>
<symbol>IBM_061910C115</symbol>
<action>selltoopen</action>
<quantity>2</quantity>
<asset-type>O</asset-type>
</order-leg>
<order-leg>
<symbol>IBM_061910C140</symbol>
<action>buytoopen</action>
<quantity>1</quantity>
<asset-type>O</asset-type>
</order-leg>
</legs>
</complex-option-order-request>
</request>
<order>
<account-id>123456789</account-id>
<symbol>IBM_061910C85</symbol>
<security>
<symbol>IBM_061910C85</symbol>
<symbol-with-type-prefix>IBM_061910C85</symbol-with-type-prefix>
<description>IBM Jun 19 2010 85.0 Call</description>
<asset-type>O</asset-type>
<exchange>OPRA</exchange>
</security>
<quantity>1</quantity>
<order-id>4196530660</order-id>
<action>B</action>
<requested-destination>
<routing-mode>SMART</routing-mode>
<option-exchange>Auto</option-exchange>
<response-description>AutoRoute</response-description>
</requested-destination>
<routing-display-size>0</routing-display-size>
<order-type>D</order-type>
<limit-price> </limit-price>
<stop-price> </stop-price>
<time-in-force>
<session>Day</session>
</time-in-force>
<put-call>C</put-call>
<open-close>O</open-close>
<premium>3.00</premium>
<legs>
<order-leg>
<action>S</action>
<quantity>2.0</quantity>
<open-close>O</open-close>
<security>
<symbol>IBM_061910C115</symbol>
<symbol-with-type-prefix>IBM_061910C115</symbol-with-type-prefix
>
<description>IBM Jun 19 2010 115.0 Call</description>
<asset-type>O</asset-type>
</security>
</order-leg>
<order-leg>
<action>B</action>
<quantity>1.0</quantity>
<open-close>O</open-close>
<security>
<symbol>IBM_061910C140</symbol>
<symbol-with-type-prefix>IBM_061910C140</symbol-with-type-prefix
>
<description>IBM Jun 19 2010 140.0 Call </description>
<asset-type>O</asset-type>
</security>
</order-leg>
</legs>
</order>
</order-wrapper>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
Request URL
https://apis.tdameritrade.com/apps/100/SavedOrders?source=<#sourceID#>
Parameters
The only parameter required is the source assigned by TD Ameritrade. You can also specify
the account id for which the data is to be returned
Response Fields
XML Attribute Type Definitions
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
savedorder-list Complex Container for all saved order entries being returned for the
account
account-id String
savedorder Complex Contains all the fields for one saved order
action String Order action
activation-price Float The stop price for stop market or stop limit orders
asset-type String Type of asset the symbol represents. It is a one character
code where:
E — Equity or ETF
F — Mutual Fund
O — Option
B — Bond
date-saved String The date this order was saved
display-size Integer Integer value 100 or higher, in increments of 100
expiration-day Integer Two digit expiration day, only specified if expire is set to gtc
otherwise
expiration-month Integer Two digit expiration month, only specified if expire is set to
gtc otherwise null.
expiration-year Integer Two digit expiration year, only specified if expire is set to gtc
otherwise null.
id Integer the unique ID of the saved order
order--type Order Type string
String
price Float Limit price for limit or stop limit orders otherwise null
quantity Float The number of shares being bought or sold in the
transaction
routing User specified order routing destination. Default is auto
stop-param Float Trailing Stop parameter in dollars or percent depending on
order type otherwise null.
symbol String Symbol being bought or sold. UPPER CASE
description String
special-conditions String Special Instructions for the order execution. Set to none if
not specified
time-in-force String The time in force for the order
dividend-reinvest Boolean true/false
capital-gains-reinv Boolean true/false
est
Request:
https://apis.tdameritrade.com/apps/100/SavedOrders?source=<#sourceID#>
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<savedorder-list>
<account-id>123456789</account-id>
<saved-order>
<action>BUY</action>
<activation-price> </activation-price>
<asset-type>E</asset-type>
<date-saved>2008-05-19 22:40:29 EST</date-saved>
<display-size>0</display-size>
<id>23299</id>
<order-type>LIMIT</order-type>
<price>43.01</price>
<quantity>70</quantity>
<routing>AUTO</routing>
<stop-param></stop-param>
<symbol>CVS</symbol>
<description></description>
<time-in-force>DAY</time-in-force>
<dividend-reinvest></dividend-reinvest>
<capital-gains-reinvest></capital-gains-reinvest>
</saved-order>
<saved-order>
<action>BUY</action>
<activation-price> </activation-price>
<asset-type>E</asset-type>
<date-saved>2008-05-19 22:51:31 EST</date-saved>
<display-size>0</display-size>
<expiration-day>1</expiration-day>
<expiration-month>11</expiration-month>
<expiration-year>2008</expiration-year>
<id>23300</id>
<order-type>LIMIT</order-type>
<price>43.01</price>
<quantity>70</quantity>
<routing>AUTO</routing>
<stop-param></stop-param>
<symbol>CVS</symbol>
<description></description>
<special-conditions>CVS</special-conditions>
<time-in-force>GTC_EXT</time-in-force>
<underlying-symbol>CVS</underlying-symbol>
<dividend-reinvest></dividend-reinvest>
<capital-gains-reinvest></capital-gains-reinvest>
</saved-order>
<saved-order>
<action>SELL</action>
<activation-price>2.00</activation-price>
<asset-type>E</asset-type>
<date-saved>2008-05-19 22:53:27 EST</date-saved>
<display-size>0</display-size>
<id>23301</id>
<order-type>TSTOPDOLLAR</order-type>
<price></price>
<quantity>70</quantity>
<routing>AUTO</routing>
<stop-param>2.00</stop-param>
<symbol>CVS</symbol>
<description></description>
<time-in-force>DAY</time-in-force>
<dividend-reinvest></dividend-reinvest>
<capital-gains-reinvest></capital-gains-reinvest>
</saved-order>
</savedorder-list>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Not a valid account for this user.</error>
</amtd>
38 SaveEquityTrade
Service provides the ability to Save an Equity Trade order on the servers for use in the
future. Refer to SavedOrders command for retrieving saved orders.
Request URL
https://apis.tdameritrade.com/apps/100/SaveEquityTrade?source=<##SourceID#
>&orderstring=<#ORDERSTRING#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderstring parameters, each one defining one order being saved. The orderstring
parameter is exactly the same as what is used for the EquityTrade command.
NOTE: The accountid is specified inside the orderstring, not as a separate parameter
Response Fields
XML Attribute Name Type Definitions
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
saved-order-wrapper Complex Container for the order information that is being submitted
orderstring String The orderstring used to submit this order
error String Error message if an error occurred when placing the order
order-saved String true if successfully saved, false otherwise
Request:
https://apis.tdameritrade.com/apps/100/SaveEquityTrade?source=<#sourceID#
>&orderstring=action%3Dbuy%7Equantity%3D400%7Esymbol%3DDELL%7Eordtype%3DLimit%7
Eprice%3D27.49%7Eactprice%3D%7Etsparam%3D%7Eexpire%3Dday%7Espinstructions%3Dnon
e%7Erouting%3Dauto%7Edisplaysize%3D%7Eexmonth%3D%7Eexday%3D%7Eexyear%3D%7Ea
ccountid%3D123456789
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<saved-order-wrapper>
<orderstring>
action=buy~quantity=400~symbol=DELL~ordtype=Limit~price=27.49~
actprice=~tsparam=~expire=day~spinstructions=none~routing=auto~d
isplaysize=~exmonth=~exday=~exyear=~accountid=123456789
</orderstring>
<error></error>
<saved-order>true</saved-order>
</saved-order-wrapper>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<saved-order-wrapper>
<orderstring>
action=buy~quantity=400~symbol=DELL~ordtype=Limit~price=27.49~
actprice=~tsparam=~expire=day~spinstructions=none~routing=auto~d
isplaysize=~exmonth=~exday=~exyear=~accountid=123456789
</orderstring>
<error>Not a valid account for this user</error>
<saved-order>false</saved-order>
</saved-order-wrapper>
</amtd>
<result>FAIL</result>
<error>Invalid Session</error>
</amtd>
39 SaveOptionTrade
Service provides the ability to Save an Option Trade order on the servers for use in the
future. Refer to SavedOrders command for retrieving saved orders.
Request URL
https://apis.tdameritrade.com/apps/100/SaveOptionTrade?source=<##SourceID#
>&orderstring=<#ORDERSTRING#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderstring parameters, each one defining one order being saved. The orderstring
parameter is exactly the same as what is used for the OptionTrade command.
NOTE: The accountid is specified inside the orderstring, not as a separate parameter
Response Fields
XML Attribute Type Definitions
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
saved-order-wrappe Complex Container for the order information that is being submitted
r
orderstring String The orderstring used to submit this order
error String Error message if an error occurred when placing the order
order-saved String true if successfully saved, false otherwise
Request:
https://apis.tdameritrade.com/apps/100/SaveOptionOrder?source=<#sourceID#
>&orderstring=action%3Dselltoclose%7Equantity%3D10%7Esymbol%3D%2BIBM_061910C85%7
Eordtype%3DLimit%7Eprice%3D6.3%7Eactprice%3D%7Eexpire%3Dday%7Espinstructions%3Dno
ne%7Erouting%3Dauto%7Eexmonth%3D%7Eexday%3D%7Eexyear%3D%7Etabid%3D0%7Eacco
untid%3D123456789
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<saved-order-wrapper>
<orderstring>action=selltoclose~quantity=10~symbol=IBM_061910C85
~ordtype=Limit~price=6.3~actprice=~expire=day~spinstructions=none~routin
g=auto~exmonth=~exday=~exyear=~tabid=0~accountid=123456789
</orderstring>
<error></error>
<saved-order>true</saved-order>
</saved-order-wrapper>
</amtd>
Possible Errors
If the Account ID specified is not valid you will get
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<saved-order-wrapper>
<orderstring>action=selltoclose~quantity=10~symbol=IBM_20071010C85
~ordtype=Limit~price=6.3~actprice=~expire=day~spinstructions=none
~routing=auto~exmonth=~exday=~exyear=~tabid=0~accountid=1234
56789
</orderstring>
<error>Not a valid account for this user</error>
<saved-order>false</saved-order>
</saved-order-wrapper>
</amtd>
40 DeleteSavedOrders
Service provides the ability to delete one or more previously saved orders.
Request URL
https://apis.tdameritrade.com/apps/100/DeleteSavedOrders?source=<#SourceID#>&orderid=<
#order-id#>&orderid=<#order-id#>
Request Parameters
The request must contain the source assigned by TD Ameritrade as well as one or more
orderid parameters for previously saved orders
Response Fields
XML Attribute Type Definitions
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
Request:
https://apis.tdameritrade.com/apps/100/DeleteSavedOrders?source=<#sourceID#
>&orderid=21481399&orderid=21479999&orderid=21479448
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<deleted-savedorder-list>
<account-id>123456789</account-id>
<deleted-saved-order>
<id>2148881399</id>
</deleted-saved-order>
<deleted-saved-order>
<id>2147949999</id>
</deleted-saved-order>
<deleted-saved-order>
<id>2147949948</id>
</deleted-saved-order>
</deleted-savedorder-list>
</amtd>
Possible Errors
If the session is invalid, you will get
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Invalid Session</error>
</amtd>
if the order was closed or could not be found, or a cancel for a conditional order was
submitted, you will get the following errors:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<cancel-order-messages>
<account-id>123456789</account-id>
<order>
<order-id>2147949999</order-id>
<message></message>
<error>The order could not found. Please check its status.</error>
</order>
<order>
<order-id>2147949948</order-id>
<message></message>
<error>Conditional orders cannot be cancelled through this interface.</
error>
</order>
</cancel-order-messages>
</amtd>
41 GetWatchlists
This service provides a way to view the previously saved WatchLists
Request URL
https://apis.tdameritrade.com/apps/100/GetWatchlists?source=<#sourceID#>
Parameters
The only parameter required is the source assigned by TD Ameritrade. Other parameters
are available
Response Fields
XML Attribute Type Definitions
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
watchlist-list Comple Container for all WatchList entries being returned
x
error String Error string in case of an error
account-id String
watchlist Comple Contains all the fields for one watchlist
x
name String The name assigned to the given watchlist
id Integer Numeric ID that identifies the watchlist
symbol-list Comple Container for all the symbols in the watchlist
x
watched-symbol Comple Container for one symbol in the watchlist
x
quantity Double Number of units in the position. Field may have up to 3 digits
to the right of the decimal point.
security Comple Container for detailed information about the security.
x
symbol String Contains symbol. For example, AMTD.
symbol-with-type-p String
refix
description String Contains a description of the symbol. For example "TD
AMERITRADE HLDG CORP COM"
asset-type String Type of asset the symbol represents. It is a one character
code where:
E — Equity or ETF
F — Mutual Fund
O — Option
B — Bond
position-type String LONG or SHORT
average-price Double Contains the value calculated by dividing the total cost to
acquire the position by the number of units in the position. The
field may contain up to six digits to the right of the decimal
point.
commission Double
open-date String Date the "position" was opened
Request:
https://apis.tdameritrade.com/apps/100/GetWatchlists?source=<#sourceID#>
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<watchlist-result>
<error></error>
<account-id>123456789</account-id>
<watchlist>
<name>Sample WatchList 1</name>
<id>1234561</id>
<symbol-list>
<watched-symbol>
<quantity>0</quantity>
<security>
<symbol>BBBY</symbol>
<symbol-with-type-prefix>BBBY</symbol-with-type-prefix>
<description>BED BATH & BEYOND INC COM</description>
<asset-type>E</asset-type>
</security>
<position-type>LONG</position-type>
<average-price>0</average-price>
<commission>0</commission>
</watched-symbol>
</symbol-list>
</watchlist>
<watchlist>
<name>Some Other Test</name>
<id>1234562</id>
<symbol-list>
<watched-symbol>
<quantity>100</quantity>
<security>
<symbol>DELL</symbol>
<symbol-with-type-prefix>DELL</symbol-with-type-prefix>
<description>DELL INC COM</description>
<asset-type>E</asset-type>
</security>
<position-type>LONG</position-type>
<average-price>11.11</average-price>
<commission>10</commission>
<open-date>01-11-2008</open-date>
</watched-symbol>
<watched-symbol>
<quantity>2</quantity>
<security>
<symbol>INTC</symbol>
<symbol-with-type-prefix>INTC</symbol-with-type-prefix>
<description>INTEL CORP COM</description>
<asset-type>E</asset-type>
</security>
<position-type>LONG</position-type>
<average-price>12.12</average-price>
<commission>20</commission>
<open-date>02-22-2006</open-date>
</watched-symbol>
<watched-symbol>
<quantity>3</quantity>
<security>
<symbol>T</symbol>
<symbol-with-type-prefix>T</symbol-with-type-prefix>
<description>AT&T INC COM</description>
<asset-type>E</asset-type>
</security>
<position-type>LONG</position-type>
<average-price>13.13</average-price>
<commission>30</commission>
<open-date>03-30-2007</open-date>
</watched-symbol>
</symbol-list>
</watchlist>
</watchlist-result>
</amtd>
Possible Errors
If an invalid listid is specified
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Watchlist id not found.</error>
</amtd>
42 CreateWatchlist
This service provides a way to create new Watchlists containing one or more entries. Each
entry consists of a symbol, quantity, price, Purchase Month, Day, Year, and commission. All
entries other than symbol can be null.
Request URL
https://apis.tdameritrade.com/apps/100/CreateWatchlist?source=<#sourceID#
>&watchlistname=<#PortfolioName#>&symbollist=<#SymbolList#>
Parameters
You must specify the watchlistname and symbollist parameters, with at least one symbol,
as well as the source assigned by TD Ameritrade. Other parameters are available
The Watchlist can contain one or more entries. Each entry consists of a symbol, quantity,
price, Purchase Month, Day, Year, and commission. All entries other than symbol can be
null. When creating the Watchlist, you need to specify a list values for all entries for each of
the fields. Unspecified entries will be added as null values. So if you want to create a
Watchlist with the following entries:
Symbol: DELL Quantity: 100 Purchase Date 02/21/2008 Price Paid: 20.23
Commission: 9.99
Symbol: ABCD Quantity: 200 Purchase Date 02/22/2008 Price Paid: 23.68
Symbol: EFGH Quantity: 300 Purchase Date 02/23/2008 Price Paid: 10.82
Commission: 9.99
Symbol: IBM Quantity: 400
Symbol: XYZ
watchlistname=Some+Portfolio+Name+Example
symbollist=DELL,ABCD,EFGH,IBM,ZYZ
quantitylist=100,200,300,400
monthlist=2,2,2
daylist=21,22,23
yearlist=2008,2008,2008
pricelist=20.23,23.68,10.82
commissionlist=9.99,,9.99
NOTE: All the list parameters are comma delimited with no spaces
NOTE: that a null entry is added in the commissionlist. A zero could have been used as well
</amtd>
Response Fields
XML Attribute Type Definitions
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
create-watchlist-re Comple Container for the Result of the CreateWatchlist command
sult x being returned
error String Error string in case of an error
account-id String
created-watchlist Comple Contains all the fields for the watchlist that was created
x
NOTE: The rest of the fields are exactly the same as contained inside the watchlist tag in
the result from the GetWatchLists command
name String The name assigned to the given watchlist
id Integer Numeric ID that identifies the watchlist
symbol-list Comple Container for all the symbols in the watchlist
x
watched-symbol Comple Container for one symbol in the watchlist
x
quantity Double Number of units in the position. Field may have up to 3 digits
to the right of the decimal point.
security Comple Container for detailed information about the security.
x
symbol Contains symbol. For example, AMTD.
symbol-with-type-p
refix
description Contains a description of the symbol. For example "TD
AMERITRADE HLDG CORP COM"
asset-type String Type of asset the symbol represents. It is a one character
code where:
E — Equity or ETF
F — Mutual Fund
O — Option
B — Bond
position-type String LONG or SHORT
average-price Double Contains the value calculated by dividing the total cost to
acquire the position by the number of units in the position. The
field may contain up to six digits to the right of the decimal
point.
commission Double
open-date String Date the "position" was opened
Request:
https://apis.tdameritrade.com/apps/100/CreateWatchlist?source=<#sourceID#
>&watchlistname=<#PortfolioName#>&symbollist=<#SymbolList#>
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<create-watchlist-result>
<error></error>
<account-id>123456789</account-id>
<created-watchlist>
<name>Some Portfolio Name Example</name>
<id>1234567</id>
<symbol-list>
<watched-symbol>
<quantity>100</quantity>
<security>
<symbol>DELL</symbol>
<symbol-with-type-prefix>DELL</symbol-with-type-prefix>
<description>DELL INC COM</description>
<asset-type>E</asset-type>
</security>
<position-type>LONG</position-type>
<average-price>20.23</average-price>
<commission>9.99</commission>
<open-date>2-21-2008</open-date>
</watched-symbol>
<watched-symbol>
<quantity>200</quantity>
<security>
<symbol>ABCD</symbol>
<symbol-with-type-prefix>ABCD</symbol-with-type-prefix>
<description> </description>
<asset-type>E</asset-type>
</security>
<position-type>LONG</position-type>
<average-price>23.68</average-price>
<commission>0</commission>
<open-date>2-22-2008</open-date>
</watched-symbol>
<watched-symbol>
<quantity>300</quantity>
<security>
<symbol>EFGH</symbol>
<symbol-with-type-prefix>EFGH</symbol-with-type-prefix>
<description> </description>
<asset-type>E</asset-type>
</security>
<position-type>LONG</position-type>
<average-price>10.82</average-price>
<commission>9.99</commission>
<open-date>2-23-2008</open-date>
</watched-symbol>
<watched-symbol>
<quantity>400</quantity>
<security>
<symbol>IBM</symbol>
<symbol-with-type-prefix>IBM</symbol-with-type-prefix>
<description>INTERNATIONAL BUSINESS MACHS COM</
description>
<asset-type>E</asset-type>
</security>
<position-type>LONG</position-type>
<average-price>0</average-price>
<commission>0</commission>
</watched-symbol>
<watched-symbol>
<quantity>0</quantity>
<security>
<symbol>ZYZ</symbol>
<symbol-with-type-prefix>ZYZ</symbol-with-type-prefix>
<description> </description>
<asset-type>E</asset-type>
</security>
<position-type>LONG</position-type>
<average-price>0</average-price>
<commission>0</commission>
</watched-symbol>
</symbol-list>
</created-watchlist>
</create-watchlist-result>
</amtd>
Possible Errors
If one of the numeric parameter lists has a non-numeric value, you will get get the following
error, with the given parameter filled in
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Invalid value passed in parameter_name request parameter.</error>
</amtd>
if there was an error while trying to perform the save of a new watchlist, provided an more
explicit error is not returned.
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
if the watchlist being created has the same name as an existing watchlist.
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Error requested watchlist name already in use.</error>
</amtd>
43 EditWatchlist
This service provides a way to Edit a previously saved Watchlist
Request URL
https://apis.tdameritrade.com/apps/100/EditWatchlist?source=<#sourceID#>&listid=<
#ListID#>&symbollist=<#SymbolList#>
Parameters
You must specify the listid and symbollist parameters, with at least one symbol, as well as
the source assigned by TD Ameritrade. Other parameters are available
When editing the Watchlist, you need to specify the new values for all the entries in the
watchlist. You identify the watchlist being edited with the listid parameter that you get from
the GetWatchlists command. The rest of the parameters are the same as in the
CreateWatchlist command
<edit-watchlist-result>
<account-id></account-id>
<edited-atchlist>
<name></name>
<id></id>
<symbol-list>
<watched-symbol>
<quantity></quantity>
<security>
<symbol></symbol>
<symbol-with-type-prefix></symbol-with-type-prefix>
<description></description>
<asset-type></asset-type>
</security>
<position-type></position-type>
<average-price></average-price>
<commission></commission>
<open-date></open-date>
</watched-symbol>
.....
</symbol-list>
</edited-atchlist>
</edit-watchlist-result>
</amtd>
Response Fields
XML Attribute Type Definitions
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
edit-watchlist-list Comple Container for the Result of the EditWatchlist command being
x returned
account-id String
edited-watchlist Comple Contains all the fields for the edited watchlist
x
NOTE: The rest of the fields are exactly the same as contained inside the watchlist tag in
the result from the GetWatchLists command
name String The name assigned to the given watchlist
id Integer Numeric ID that identifies the watchlist
symbol-list Comple Container for all the symbols in the watchlist
x
watched-symbol Comple Container for one symbol in the watchlist
x
quantity Double Number of units in the position. Field may have up to 3 digits
to the right of the decimal point.
security Comple Container for detailed information about the security.
x
Request:
https://apis.tdameritrade.com/apps/100/EditWatchlist?source=<#sourceID#>&listid=<
#ListID#>&symbollist=<#SymbolList#>
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<edit-watchlist-result>
<error></error>
<account-id>123456789</account-id>
<edited-watchlist>
<name>Some Other Test</name>
<id>1234567</id>
<symbol-list>
<watched-symbol>
<quantity>100</quantity>
<security>
<symbol>DELL</symbol>
<symbol-with-type-prefix>DELL</symbol-with-type-prefix>
<description>DELL INC COM</description>
<asset-type>E</asset-type>
</security>
<position-type>LONG</position-type>
<average-price>11.11</average-price>
<commission>10</commission>
<open-date>01-11-2008</open-date>
</watched-symbol>
<watched-symbol>
<quantity>2</quantity>
<security>
<symbol>INTC</symbol>
<symbol-with-type-prefix>INTC</symbol-with-type-prefix>
<description>INTEL CORP COM</description>
<asset-type>E</asset-type>
</security>
<position-type>LONG</position-type>
<average-price>12.12</average-price>
<commission>20</commission>
<open-date>02-22-2006</open-date>
</watched-symbol>
<watched-symbol>
<quantity>3</quantity>
<security>
<symbol>T</symbol>
<symbol-with-type-prefix>T</symbol-with-type-prefix>
<description>AT&T INC COM</description>
<asset-type>E</asset-type>
</security>
<position-type>LONG</position-type>
<average-price>13.13</average-price>
<commission>30</commission>
<open-date>03-30-2007</open-date>
</watched-symbol>
</symbol-list>
</edited-watchlist>
</edit-watchlist-result>
</amtd>
Possible Errors
If one of the numeric parameter lists has a non-numeric value, you will get get the following
error, with the given parameter filled in
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Invalid value passed in parameter_name request parameter.</error>
</amtd>
if there was an error while trying to perform the save of the watchlist, provided an more
explicit error is not returned.
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Error creating watchlist.</error>
</amtd>
44 DeleteWatchlist
This service provides a way to delete a previously saved WatchList
Request URL
https://apis.tdameritrade.com/apps/100/DeleteWatchlist?source=<#sourceID#>&listid=<
#ListID#>
Parameters
You must specify the listid parameter, as well as the source assigned by TD Ameritrade.
Response Fields
XML Attribute Type Definitions
Name
result String Contains the overall result for the request.
OK - indicates the request was successful
FAIL - indicates the request was unsuccessful.
Request:
https://apis.tdameritrade.com/apps/100/DeleteWatchlist?source=<#sourceID#>&listid=<
#ListID#>
Response:
<?xml version="1.0" ?>
<amtd>
<result>OK</result>
<delete-watchlist-result>
<error></error>
<account-id>123456789</account-id>
<deleted-watchlist>
<name>Sample WatchList 1</name>
<id>1234567</id>
</deleted-watchlist>
</delete-watchlist-result>
</amtd>
Possible Errors
if there was an error while trying to perform the command, provided an more explicit error is
not returned.
<?xml version="1.0" ?>
<amtd>
<result>FAIL</result>
<error>Error creating watchlist.</error>
</amtd>
45 Streaming Data
This section provides the API and protocol needed to communicate with the Streamer
Server.
Structural Specification
The data requests is made in the context of a valid session where the user has successfully
logged into the TD Ameritrade Trading Platform.
The streaming server responds with continuous data in binary format. When the end of each
segment is encountered it is followed by the next segment
Some data may be compressed. It will be indicated as such in the documentation. When
the data is compressed, standard GZIP deflate/inflate is used. The server performs
DEFLATE and the client conducts INFLATE. This is the same method used by IE, ASP,
Java and other applications and other programming languages. Refer to
http://www.gzip.org/zlib/zlib_faq.html for additional information.
Refer to Data Type Definitions for all datatypes used in the Streaming Protocol
Request URL
All commands to streamer can use either HTTP protocol (port 80) or HTTPS protocol (port
443), and begin with the domain from streamer-url (retrieved from StreamerInfo command).
All REQUEST URLs must be URL Encoded. For example:
GET http://ameritrade.streamer.com/command.....
or
POST http://ameritrade.streamer.com/
DATA command...../n/n
Authentication
All commands to the Streamer Server start with the authentication information, such as
username, encoded password, and other parameters. Data is in key=value pair, delimited
by &
PARAMET DESCRIPTION
ER
!U account number - corresponds to "account-id" returned from LogIn command
W encoded password - corresponds to "token" returned from StreamerInfo
command
A=userid account number - corresponds to "account-id" returned from LogIn command
(same as the !U parameter)
token corresponds to "token" returned from StreamerInfo command
company corresponds to "company" returned from LogIn command
segment corresponds to "segment" returned from LogIn command
cddomain corresponds to "cd-domain-id" returned from StreamerInfo command
usergroup corresponds to "usergroup" returned from StreamerInfo command
accesslev corresponds to "access-level" returned from StreamerInfo command
el
authorize corresponds to "authorized" returned from StreamerInfo command
d
acl Customer's entitlement information - corresponds to "acl" returned from
StreamerInfo command
timestamp Application server generated timestamp - corresponds to "timestamp" returned
from StreamerInfo command
appid Application Server ID - corresponds to "app-id" returned from StreamerInfo
command
Request Sections
Requests for multiple types of data have to be submitted in one URL. The different
data requests are separated by the "|" (bar) character. For the detailed description, refer to
the Request Format section
FIRST REQUEST
The first streaming data request for an application needs to have MONOPOLIZE request in
it.
Request Sample
The following is a sample for constructing generic request that just has the authentication info, but
no actual data requests:
45.1 Debugging
A useful practice during the development cycle is to compare the URL generated by your
application software to one generated by a program that is already known to work. The
simplest way to do that is to look at the log files generated by the TESTDLL sample app that
is included with the DLL/ActiveX components.
Java Developers - Use the DataInputStream, and the GetUTF, GetByte, GetInt,
GetShort, etc. functions to decode data.
Strings are captured automatically: the length, and then the string as UTF characters.
.NET Developers - All numeric values must be loaded and reversed as they are
read from the response stream. ("big-endian" to "little-endian"). For example, GetBytes(4)
to get values: 00 00 00 04, save the bytes into an array, reverse the array
(Array.Reverse(myArray)), and then use BitConverter class to convert the array into an Int32
value -- in this case, 4.
Strings are handled like above: bytes (a byte array) = binaryStream.GetBytes(2) ->
Array.Reverse(bytes) -> int len = BitConverter.GetInt16 (bytes, 0). To load the
string, convert the characters using System.Text.Encoding.ASCII.GetString(bytes,
len).
Float values: grab the 4 bytes, reverse them, and use BitConverter's GetSingle
function
Integers
Real numbers
Other types
Streaming Services
SID = Streaming ID
S = Streaming
N = Snapshot
SERVICE NAME SI COMMAND S/ DESCRIPTION
D N
QUOTE 1 QUOTE S, Level I quotes (EQUITIES)
N
TIMESALE 5 TIMESALE S Last sale quotes
RESPONSE 10 n/a (response) N General response
AUTHORIZER 16 AUTHORIZER N Entitlement
OPTION 18 OPTION S level 1 quotes (OPTIONS)
ACTIVES_ISLA 14 ACTIVES_ISLA S INET actives (deprecated)
ND ND
ACTIVES_NYSE 23 ACTIVES_NYS S NYSE actives
E
ACTIVES_NAS 25 ACTIVES_NAS S NASDAQ actives
DAQ DAQ
ACTIVES_OTC 26 ACTIVES_OTC S OTCBB actives
BB BB
NEWS 27 NEWS S News
NEWS_HISTOR 28 n/a N Historical news for the day
Y
OPTION_LOOK 33 n/a N Option symbol lookup
UP
ACTIVES_OPTI 35 ACTIVES_OPTI S Options actives
ONS ONS
ADAP_NASDAQ 62 ADAP_NASDAQ S NASDAQ aggregated data
NYSE_BOOK 81 NYSE_BOOK S, NYSE level 2 book
N
NYSE_CHART 82 NYSE_CHART S, NASDAQ chart
N
NASDAQ_CHA 83 NASDAQ_CHA S, NYSE chart
RT RT N
INDEX_CHART 85 INDEX_CHART S, Indices chart
N
OPRA_BOOK 84 OPRA S Options level 2 book
TOTAL_VIEW 87 TOTAL_VIEW S NASDAQ TotalView and Level II data
Request Format
S = Service Name (QUOTE, LEVELII, OPTION etc…)
C = GET (snapshot) or SUBS (streaming)
P = Parameters (optional)
T = Field #'s (optional)
Example: S=QUOTE&C=SUBS&P=DELL+AMTD&T=
0+1+2+3+8+10+11+12+13+15+16+19+20
For example if you want to request quotes on DELL and some Indices as well as NASDAQ
Level II for DELL, you would request
S=QUOTE&C=SUBS&P=DELL+$SPX.X+$INX+$INDU&T=0+1+2+3+8+10+11+12+13+15
+16+19+20|S=TOTAL_VIEW&C=SUBS&P=DELL>L2&T=0+1+2+3|
If you have one streaming request and submit make another request, the first request will be
terminated.
NOTE: symbol formats for some symbols are different for streaming data vs snapshot and
what is entered by the user on the web site. For example, streaming servers would expect
BRK/A, while the snapsnot quote servers would expect BRK.A. The application should
always accept the symbol in the "Snapshot" format and convert for streaming as needed,
since that is what the end-user would enter on the TD AMERITRADE web site. Here are
some sample conversions:
AMTD_092209P12.5 gets submitted unchanged, but end user should NEVER see this
symbol. Option Description should always be shown to the user.
Heartbeat Response
LENGTH
(8 BIT
FIELD TYPE VALUE BYTES) DESCRIPTION
45.7 MONOPOLIZE
The MONOPOLIZE server ID is used to identify a new streaming connection client. Other
client applications connected with the same account will be notified to disconnect. This
allows for proper notification to disconnect for the other applications, instead of them just
getting the connections terminated.
The monopolize request should be attached to the first streaming connection made by an
application. It should NOT be sent with every streaming request. Just the first one.
45.7.1 Request
Parameters
S = QUOTE
C = MONOPOLIZE
Request Example
!U=123456789&W=104256ff2f0aa06195fdc225908c05b34450703b&A=userid=123456789
&token=104256ff2f0aa06195fdc225908c05b34450703b&company=AMER&segment=UAME
R&cddomain=A000001111111111&usergroup=ACCT&accesslevel=ACCT&authorized=Y&acl
=ADAQC1DRESGKIPMAOLPNQSRFSPTETFTOTTUAWSQ2NS×tamp=1143663111397&a
ppid=testapp1|S=QUOTE&C=MONOPOLIZE
45.7.2 Response
MONOPOLIZE Response will be a STREAMER SERVER message with
MONOPOLIZE_ACK return code
In order to subscribe to ACCT_ACTIVITY, you must first request a MessageKey for the
accounts that you wish to get the updates on.
NOTE: If ACCT_ACTIVITY is one of the streaming requests, then the request MUST BE
on a SSL secure connection (HTTPS)
45.8.1 Request
Parameters
S = ACCT_ACTIVITY
C = SUBS
P = Token returned from the MessageKey command
T = 0+1+2+3
Request Example
!U=#chen5582&W=acd04d27e1ebe685fc3a3d4286103fcdebefa589&A=userid=123456789
&token=acd04d27e1ebe685fc3a3d4286103fcdebefa589&company=AMER&segment=UAME
R&cddomain=A000001111111111&usergroup=ACCT&accesslevel=ACCT&authorized=Y&acl
=ADAQC1DRESGKIPMAOLPNQSRFSPTETFTOTTUAWSQ2NS×tamp=1143136132906&a
ppid=testapp1|
S=ACCT_ACTIVITY&C=SUBS&P=adfl457kg2342s9045U&T=0+1+2+3
userid%3D123456789%26token%3Dacd04d27e1ebe685fc3a3d4286103fcdebefa589%26c
ompany%3DAMER%26segment%3DUAMER%26cddomain%3DA000001111111111%26use
rgroup%3DACCT%26accesslevel%3DACCT%26authorized%3DY%26acl%3DADAQC1DRES
GKIPMAOLPNQSRFSPTETFTOTTUAWSQ2NS%26timestamp%3D1143136132906%26appid
%3Dtestapp1%7CS%3DACCT_ACTIVITY&C%26C%3DSUBS%26P%3D
adfl457kg2342s9045U%26T%3D0%2B1%2B2%2B3
NOTE: If ACCT_ACTIVITY is one of the streaming requests, then the request MUST BE
on a SSL secure connection (HTTPS)
45.8.2 Response
LENGTH
(8 BIT
FIELD TYPE VALUE BYTES) DESCRIPTION
NOTE: The response messages are in XML format and contain some fields that may not
be relevant. We are only documenting the fields that are relevant. Any other fields should
be ignored during processing.
Majority portion of the XML message will be the same regardless of the message type. The
extra fields that will differ for each message type are documented explicitly at the end of the
XML structure
<ShortDescription></ShortDescription>
<SymbolUnderlying></SymbolUnderlying>
</Security>
<OrderPricing xsi:type="....">
<Last></Last>
<Ask></Ask>
<Bid></Bid>
<Limit></Limit>
</OrderPricing>
<OrderType></OrderType>
<OrderDuration></OrderDuration>
<OrderEnteredDateTime></OrderEnteredDateTime>
<OrderInstructions></OrderInstructions>
<OriginalQuantity></OriginalQuantity>
<SpecialInstructions></SpecialInstructions>
<Discretionary></Discretionary>
<OrderSource></OrderSource>
<Solicited></Solicited>
<MarketCode></MarketCode>
<Capacity></Capacity>
<GoodTilDate></GoodTilDate>
</Order>
<LastUpdated></LastUpdated>
<PendingCancelQuantity></PendingCancelQuantity>
<OriginalOrderId></OriginalOrderId>
</OrderCancelReplaceRequestMessage>
Security Compl
ex
CUSIP String
Symbol String
SecurityType String One of the following values:
Common Stock Preferred Stock Convertible
Preferred Stock
Rights Warrant Mutual Fund
Call Option Put Option Bank Call Option
(Other values are also possible)
String One of the following values:
SecurityCategory Equity Option
Hybrid Rights
Warrant Mutual Fund
Fixed Income Commercial Paper
Other
String Description of the Symbol. Particularly important for option
ShortDescription symbols
String If the symbol is an option, then this field is the underlying
SymbolUnderlying symbol for that option
OrderPricing Compl
ex
Last Float
Ask Float
Bid Float
Limit Float Only returned for orders where LIMIT price is relevant
Method String The Method for Trailing Stop orders: Points or Percent
Amount Float The amount used for Trailing Stop. If trails 2%, it would be 2.
OrderType String One of the following values:
MarketLimit
Stop Stop Limit
On Close Trailing Stop
Excercised
OrderDuration String Day Good Till Date Good Till Cancel
Good Till Night Fill Or Kill Immediate Or
Cancel
End Of Month End Of Week Market At Open
Next End Of Month
NOTE: Refer to MarketCode as well. OrderDuration and
MarketCode together translate to the usually entered expiration
values
OrderEnteredDateTi
String
me
Buy Sell Short
OrderInstructions String Short ExemptBuy To Cover
Exchange Exercise
OriginalQuantity Float
Compl
SpecialInstructions Container for various special instructions flags
ex
AllOrNone Integer Value will either be 1, or the tag will not be returned
String Value will either be "Do Not Reduce", or tag will not be
DoNotReduceIncrea returned
seFlag
NotHeld Integer Value will either be 1, or the tag will not be returned
TryToStop Integer Value will either be 1, or the tag will not be returned
Discretionary Integer Internal
OrderSource String Internal
Solicited Boolea Internal
n
MarketCode String Normal Seamless
Extended PreSession
German
="EquityOrderT">
<OrderKey>2148111147</OrderKey>
<Security>
<CUSIP>458140100</CUSIP>
<Symbol>INTC</Symbol>
<SecurityType>Common Stock</SecurityType>
<SecurityCategory>Equity</SecurityCategory>
</Security>
<OrderPricing xsi:type="LimitT">
<Last>21.33000</Last>
<Ask>21.34000</Ask>
<Bid>21.33000</Bid>
<Limit>21.09000</Limit>
</OrderPricing>
<OrderType>Limit</OrderType>
<OrderDuration>Day</OrderDuration>
<OrderEnteredDateTime>2008-03-28T14:11:42Z</OrderEnteredDateTime>
<OrderInstructions>Buy</OrderInstructions>
<OriginalQuantity>150.000</OriginalQuantity>
<SpecialInstructions></SpecialInstructions>
<Discretionary>0</Discretionary>
<OrderSource>Web</OrderSource>
<Solicited>false</Solicited>
<MarketCode>Seamless</MarketCode>
<Capacity>Agency</Capacity>
<Charges>
<Charge>
<Type>Commission</Type>
<Amount>8.000</Amount>
</Charge>
<Charge>
<Type>SEC Fee</Type>
<Amount>0.000</Amount>
</Charge>
</Charges>
</Order>
<LastUpdated>2008-03-28T14:12:06Z</LastUpdated>
</OrderEntryRequestMessage>
Parameters
S = QUOTE
C = SUBS or GET
P = symbol+symbol+symbol…..
T = fieldNum+fieldNum+….
Request Example
!U=#chen5582&W=acd04d27e1ebe685fc3a3d4286103fcdebefa589&A=userid=123456789
&token=acd04d27e1ebe685fc3a3d4286103fcdebefa589&company=AMER&segment=UAME
R&cddomain=A000001111111111&usergroup=ACCT&accesslevel=ACCT&authorized=Y&acl
=ADAQC1DRESGKIPMAOLPNQSRFSPTETFTOTTUAWSQ2NS×tamp=1143136132906&a
ppid=testapp1|
S=QUOTE&C=SUBS&P=DELL+$SPX.X+$INX+$INDU&T=0+1+2+3+8+10+11+12
+13+15+16+20
Field numbers must be listed in ascending order. A symptom that there is a lower number
following a higher number – the fields from the out of order number to the end are not
returned.
SYMBOL 0 String
BID 1 Float
ASK 2 Float
LAST 3 Float
BIDSIZE 4 Int
ASKSIZE 5 Int
BIDID 6 Char
ASKID 7 Char
VOLUME 8 Long
LASTSIZE 9 Int
TRADETIME 10 Int # of seconds since midnight, eastern
time
TRADEDATE_MARKET_ 43 Int
HOURS
TRADETIME_MARKET_ 44 Int
HOURS
CHANGE_MARKET_HO 45 Float
URS
IS_REGULAR_MARKET 46 Boolea
_QUOTE n
IS_REGULAR_MARKET 47 Boolea
_TRADE n
45.9.2 Response
LENGTH
(8 BIT
FIELD TYPE VALUE BYTES) DESCRIPTION
45.10.1 Request
Parameters
S = OPTION
C = SUBS
P = symbol+symbol+symbol…..
T = fieldNum+fieldNum+….
Request Example
NOTE: Option symbols change based on time. Do not use the symbols in this example for testing
application software. Use current symbols for testing.
!U=123456789&W=104256ff2f0aa06195fdc225908c05b34450703b&A=userid=123456789
&token=104256ff2f0aa06195fdc225908c05b34450703b&company=AMER&segment=UAME
R&cddomain=A000001111111111&usergroup=ACCT&accesslevel=ACCT&authorized=Y&acl
=ADAQC1DRESGKIPMAOLPNQSRFSPTETFTOTTUAWSQ2NS×tamp=1143663111397&a
ppid=testapp1|S=OPTION&C=SUBS&P=AMTD_092209P12.5+QQQQ
_092210P30+SPY_032110P80&T=0+1+2+3+4+5+6+7+8+11+12+16+17+28
Field numbers must be listed in ascending order. A symptom that there is a lower number
following a higher number – the fields from the out of order number to the end are not
returned.
SYMBOL 0 String
CONTRACT 1 String Description of the option
BID 2 Float
ASK 3 Float
LAST 4 Float
HIGH 5 Float
LOW 6 Float
CLOSE 7 Float
VOLUME 8 Long
OPEN_INTERE 9 Int
ST
VOLATILITY 10 Float
QUOTETIME 11 Int
TRADETIME 12 Int
IN_THE_MON 13 Float
EY
QUOTEDATE 14 Int
TRADEDATE 15 Int
YEAR 16 Int
MULTIPLIER 17 Float
OPEN 19 Float
BIDSIZE 20 Int
ASKSIZE 21 Int
LASTSIZE 22 Int
CHANGE 23 Float
STRIKE 24 Float
CONTRACT_T 25 Char C or P (NOTE: 2 bytes - Unicode) - NOT USED
YPE ANYMORE
UNDERLYING 26 String Underlying Symbol. NOTE: be careful with Index
options, you'll get SPX instead of $SPX.X, for
example
MONTH 27 Int
NOTE 28 String Contains description of the DELIVERABLES for non-
standard options. Standard options will not have this
field returned
TIMEVALUE 29 Float
DAYS_TO_EX 31 Int Days To Expiration
P
DELTA_INDEX 32 Float
GAMMA_INDE 33 Float
X
THETA_INDEX 34 Float
VEGA_INDEX 35 Float
RHO_INDEX 36 Float
45.10.2 Response
Level I OPTION Response format is exactly the same Level I (QUOTE) Response for
stocks.
Parameters
S = TIMESALE
C = SUBS
P = symbol+symbol+symbol…..
T = fieldNum+fieldNum+….
Field numbers must be listed in ascending order. A symptom that there is a lower number
following a higher number – the fields from the out of order number to the end are not
returned.
SYMBOL 0 String
TIME 1 Int
PRICE 2 Float
VOLUME 3 Long
SEQUENCE 4 Int
UPDATED 5 Int
Request Example
!U=#chen5582&W=3b2fcefd18b9913d2987d19e811c20251bf87eb4&A=userid=12345678
9&token=3b2fcefd18b9913d2987d19e811c20251bf87eb4&company=AMER&segment=UA
MER&cddomain=A000001111111111&usergroup=ACCT&accesslevel=ACCT&authorized=Y&
acl=ADAQC1DRESGKIPMAOLPNQSRFSPTETFTOTTUAWSQ2NS×tamp=1143564221288
&appid=testapp1|S=TIMESALE&C=SUBS&P=DELL+AMTD&T=0+1+2+3+4
45.11.2 Response
LENGT
H
(8 BIT
BYTES
FIELD TYPE VALUE ) DESCRIPTION
45.12.1 Request
Parameters
S = OPRA, NYSE_BOOK
C = SUBS
P = symbol+symbol+symbol…..
T = fieldNum+fieldNum+….
Field numbers must be listed in ascending order. A symptom that there is a lower number
following a higher number – the fields from the out of order number to the end are not
returned.
SYMBOL 0 String
TIME 1 Int
Data 2 Short, Byte[]
ny%3DAMER%26segment%3DUAMER%26cddomain%3DA000001111111111%26usergrou
p%3DACCT%26accesslevel%3DACCT%26authorized%3DY%26acl%3DADAQC1DRESGKIP
MAOLPNQSRFSPTETFTOTTUAWSQ2NS%26timestamp%3D1143580609994%26appid%3Dt
estapp1%7CS%3DNYSE_BOOK%26C%3DSUBS%26P%3DIBM%26T%3D0%2B1
45.12.2 Response
LENGTH
(8 BIT
FIELD TYPE VALUE BYTES) DESCRIPTION
Bid Count Int varies Counts how many bid rows in book
Delimiter Byte ; 1 Field delimiter for book data
Bid Total Int varies Counts how many total bids in book
Delimiter Byte ; 1 Field delimiter for book data
BEGINNING OF REPEAT BID DATA – repeat Bid Count times
Ask Count Int varies Counts how many ask rows in book
Delimiter Byte ; 1 Field delimiter for book data
Ask Total Int varies Counts how many total asks in book
Delimiter Byte ; 1 Field delimiter for book data
BEGINNING OF REPEAT ASK DATA – repeat Ask Count times
LENGTH
(8 BIT
FIELD TYPE VALUE BYTES) DESCRIPTION
4;4;NASDAQ;90.7;1;PACX;90.52;16;ISE;89.48;30;NASD;0.01;1;4;4;NASDAQ;90.89;16;PACX;90
.9;1;ISE;92.05;30;NASD;301000.0;1;
45.13.1 Request
Parameters
S = TOTAL_VIEW
C = SUBS
P = symbol+symbol+symbol…..
T = fieldNum+fieldNum+….
Field numbers must be listed in ascending order. A symptom that there is a lower number
following a higher number – the fields from the out of order number to the end are not
returned.
Since data can return in 3 formats: Total View Aggregate, Level 2, and Aggregated Depth at
Price (aka Depth Chart), we will need to overload the symbol field (P) of the command. The
following suffixes have to be attached to each symbol to indicate which type of data is to be
returned
Symbol Attachment
FIELD VALUE
SYMBOL 0 String
TIME 1 Int
Bid Book 2 Multi-field Data
Ask Book 3 Multi-field Data
NOII Data 4 Multi-field Data (NOT AVAILABLE)
45.13.2 Response
TotalView Response
LENGTH
(8 BIT
FIELD TYPE VALUE BYTES) DESCRIPTION
LENGTH
(8 BIT
FIELD TYPE VALUE BYTES) DESCRIPTION
Ending Delim Byte 0x0A 1 Ending delimiter for this data stream – ‘\n’
Total Row Int varies Total number of rows for this side of the book.
Count Can be more than the total # returned in
subsequent sections, in which case, just
display "X more rows" and use this field to
compute that
Delimiter Byte ; 1 Field delimiter for book data
Level Count Int varies Counts how many levels in the book
Delimiter Byte ; 1 Field delimiter for book data
BEGINNING OF REPEAT LEVEL DATA – repeat Level Count times
15;91;arcx;23.51;41;BRUT;23.51;40;cinn;23.51;31;SIZE;23.51;10;EDGX;23.51;10;TRAC;23.5;9
;UBSS;23.5;5;LEHM;23.5;1;WCHV;23.5;1;PERT;23.49;22;FBCO;23.49;1;NFSC;23.49;1;amex;23.
48;500;MOKE;23.48;1;BOFA;23.47;1;15;91;cinn;23.52;847;arcx;23.52;700;BRUT;23.52;213;SI
ZE;23.52;142;TRAC;23.52;43;BTRD;23.52;8;SBSH;23.53;11;MOKE;23.53;1;WCHV;23.53;1;NFS
C;23.54;100;TMBR;23.54;50;PERT;23.54;5;BOFA;23.54;1;LEHM;23.54;1;COWN;23.54;1;
45.15 ACTIVES
The ACTIVES_* server IDs are used to request the "Most Actives" lists of symbols based on
various criteria
45.15.1 Request
Parameters
S = ACTIVES_NYSE, ACTIVES_NASDAQ, ACTIVES_OTCBB, ACTIVES_OPTIONS
C = SUBS
P = Venue-Duration+Venue-Duration....
T = 0+1
Field numbers should always be 0+1 for this request. The Service ID and Venue has to
correspond. For example, if the select ACTIVES_NYSE, then the Venue must be NYSE as
well.
You can specify multiple Venue-Duration combinations for each exchange. For example,
NASDAQ-ALL+NASDAQ-3600. They have to be separated by a + sign
!U=123456789&W=054ba633eb878596346ab7acd825454f7ae131f5&A=userid=12345678
9&token=054ba633eb878596346ab7acd825454f7ae131f5&company=AMER&segment=UA
MER&cddomain=A000001111111111&usergroup=ACCT&accesslevel=ACCT&authorized=Y&
acl=ADAQC1DRESGKIPMAOLPNQSRFSPTETFTOTTUAWSQ2NS×tamp=1143740871398
&appid=testapp1|S=ACTIVES_OTCBB&C=SUBS&P=OTCBB-60&T=0+1
45.15.2 Response
ACTIVES Response
LENG
TH
(8 BIT
TYP BYTES
FIELD E VALUE ) DESCRIPTION
INITIAL GROUP: Descriptor Group. It contains information about the rest of the groups being
returned
57510;0;00:00:00;15:58:30;6;0:0:0;1:0:0;2:0:0;3:0:0;4:10:5234081:AAPL:230692:4.41:SYMC
:87008:1.66:LVLT:86452:1.65:GOOG:79025:1.51:INTC:75896:1.45:QQQQ:73049:1.4:ATYT:7155
4:1.37:BRCM:68573:1.31:CSCO:59819:1.14:VPHM:58947:1.13;5:10:2096769681:QQQQ:112137
833:5.35:LVLT:101695066:4.85:SUNW:68187431:3.25:INTC:65462262:3.12:JDSU:55355659:2.
64:CSCO:50843090:2.42:MSFT:49805550:2.38:AAPL:48921314:2.33:ORCL:47951340:2.29:SIRI:
35386791:1.69;
ID: 57510
sampleDuration: 0
Start Time: 00:00:00
Display Time: 15:58:30
Num Groups: 6
FOR STOCKS:
The first 3 entries are:
Group #: (0-based, 0 to Num) - the Group Number - refer to the list above.
NumEntries: # of actives entries (triplets) that follow
TotVol: Total volume (or total # of trades) for the exchange
Symbol
Volume
Percent - same as Volume/TotVol
Example:
4:10:5234081:AAPL:230692:4.41:SYMC:87008:1.66:LVLT:86452:1.65:GOOG:79025:1.51:INTC:7
5896:1.45:QQQQ:73049:1.4:ATYT:71554:1.37:BRCM:68573:1.31:CSCO:59819:1.14:VPHM:5894
7:1.13
FOR OPTIONS:
Actives for OPTIONS are handled almost the same way as for stocks. The difference is that the
Symbol Description is returned as well as the symbol
Group #: (0-based, 0 to Num) - the Group Number - refer to the list above.
NumEntries: # of actives entries (triplets) that follow
TotVol: Total volume (or total # of trades) for the exchange
Symbol
Symbol Description
Volume
Percent - same as Volume/TotVol
Example:
45.16 News
The NEWS server ID is used to request streaming news headlines for various stocks and
indices
45.16.1 Request
Parameters
S = NEWS
C = SUBS
P = symbol+symbol+symbol....*ALL*+*HOT*
T = fieldNum+fieldNum+….
Field numbers must be listed in ascending order. A symptom that there is a lower number
following a higher number – the fields from the out of order number to the end are not
returned.
SYMBOL 0 String
TIME 1 Int
DATA 2 String
FIELD SIZE 3 Int
Request Example
!U=123456789&W=36a7b62ce5f82d8bd07443f62d02277c4da41f03&A=userid=12345678
9&token=36a7b62ce5f82d8bd07443f62d02277c4da41f03&company=AMER&segment=UA
MER&cddomain=A000001111111111&usergroup=ACCT&accesslevel=ACCT&authorized=Y&
acl=ADAQC1DRESGKIPMAOLPNQSRFSPTETFTOTTUAWSQ2NS×tamp=1143830624229
&appid=testapp1|S=NEWS&C=SUBS&P=DELL+AMTD&T=0+1+2+3
1%2B2%2B3
45.16.2 Response
NEWS Response
LENGT
H
(8 BIT
FIELD TYPE VALUE BYTES) DESCRIPTION
FIELDS VALUES/DESCRIPTION
45.17.1 Request
Parameters
S = NEWS
C = GET
P = symbol;FromTime (Number of milliseconds since 1/1/1970)
Request Example
!U=123456789&W=ba59869373ede93dec6486e284cfc3a8e805853a&A=userid=12345678
9&token=ba59869373ede93dec6486e284cfc3a8e805853a&company=AMER&segment=DA
TEK&cddomain=A000000009663628&usergroup=ACCT&accesslevel=ACCT&authorized=Y&
acl=AQC1DRESGKMAOCPNQSRFSPTETFTOTTUAWSQ2NS×tamp=1144073528716&ap
pid=prd_lapp3|S=NEWS&C=GET&P=DELL;1144036800306
45.17.2 Response
NOTE: The HTTP request for NEWS HISTORY may return multiple snapshot
records. It may return one or more STREAMER SERVER records followed by the
NEWS HISTORY record. Please make sure that you properly handle any records
returned and do NOT just assume that it will be only News History response
Headline ID Headline ID
Delimiter 0x02
Headline News headline
Delimiter 0x02
Timestamp News headline timestamp
FIELDS VALUES/DESCRIPTION
Delimiter 0x02
Source News source
Delimiter 0x02
News URL News story URL
Delimiter 0x01
Parameters
S = NYSE_CHART, NASDAQ_CHART, INDEX_CHART
C = SUBS
P = symbol+symbol+symbol....
T = fieldNum+fieldNum+….
Field numbers must be listed in ascending order. A symptom that there is a lower number
following a higher number – the fields from the out of order number to the end are not
returned.
Charts Field Requests
SYMBOL 0 String
SEQUENCE 1 Int (0 - 629) (minutes since 8:00
AM US Eastern time)
OPEN 2 Float
HIGH 3 Float
LOW 4 Float
CLOSE 5 Float
VOLUME 6 Int
Request Example
!U=123456789&W=c11fa0e798aba3b9d65866befce078537dc3ed18&A=userid=12345678
9&token=c11fa0e798aba3b9d65866befce078537dc3ed18&company=AMER&segment=UA
MER&cddomain=A000001111111111&usergroup=ACCT&accesslevel=ACCT&authorized=Y&
acl=ADAQC1DRESGKIPMAOLPNQSRFSPTETFTOTTUAWSQ2NS×tamp=1144091133399
&appid=testapp1|S=NASDAQ_CHART&C=SUBS&P=DELL&T=0+1+2+3+4+5+6+7
45.18.1.2 Response
NOTE: There are a few notes to consider when processing the responses:
1. Use the bar sequence for the time on each bar instead of the time
2. Only complete bars will be returned. If you get historical bars, the last bar returned may be
newer than the last returned Streaming CHART bar since historical request can return
partial data for the most current bar
3. You can get out of sequence or duplicate bars. This occurs if there is a correction
LENGTH
(8 BIT
FIELD TYPE VALUE BYTES) DESCRIPTION
NOTE: snapshot History via the stream server should no longer be used. Please use
PriceHistory instead
Parameters
S = NYSE_CHART, NASDAQ_CHART, INDEX_CHART
C = GET
P = symbol, first bar sequence,last bar sequence,5d,1m (parameters – “last chart period” is
number of bars to return per day, 610 returns all; next two parameters are interpreted as 5
days of data, 1 minute frequency)
T = N/A.
Field numbers must be listed in ascending order. A symptom that there is a lower number
following a higher number – the fields from the out of order number to the end are not
returned.
NOTE: Here is some background in order to understand the data being requested/returned:
The servers return 1 minute bar data for each day, starting at 8:00AM. Each bar has a
sequence number, starting with Zero for each day. The Nth bar is always for data for N
minutes from 8:00 AM. The request allows you to specify the start and end sequence of the
bars that you want returned for each day.
FREQUENCY should always be 1m. that parameter is not used at this time
NOTE: we strongly suggest you serialize this request. If you need to get data on multiple
symbols at the same time you should do this request one at a time, NOT concurrently
Request Example
!U=123456789&W=0f4907562c6fdcf69b31e2e63cf149eccee4608d&A=userid=123456789
&token=0f4907562c6fdcf69b31e2e63cf149eccee4608d&company=AMER&segment=UAME
R&cddomain=A000001111111111&usergroup=ACCT&accesslevel=ACCT&authorized=Y&acl
=ADAQC1DRESGKIPMAOLPNQSRFSPTETFTOTTUAWSQ2NS×tamp=1144091069407&a
ppid=testapp1|S=NASDAQ_CHART&C=GET&P=DELL,0,720,5d,1m
45.18.2.2 Response
NOTE: The HTTP request for CHART data may return multiple snapshot records. It
may return one or more STREAMER SERVER records followed by the Snapshot
CHART record. Please make sure that you properly handle any records returned and
do NOT just assume that it will be only Snapshot CHART response
LENGTH
(8 BIT
FIELD TYPE VALUE BYTES) DESCRIPTION
NOTE: each bar is terminated with a semicolon. You may get NULL values for a bar, with
just the semicolon terminator. For example, ;;;;;;;;. This happens because there were no
trades for a particular minute, yet the server has to return a "Bar" for that minute. In that
situation, just skip the null bar.
LENGTH
(8 BIT
FIELD TYPE VALUE BYTES) DESCRIPTION
High Float variabl Highest trade price for symbol at this time
e
Delimiter Char , 1 Delimiter for bar data
Low Float variabl Lowest trade price for symbol at this time
e
Delimiter Char , 1 Delimiter for bar data
Close Float variabl Previous trading session closing price
e
Delimiter Char , 1 Delimiter for bar data
Volume Int variabl Share volume at this time
e
Delimiter Char , 1 Delimiter for bar data
Time Int variabl Seconds since midnight.
e NOTE: DO NOT USE THIS FIELD. Use the
Sequence instead
Delimiter Char , 1 Delimiter for bar data
Date Int variabl Days since 1/1/1970
e
Delimiter Char ; 1 Delimiter for chart bar
This is a general response from the Streamer Server that may include messages from
service providers, entitlement information or issues encountered (such as the service
provider is not returning data etc).
These messages are NOT necessarily errors. Please review the Return Code Values table
for the intent of the response
NOTE: When receiving this N, string length, 100 value, consider it a Streamer Server
Response message
LENGT
H
(8 BIT
FIELD TYPE VALUE BYTES) DESCRIPTION
SUCCESS 0
SERVICE_DOWN 1
SERVICE_TIMEOUT 2
LOGIN_DENIED 3
AUTHORIZER_BUSY 4
AUTHORIZER_DOWN 5
USER_NOT_FOUND 6
ACCOUNT_ON_HOLD 7
ACCOUNT_FROZEN 8
UNKNOWN_FAILURE 9
FAILURE 10
SERVICE_NOT_AVAILABLE 11
CLOSE_APPLET 12
USER_STATUS 13
ACCOUNT_EMPTY 14
MONOPOLIZE_ACK 15
NOT_AUTHORIZED_FOR_SERVICE 16
NOT_AUTHORIZED_FOR_QUOTE 17
STREAMER_SERVER_ID 18
REACHED_SYMBOL_LIMIT 19
STREAM CONNECTION NOT FOUND 20
BAD_COMMAND_FORMAT 21
FAILED_COMMAND_SUBS 22
FAILED_COMMAND_UNSUBS 23
FAILED_COMMAND_ADD 24
FAILED_COMMAND_VIEW 25
SUCCEEDED_COMMAND_SUBS 26
SUCCEEDED_COMMAND_UNSUBS 27
SUCCEEDED _COMMAND_ADD 28
SUCCEEDED _COMMAND_VIEW 29
-F- -K-
KeepAlive 31
FullStoryNews 145
FullStoryNewsErrors 150
FullStoryNewsParameters 145
FullStoryNewsRequest 145
-L-
FullStoryNewsResponse 145 Language Specific HTTP Specs 16
FullStoryNewsSamples 146 LastOrderStatus 119
LEVELII 303, 306
LogIn 24
-G- Login Errors 30
Login Examples 28
General Considerations 16
LogIn Parameters 25
GetWatchlists 258
LogIn Request 25
GetWatchlists Errors 262
LogIn Response 26
GetWatchlists Parameters 258
LogOut 30
GetWatchlists Request 258
GetWatchlists Response 258
GetWatchlists Samples 260 -M-
MarketOverview 138
-H- MarketOverviewParameters 138
MarketOverviewRequest 138
Heavy Volume 17
MarketOverviewResponse 139
Historical data 53
© TD Ameritrade Think Tech
Index 331
-T-
Time & Sales Request 301
Time & Sales Response 302
TIMESALE 301
TotalView 306
Trade 156
Transaction History 120, 138
Transactions 96, 120, 138
Typeface Conventions 12
-U-
URL Encoding 19
URL Encoding Substitutions 22
URL Rewriting 18
-V-
VB 16
VolatilityHistory 58
VolatilityHistory Parameters 58
VolatilityHistory Request 58
VolatilityHistory Response 61
VolatilityHistory Samples 62
VolatilityHistory Validation Rules 60
VolatilityHistoryError Response 62
-W-
What needs URL Encoding 20
-X-
XML Quote Errors 49
XML Quote Examples 45
XML Quote Parameters 37
XML Quote Request 37
XML Quote Response 37
XML Quotes 37