td-api
Classes
Functions
- createTDAmeritradeAPIClient(config) ⇒
TDAmeritradeAPI
Creates a new instance of the TD Ameritrade API
- filterBuyTrades(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Filter Buy Trades
- filterSellTrades(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Filter Sell Trades
- filterOpeningTrades(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Filter Opening Trades
- filterClosingTrades(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Filter Closing Trades
- filterOpeningShortSales(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Filter Open Short Sale Trades
- filterClosingShortSales(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Filter Closing Short Sale Trades
- filterOptionTrades(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Filter Option Trades
- filterEquityTrades(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Filter Equity Trades
- groupByOrderId(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Group Trades by Order ID
- groupByInstrument(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Group Trades by Instrument
- groupByInstrumentSymbol(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Group Trades by Instrument Symbol
- groupByInstrumentUnderlyingSymbol(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Group Trades by Instrument Underlying Symbol
- groupByInstrumentCUSIP(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Group Trades by Instrument CUSIP
- groupByAssetType(trades) ⇒
Array.<TransactionData>
[td-utils.js] - Group Trades by Asset Type
Typedefs
- DateLikeNullable :
Date
|string
|number
|null
- TickerSymbol :
string
- CUSIP :
string
- TDAmeritradeAccountID :
string
- AssetType :
'EQUITY'
|'OPTION'
- AcceptedOrRejected :
'ACCEPTED'
|'REJECTED'
- PositionEffect :
'OPENING'
|'CLOSING'
- BuyOrder :
'BUY'
|'BUY_TO_OPEN'
|'BUY_TO_CLOSE'
|'BUY_TO_COVER'
- SellOrder :
'SELL'
|'SELL_TO_OPEN'
|'SELL_TO_CLOSE'
|'SELL_SHORT'
- OrderDescription :
'BUY TRADE'
|'SELL TRADE'
|'SHORT SALE'
|'CLOSE SHORT POSITION'
- GetTransactionsType :
'ALL'
|'TRADE'
|'BUY_ONLY'
|'SELL_ONLY'
|'CASH_IN_OR_CASH_OUT'
|'CHECKING'
|'DIVIDEND'
|'INTEREST'
|'ADVISOR_FEES'
|'OTHER'
- TDAmeritradeAccounts :
Array.<TDAmeritradeAccount>
- APIClientConfig :
Object
Represents the configuration for the API client.
- APIRequestConfig :
Object
Represents the configuration for making an API request.
- APIResponse :
Object
Represents an API response.
- AuthenticationResponse :
Object
TD Ameritrade API Authentication Response
- RefreshTokenResponse :
Object
TD Ameritrade API Refresh Token Response
- TDAmeritradeAccount :
Object
Represents a TD Ameritrade account.
- InstrumentData :
Object
Represents stock information.
- QuoteData :
Object
Represents stock data.
- Fundamentals :
Object
Represents fundamental data for a stock.
- FundamentalData :
Object
Represents Fundamental Data
- OHLC :
Object
Represents Open, High, Low Close Values
- OHLCVolume :
Object
Represents OHLC with Volume Values
- Candlestick :
Object
Represents a candlestick.
- PriceHistory :
Object
Represents candlestick data.
- OptionContractData :
Object
Represents option contract data.
- UnderlyingAsset :
Object
Represents information about the underlying asset.
- OptionContractDateMap :
Object.<string, Array.<OptionContractData>>
Represents a mapping of option contract data by expiration date.
- OptionChainData :
Object
Represents option chain data.
- WatchlistItemInstrument :
Object
Represents an instrument.
- WatchlistItem :
Object
Represents an instrument within a watchlist.
- Watchlist :
Object
Represents a watchlist.
- Watchlists :
Array.<Watchlist>
Represents multiple watchlists.
- CurrentBalances :
Object
Represents an account's financial summary.
- InitialBalances :
Object
Represents an account's financial summary.
- ProjectedBalances :
Object
Represents account-related data.
- PositionData :
Object
Represents data related to a trading position.
- ExchangeDelayStatus :
Object
Represents a delay status for various exchanges.
- StreamerSubscriptionKey :
Object
Represents a single streamer subscription key.
- StreamerSubscriptionKeys :
Object
Represents an array of streamer subscription keys.
- StreamerInfo :
Object
Represents streamer information.
- UserPrincipalAccount :
Object
Represents an account with its preferences and authorizations.
- UserPrincipalsData :
Object
Represents principal data.
- TradeTransactionFees :
Object
Represents fees associated with a trade transaction.
- TransactionItem :
Object
Represents a trade transaction item.
- TransactionData :
Object
Represents a trade transaction.
- OrderRequest :
Object
Order Request
- TDAmeritradeOrderLeg :
Object
- OrderData :
Object
Represents an order object.
- OrderLeg :
Object
Represents an order leg within an order.
- TrendingEquity :
Object
Represents Market Mover Trending Equity data.
- MarketMovers :
Object
Represents Market Movers - Current Trending Equities of $SPX.X, $COMPX, $DJI
TDAmeritradeAPI
Kind: global class
- TDAmeritradeAPI
- new TDAmeritradeAPI()
- .TDAmeritradeAPI
- .accessTokenExpirationMonitor ⇒
function
- .startAccessTokenExpirationMonitor
- .setUserAccessToken ⇒
void
- .authenticate ⇒
Promise.<APIResponse.<(AuthenticationResponse|null)>>
- .refreshAccessToken ⇒
Promise.<APIResponse.<(RefreshTokenResponse|null)>>
- .getAccounts ⇒
Promise.<APIResponse.<TDAmeritradeAccounts>>
- .getAccount ⇒
Promise.<APIResponse.<TDAmeritradeAccount>>
- .getUserPrincipals ⇒
Promise.<APIResponse.<UserPrincipalsData>>
- .getTransactions ⇒
Promise.<APIResponse.<Array.<TransactionData>>>
- .getOrders ⇒
Promise.<APIResponse.<Array.<OrderData>>>
- .getQuotes ⇒
Promise.<APIResponse.<Object.<string, QuoteData>>>
- .getInstrument ⇒
Promise.<APIResponse.<Array.<InstrumentData>>>
- .getFundamentals ⇒
Promise.<APIResponse.<Object.<string, FundamentalData>>>
- .getMarketDirectionalMover ⇒
Promise.<APIResponse.<Array.<TrendingEquity>>>
- .getPriceHistory ⇒
Promise.<APIResponse.<PriceHistory>>
- .getDailyPriceHistory ⇒
Promise.<APIResponse.<PriceHistory>>
- .getWeeklyPriceHistory ⇒
Promise.<APIResponse.<PriceHistory>>
- .getPeriodicPriceHistory ⇒
Promise.<APIResponse.<PriceHistory>>
- .getMarketMovers ⇒
Promise.<APIResponse.<MarketMovers>>
- .getOptionChain ⇒
Promise.<APIResponse.<OptionChainData>>
- .getWatchlists ⇒
Promise.<APIResponse.<Watchlists>>
- .getWatchlist ⇒
Promise.<APIResponse.<Watchlist>>
- .placeOrder ⇒
Promise.<APIResponse.<any>>
- .cancelOrder ⇒
Promise.<APIResponse.<any>>
- .openOrder ⇒
Promise.<APIResponse.<any>>
- .closeOrder ⇒
Promise.<APIResponse.<any>>
- .buyStock ⇒
Promise.<APIResponse.<any>>
- .sellStock ⇒
Promise.<APIResponse.<any>>
- .shortStock ⇒
Promise.<APIResponse.<any>>
- .coverStock ⇒
Promise.<APIResponse.<any>>
- .buyOption ⇒
Promise.<APIResponse.<any>>
- .sellOption ⇒
Promise.<APIResponse.<any>>
- .writeOption ⇒
Promise.<APIResponse.<any>>
- .closeOption ⇒
Promise.<APIResponse.<any>>
new TDAmeritradeAPI()
Represents the TDAmeritradeAPI class for handling requests.
tdAmeritradeAPI.TDAmeritradeAPI
Kind: instance class of TDAmeritradeAPI
new exports.TDAmeritradeAPI([config])
Creates an instance of TDAmeritradeAPI.
Param | Type | Default | Description |
---|---|---|---|
[config] | Object | API Client Configuration | |
[config.clientId] | string | TD Amertitrade Client ID - defaults to TD_AMERITRADE_CLIENT_ID environment variable. | |
[config.callbackUrl] | string | Callback URL - defaults to TD_AMERITRADE_CALLBACK_URL environment variable. | |
[config.handleRequest] | function | null |
| An optional request handler function. |
tdAmeritradeAPI.accessTokenExpirationMonitor ⇒ function
Internal Access Token Expiration Monitor / refresh token timer
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
cb | function | Callback function to call on every check |
tdAmeritradeAPI.startAccessTokenExpirationMonitor
Access Token Expiration Monitor / refresh token timer
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
cb | function | Callback function to call on every check |
tdAmeritradeAPI.setUserAccessToken ⇒ void
Set User Access Token / Refresh Token
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
credentials | LocalMemoryAuthDataStore | Credentials Data Store |
[credentials.userAccessToken] | string | Access Token |
[credentials.accessTokenExpires] | DateLikeNullable | Is New Access Token |
[credentials.refreshToken] | string | Refresh Token |
[credentials.refreshTokenExpiresIn] | DateLikeNullable | Refresh Token Expires in |
tdAmeritradeAPI.authenticate ⇒ Promise.<APIResponse.<(AuthenticationResponse|null)>>
Authenticate with the TD Ameritrade OAuth2 Authorization endpoint
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
code | string | Authorization Resonse Code from TD Ameritrade Authentication API |
tdAmeritradeAPI.refreshAccessToken ⇒ Promise.<APIResponse.<(RefreshTokenResponse|null)>>
Refresh Access Token with Refresh Token
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
refresh_token | string | Refresh Token |
tdAmeritradeAPI.getAccounts ⇒ Promise.<APIResponse.<TDAmeritradeAccounts>>
Get Accounts
Kind: instance property of TDAmeritradeAPI
tdAmeritradeAPI.getAccount ⇒ Promise.<APIResponse.<TDAmeritradeAccount>>
Get Account
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
tdAmeritradeAPI.getUserPrincipals ⇒ Promise.<APIResponse.<UserPrincipalsData>>
Get User Principals Data - for use with schwab-td-ameritrade-streamer
Kind: instance property of TDAmeritradeAPI
tdAmeritradeAPI.getTransactions ⇒ Promise.<APIResponse.<Array.<TransactionData>>>
Get Transactions
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
transactionsType | GetTransactionsType | Transactions Type - Default 'TRADE' |
startDate | DateLikeNullable | Start Date |
endDate | DateLikeNullable | End Date |
tdAmeritradeAPI.getOrders ⇒ Promise.<APIResponse.<Array.<OrderData>>>
Get Order's for Account ID
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
tdAmeritradeAPI.getQuotes ⇒ Promise.<APIResponse.<Object.<string, QuoteData>>>
Get Quote Data for Ticker Symbol(s)
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
symbol | TickerSymbol | Ticker Symbol |
tdAmeritradeAPI.getInstrument ⇒ Promise.<APIResponse.<Array.<InstrumentData>>>
Get Instrument Data for CUSIP
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
cusip | CUSIP | CUSIP |
tdAmeritradeAPI.getFundamentals ⇒ Promise.<APIResponse.<Object.<string, FundamentalData>>>
Get Fundamental Data for Ticker Symbol
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
symbol | TickerSymbol | Ticker Symbol |
tdAmeritradeAPI.getMarketDirectionalMover ⇒ Promise.<APIResponse.<Array.<TrendingEquity>>>
Get Market Directional Mover (e.g. '$SPX.X', 'up', 'percent')
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
market | '$SPX.X' | '$DJI' | '$COMPX' | Market |
direction | 'up' | 'down' | Direction |
change | 'percent' | 'value' | Change Type |
tdAmeritradeAPI.getPriceHistory ⇒ Promise.<APIResponse.<PriceHistory>>
Get Intraday Price History for Ticker Symbol
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
symbol | TickerSymbol | Ticker Symbol |
days | number | Number of Days |
minutes | number | Minutes |
extHours | boolean | Extended Hours Data |
endDate | Date | number | End Date |
tdAmeritradeAPI.getDailyPriceHistory ⇒ Promise.<APIResponse.<PriceHistory>>
Get Daily Price History for Ticker Symbol
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
symbol | TickerSymbol | Ticker Symbol |
years | number | Number of Years |
days | number | Number of Days |
tdAmeritradeAPI.getWeeklyPriceHistory ⇒ Promise.<APIResponse.<PriceHistory>>
Get Weekly Price History for Ticker Symbol
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
symbol | TickerSymbol | Ticker Symbol |
years | number | Number of Years |
tdAmeritradeAPI.getPeriodicPriceHistory ⇒ Promise.<APIResponse.<PriceHistory>>
Get Periodic Price History for Ticker Symbol
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
symbol | TickerSymbol | Ticker Symbol |
startDate | DateLikeNullable | Start Date |
endDate | DateLikeNullable | End Date |
extHours | boolean | Extended Hours Data |
tdAmeritradeAPI.getMarketMovers ⇒ Promise.<APIResponse.<MarketMovers>>
Get Market Movers - Current Trending Equities of $SPX.X, $COMPX, $DJI
Kind: instance property of TDAmeritradeAPI
tdAmeritradeAPI.getOptionChain ⇒ Promise.<APIResponse.<OptionChainData>>
Get Option Chain
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
symbol | TickerSymbol | Ticker Symbol |
range | OptionContractRange | Option Contract Range - (ITM, OTM, NTM, etc..) |
optionType | OptionContractType | Option Contract Type - (Standard, Non Standard, All) |
tdAmeritradeAPI.getWatchlists ⇒ Promise.<APIResponse.<Watchlists>>
Get Watchlists
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
tdAmeritradeAPI.getWatchlist ⇒ Promise.<APIResponse.<Watchlist>>
Get Watchlist by ID
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
tdAmeritradeAPI.placeOrder ⇒ Promise.<APIResponse.<any>>
Place an Order
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
price | number | Price |
orderLegCollection | Array.<TDAmeritradeOrderLeg> | Order Leg Collection |
tdAmeritradeAPI.cancelOrder ⇒ Promise.<APIResponse.<any>>
Cancel an Order
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
orderId | string | Order ID |
tdAmeritradeAPI.openOrder ⇒ Promise.<APIResponse.<any>>
Opening Order
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
orderRequest | OrderRequest | Order Request |
orderRequest.accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
orderRequest.symbol | TickerSymbol | Ticker Symbol |
orderRequest.quantity | number | Quantity of Shares / Option Contracts |
orderRequest.price | number | Price |
isOption | boolean | Is Option Order |
isShort | boolean | Is Short Position |
tdAmeritradeAPI.closeOrder ⇒ Promise.<APIResponse.<any>>
Closing Order
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
orderRequest | OrderRequest | Order Request |
orderRequest.accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
orderRequest.symbol | TickerSymbol | Ticker Symbol |
orderRequest.quantity | number | Quantity of Shares / Option Contracts |
orderRequest.price | number | Price |
isOption | boolean | Is Option Order |
isShort | boolean | Is Short Position |
tdAmeritradeAPI.buyStock ⇒ Promise.<APIResponse.<any>>
Buy Equtity / Stock Convenience Method
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
orderRequest | OrderRequest | Order Request |
orderRequest.accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
orderRequest.symbol | TickerSymbol | Ticker Symbol |
orderRequest.quantity | number | Quantity of Shares / Option Contracts |
orderRequest.price | number | Price |
tdAmeritradeAPI.sellStock ⇒ Promise.<APIResponse.<any>>
Sell Equtity / Stock Convenience Method
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
orderRequest | OrderRequest | Order Request |
orderRequest.accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
orderRequest.symbol | TickerSymbol | Ticker Symbol |
orderRequest.quantity | number | Quantity of Shares / Option Contracts |
orderRequest.price | number | Price |
tdAmeritradeAPI.shortStock ⇒ Promise.<APIResponse.<any>>
Short Equtity / Stock Convenience Method
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
orderRequest | OrderRequest | Order Request |
orderRequest.accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
orderRequest.symbol | TickerSymbol | Ticker Symbol |
orderRequest.quantity | number | Quantity of Shares / Option Contracts |
orderRequest.price | number | Price |
tdAmeritradeAPI.coverStock ⇒ Promise.<APIResponse.<any>>
Cover Short Equtity / Stock Convenience Method
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
orderRequest | OrderRequest | Order Request |
orderRequest.accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
orderRequest.symbol | TickerSymbol | Ticker Symbol |
orderRequest.quantity | number | Quantity of Shares / Option Contracts |
orderRequest.price | number | Price |
tdAmeritradeAPI.buyOption ⇒ Promise.<APIResponse.<any>>
Buy Option Convenience Method
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
orderRequest | OrderRequest | Order Request |
orderRequest.accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
orderRequest.symbol | TickerSymbol | Ticker Symbol |
orderRequest.quantity | number | Quantity of Shares / Option Contracts |
orderRequest.price | number | Price |
tdAmeritradeAPI.sellOption ⇒ Promise.<APIResponse.<any>>
Sell Option Convenience Method
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
orderRequest | OrderRequest | Order Request |
orderRequest.accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
orderRequest.symbol | TickerSymbol | Ticker Symbol |
orderRequest.quantity | number | Quantity of Shares / Option Contracts |
orderRequest.price | number | Price |
tdAmeritradeAPI.writeOption ⇒ Promise.<APIResponse.<any>>
Write Option Convenience Method
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
orderRequest | OrderRequest | Order Request |
orderRequest.accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
orderRequest.symbol | TickerSymbol | Ticker Symbol |
orderRequest.quantity | number | Quantity of Shares / Option Contracts |
orderRequest.price | number | Price |
tdAmeritradeAPI.closeOption ⇒ Promise.<APIResponse.<any>>
Close Option Convenience Method
Kind: instance property of TDAmeritradeAPI
Param | Type | Description |
---|---|---|
orderRequest | OrderRequest | Order Request |
orderRequest.accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
orderRequest.symbol | TickerSymbol | Ticker Symbol |
orderRequest.quantity | number | Quantity of Shares / Option Contracts |
orderRequest.price | number | Price |
createTDAmeritradeAPIClient(config) ⇒ TDAmeritradeAPI
Creates a new instance of the TD Ameritrade API
Kind: global function
Param | Type | Description |
---|---|---|
config | APIClientConfig | API Client Configuration |
filterBuyTrades(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Filter Buy Trades
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
filterSellTrades(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Filter Sell Trades
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
filterOpeningTrades(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Filter Opening Trades
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
filterClosingTrades(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Filter Closing Trades
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
filterOpeningShortSales(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Filter Open Short Sale Trades
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
filterClosingShortSales(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Filter Closing Short Sale Trades
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
filterOptionTrades(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Filter Option Trades
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
filterEquityTrades(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Filter Equity Trades
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
groupByOrderId(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Group Trades by Order ID
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
groupByInstrument(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Group Trades by Instrument
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
groupByInstrumentSymbol(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Group Trades by Instrument Symbol
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
groupByInstrumentUnderlyingSymbol(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Group Trades by Instrument Underlying Symbol
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
groupByInstrumentCUSIP(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Group Trades by Instrument CUSIP
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
groupByAssetType(trades) ⇒ Array.<TransactionData>
[td-utils.js] - Group Trades by Asset Type
Kind: global function
Param | Type | Description |
---|---|---|
trades | Array.<TransactionData> | TRADE Transactions |
DateLikeNullable : Date
| string
| number
| null
Kind: global typedef
TickerSymbol : string
Kind: global typedef
CUSIP : string
Kind: global typedef
TDAmeritradeAccountID : string
Kind: global typedef
AssetType : 'EQUITY'
| 'OPTION'
Kind: global typedef
AcceptedOrRejected : 'ACCEPTED'
| 'REJECTED'
Kind: global typedef
PositionEffect : 'OPENING'
| 'CLOSING'
Kind: global typedef
BuyOrder : 'BUY'
| 'BUY_TO_OPEN'
| 'BUY_TO_CLOSE'
| 'BUY_TO_COVER'
Kind: global typedef
SellOrder : 'SELL'
| 'SELL_TO_OPEN'
| 'SELL_TO_CLOSE'
| 'SELL_SHORT'
Kind: global typedef
OrderDescription : 'BUY TRADE'
| 'SELL TRADE'
| 'SHORT SALE'
| 'CLOSE SHORT POSITION'
Kind: global typedef
GetTransactionsType : 'ALL'
| 'TRADE'
| 'BUY_ONLY'
| 'SELL_ONLY'
| 'CASH_IN_OR_CASH_OUT'
| 'CHECKING'
| 'DIVIDEND'
| 'INTEREST'
| 'ADVISOR_FEES'
| 'OTHER'
Kind: global typedef
TDAmeritradeAccounts : Array.<TDAmeritradeAccount>
Kind: global typedef
APIClientConfig : Object
Represents the configuration for the API client.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
[clientId] | string | The client ID for authentication (optional). |
[callbackUrl] | string | The callback URL for authentication (optional). |
[handleRequest] | function | A custom request handler function (optional). |
APIRequestConfig : Object
Represents the configuration for making an API request.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
url | string | The URL of the API endpoint. |
[method] | string | The HTTP method for the request (default is 'GET'). |
[params] | Object.<string, string> | Optional query parameters for the request. |
[headers] | Object.<string, string> | Optional HTTP headers for the request. |
[data] | Object | Array.<Object> | string | Array.<string> | number | Array.<number> | Optional request payload data. |
APIResponse : Object
Represents an API response.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
error | string | null | undefined | An error message (nullable and optional). |
data | T | null | undefined | The response data (nullable and optional). |
AuthenticationResponse : Object
TD Ameritrade API Authentication Response
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
access_token | string | Access Token |
refresh_token | string | Refresh Token |
scope | string | OAuth2 Scope |
token_type | string | Token Type |
expires_in | number | Access Token Expires in (seconds) |
refresh_token_expires_in | number | Refresh Token Expires in (seconds) |
RefreshTokenResponse : Object
TD Ameritrade API Refresh Token Response
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
access_token | string | Access Token |
scope | string | OAuth2 Scope |
token_type | string | Token Type |
expires_in | number | Access Token Expires in (seconds) |
TDAmeritradeAccount : Object
Represents a TD Ameritrade account.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
securitiesAccount | Object | Information about the securities account. |
securitiesAccount.accountId | TDAmeritradeAccountID | The account ID. |
securitiesAccount.currentBalances | CurrentBalances | The current balances. |
securitiesAccount.initialBalances | InitialBalances | The initial balances. |
securitiesAccount.projectedBalances | ProjectedBalances | The projected balances. |
securitiesAccount.isClosingOnlyRestricted | boolean | Indicates if the account is closing-only restricted. |
securitiesAccount.isDayTrader | boolean | Indicates if the account is a day trader account. |
securitiesAccount.roundtrips | number | The number of round trips. |
securitiesAccount.type | string | The account type. |
securitiesAccount.positions | Array.<PositionData> | The positions in the account. |
InstrumentData : Object
Represents stock information.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
cusip | CUSIP | The CUSIP (Committee on Uniform Securities Identification Procedures) number. |
symbol | TickerSymbol | The stock symbol. |
description | string | The description of the stock. |
exchange | string | The exchange where the stock is traded. |
assetType | AssetType | The asset type, such as "EQUITY". |
[underlyingSymbol] | string | The underlying symbol of the instrument. |
[optionExpirationDate] | DateLikeNullable | The option expiration date in ISO 8601 format. |
[putCall] | 'PUT' | 'CALL' | The type of option (e.g., "CALL" or "PUT"). |
QuoteData : Object
Represents stock data.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
assetType | AssetType | The asset type. |
assetMainType | string | The asset main type. |
cusip | CUSIP | The CUSIP. |
assetSubType | string | The asset sub type. |
symbol | TickerSymbol | The stock symbol. |
description | string | The stock description. |
bidPrice | number | The bid price. |
bidSize | number | The bid size. |
bidId | string | The bid ID. |
askPrice | number | The ask price. |
askSize | number | The ask size. |
askId | string | The ask ID. |
lastPrice | number | The last price. |
lastSize | number | The last size. |
lastId | string | The last ID. |
openPrice | number | The opening price. |
highPrice | number | The highest price of the day. |
lowPrice | number | The lowest price of the day. |
bidTick | string | The bid tick. |
closePrice | number | The closing price. |
netChange | number | The net price change. |
totalVolume | number | The total volume. |
quoteTimeInLong | number | The quote time in long format. |
tradeTimeInLong | number | The trade time in long format. |
mark | number | The mark price. |
exchange | string | The exchange. |
exchangeName | string | The exchange name. |
marginable | boolean | Indicates if it's marginable. |
shortable | boolean | Indicates if it's shortable. |
volatility | number | The volatility. |
digits | number | The number of digits. |
nAV | number | The NAV (Net Asset Value). |
peRatio | number | The P/E (Price-to-Earnings) ratio. |
divAmount | number | The dividend amount. |
divYield | number | The dividend yield. |
divDate | string | The dividend date. |
securityStatus | string | The security status. |
regularMarketLastPrice | number | The last price in the regular market. |
regularMarketLastSize | number | The last size in the regular market. |
regularMarketNetChange | number | The net change in the regular market. |
regularMarketTradeTimeInLong | number | The trade time in long format in the regular market. |
netPercentChangeInDouble | number | The net percent change in double format. |
markChangeInDouble | number | The mark change in double format. |
markPercentChangeInDouble | number | The mark percent change in double format. |
delayed | boolean | Indicates if the data is delayed. |
realtimeEntitled | boolean | Indicates if real-time data is entitled. |
Fundamentals : Object
Represents fundamental data for a stock.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
symbol | TickerSymbol | The stock symbol. |
high52 | number | The 52-week high price. |
low52 | number | The 52-week low price. |
dividendAmount | number | The dividend amount. |
dividendYield | number | The dividend yield. |
dividendDate | string | The dividend date. |
peRatio | number | The Price-to-Earnings (P/E) ratio. |
pegRatio | number | The Price/Earnings to Growth (PEG) ratio. |
pbRatio | number | The Price-to-Book (P/B) ratio. |
prRatio | number | The Price-to-Revenue (P/R) ratio. |
pcfRatio | number | The Price-to-Cash Flow (P/CF) ratio. |
grossMarginTTM | number | The gross margin trailing twelve months (TTM). |
grossMarginMRQ | number | The gross margin most recent quarter (MRQ). |
netProfitMarginTTM | number | The net profit margin TTM. |
netProfitMarginMRQ | number | The net profit margin MRQ. |
operatingMarginTTM | number | The operating margin TTM. |
operatingMarginMRQ | number | The operating margin MRQ. |
returnOnEquity | number | The return on equity. |
returnOnAssets | number | The return on assets. |
returnOnInvestment | number | The return on investment. |
quickRatio | number | The quick ratio. |
currentRatio | number | The current ratio. |
interestCoverage | number | The interest coverage. |
totalDebtToCapital | number | The total debt to capital ratio. |
ltDebtToEquity | number | The long-term debt to equity ratio. |
totalDebtToEquity | number | The total debt to equity ratio. |
epsTTM | number | The earnings per share TTM. |
epsChangePercentTTM | number | The percentage change in earnings per share TTM. |
epsChangeYear | number | The change in earnings per share in a year. |
epsChange | number | The overall change in earnings per share. |
revChangeYear | number | The change in revenue in a year. |
revChangeTTM | number | The change in revenue TTM. |
revChangeIn | number | The percentage change in revenue. |
sharesOutstanding | number | The number of outstanding shares. |
marketCapFloat | number | The market capitalization (float). |
marketCap | number | The total market capitalization. |
bookValuePerShare | number | The book value per share. |
shortIntToFloat | number | The short interest to float ratio. |
shortIntDayToCover | number | The short interest days to cover. |
divGrowthRate3Year | number | The 3-year dividend growth rate. |
dividendPayAmount | number | The dividend payment amount. |
dividendPayDate | string | The dividend payment date. |
beta | number | The beta value. |
vol1DayAvg | number | The average volume over 1 day. |
vol10DayAvg | number | The average volume over 10 days. |
vol3MonthAvg | number | The average volume over 3 months. |
FundamentalData : Object
Represents Fundamental Data
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
fundamental | Fundamentals | Fundamental data for the stock. |
cusip | CUSIP | The CUSIP. |
symbol | TickerSymbol | The stock symbol. |
description | string | The stock description. |
exchange | string | The exchange where the stock is traded. |
assetType | string | The asset type. |
OHLC : Object
Represents Open, High, Low Close Values
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
open | number | The opening price. |
high | number | The highest price during the period. |
low | number | The lowest price during the period. |
close | number | The closing price. |
OHLCVolume : Object
Represents OHLC with Volume Values
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
open | number | The opening price. |
high | number | The highest price during the period. |
low | number | The lowest price during the period. |
close | number | The closing price. |
volume | number | The trading volume. |
Candlestick : Object
Represents a candlestick.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
open | number | The opening price. |
high | number | The highest price during the period. |
low | number | The lowest price during the period. |
close | number | The closing price. |
volume | number | The trading volume. |
datetime | number | The timestamp of the candlestick. |
PriceHistory : Object
Represents candlestick data.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
candles | Array.<Candlestick> | An array of candlesticks. |
symbol | TickerSymbol | The symbol associated with the data. |
empty | boolean | Indicates whether the data is empty. |
OptionContractData : Object
Represents option contract data.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
putCall | string | The option type (e.g., "CALL" or "PUT"). |
symbol | TickerSymbol | The option symbol. |
description | string | A description of the option contract. |
exchangeName | string | The exchange where the option is traded. |
bid | number | The bid price for the option. |
ask | number | The ask price for the option. |
last | number | The last traded price for the option. |
mark | number | The mark price for the option. |
bidSize | number | The size of the bid for the option. |
askSize | number | The size of the ask for the option. |
bidAskSize | string | The bid and ask sizes (e.g., "45X25"). |
lastSize | number | The size of the last trade for the option. |
highPrice | number | The highest price of the option. |
lowPrice | number | The lowest price of the option. |
openPrice | number | The opening price of the option. |
closePrice | number | The closing price of the option. |
totalVolume | number | The total trading volume for the option. |
tradeDate | Date | null | The date of the last trade (nullable). |
tradeTimeInLong | number | The timestamp of the last trade. |
quoteTimeInLong | number | The timestamp of the quote. |
netChange | number | The net change in the option price. |
volatility | number | The volatility of the option. |
delta | number | The delta value of the option. |
gamma | number | The gamma value of the option. |
theta | number | The theta value of the option. |
vega | number | The vega value of the option. |
rho | number | The rho value of the option. |
openInterest | number | The open interest in the option. |
timeValue | number | The time value of the option. |
theoreticalOptionValue | number | The theoretical option value. |
theoreticalVolatility | number | The theoretical volatility of the option. |
optionDeliverablesList | string | null | The list of option deliverables (nullable). |
strikePrice | number | The strike price of the option. |
expirationDate | number | The expiration date of the option (timestamp). |
daysToExpiration | number | The number of days to option expiration. |
expirationType | string | The type of expiration (e.g., "S" for standard). |
lastTradingDay | number | The last trading day (timestamp). |
multiplier | number | The multiplier for the option (e.g., 100 for standard options). |
settlementType | string | The settlement type (e.g., " " for space). |
deliverableNote | string | A note about deliverables. |
isIndexOption | boolean | null | Indicates if the option is an index option (nullable). |
percentChange | number | The percentage change in the option price. |
markChange | number | The change in the mark price. |
markPercentChange | number | The percentage change in the mark price. |
intrinsicValue | number | The intrinsic value of the option. |
pennyPilot | boolean | Indicates if the option is part of the penny pilot program. |
nonStandard | boolean | Indicates if the option is non-standard. |
inTheMoney | boolean | Indicates if the option is in the money. |
mini | boolean | Indicates if the option is a mini option. |
UnderlyingAsset : Object
Represents information about the underlying asset.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
symbol | TickerSymbol | The symbol of the underlying asset. |
description | string | The description of the underlying asset. |
change | number | The change in the underlying asset's price. |
percentChange | number | The percentage change in the underlying asset's price. |
close | number | The closing price of the underlying asset. |
quoteTime | number | The timestamp of the underlying asset's quote time. |
tradeTime | number | The timestamp of the underlying asset's trade time. |
bid | number | The bid price for the underlying asset. |
ask | number | The ask price for the underlying asset. |
last | number | The last traded price for the underlying asset. |
mark | number | The mark price for the underlying asset. |
markChange | number | The change in the mark price for the underlying asset. |
markPercentChange | number | The percentage change in the mark price for the underlying asset. |
bidSize | number | The size of the bid for the underlying asset. |
askSize | number | The size of the ask for the underlying asset. |
highPrice | number | The highest price of the underlying asset. |
lowPrice | number | The lowest price of the underlying asset. |
openPrice | number | The opening price of the underlying asset. |
totalVolume | number | The total trading volume for the underlying asset. |
exchangeName | string | The name of the exchange where the underlying asset is traded. |
fiftyTwoWeekHigh | number | The fifty-two week high price of the underlying asset. |
fiftyTwoWeekLow | number | The fifty-two week low price of the underlying asset. |
delayed | boolean | Indicates if the data is delayed for the underlying asset. |
OptionContractDateMap : Object.<string, Array.<OptionContractData>>
Represents a mapping of option contract data by expiration date.
Kind: global typedef
OptionChainData : Object
Represents option chain data.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
symbol | TickerSymbol | The symbol. |
status | string | The status of the option chain (e.g., "SUCCESS"). |
underlying | UnderlyingAsset | Information about the underlying asset. |
strategy | string | The trading strategy (e.g., "SINGLE"). |
interval | number | The interval. |
isDelayed | boolean | Indicates if the data is delayed. |
isIndex | boolean | Indicates if the data is related to an index. |
interestRate | number | The interest rate. |
underlyingPrice | number | The price of the underlying asset. |
volatility | number | The volatility. |
daysToExpiration | number | The number of days to expiration. |
numberOfContracts | number | The number of contracts. |
putExpDateMap | OptionContractDateMap | Map of put expiration dates and their data. |
callExpDateMap | OptionContractDateMap | Map of call expiration dates and their data. |
WatchlistItemInstrument : Object
Represents an instrument.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
symbol | TickerSymbol | The symbol of the instrument. |
assetType | AssetType | The asset type of the instrument (e.g., "EQUITY"). |
WatchlistItem : Object
Represents an instrument within a watchlist.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
sequenceId | number | The sequence ID of the watchlist item. |
quantity | number | The quantity of the instrument. |
averagePrice | number | The average price of the instrument. |
commission | number | The commission associated with the instrument. |
instrument | WatchlistItemInstrument | The instrument details. |
Watchlist : Object
Represents a watchlist.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
name | string | The name of the watchlist. |
watchlistId | string | The ID of the watchlist. |
accountId | string | The ID of the account associated with the watchlist. |
watchlistItems | Array.<WatchlistItem> | The list of watchlist items. |
Watchlists : Array.<Watchlist>
Represents multiple watchlists.
Kind: global typedef
CurrentBalances : Object
Represents an account's financial summary.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
accruedInterest | number | Accrued interest. |
cashBalance | number | Cash balance. |
cashReceipts | number | Cash receipts. |
longOptionMarketValue | number | Long option market value. |
liquidationValue | number | Liquidation value. |
longMarketValue | number | Long market value. |
moneyMarketFund | number | Money market fund. |
savings | number | Savings amount. |
shortMarketValue | number | Short market value. |
pendingDeposits | number | Pending deposits. |
availableFunds | number | Available funds. |
availableFundsNonMarginableTrade | number | Available funds for non-marginable trade. |
buyingPower | number | Buying power. |
buyingPowerNonMarginableTrade | number | Buying power for non-marginable trade. |
dayTradingBuyingPower | number | Day trading buying power. |
equity | number | Equity. |
equityPercentage | number | Equity percentage. |
longMarginValue | number | Long margin value. |
maintenanceCall | number | Maintenance call amount. |
maintenanceRequirement | number | Maintenance requirement. |
marginBalance | number | Margin balance. |
regTCall | number | Regulation T call amount. |
shortBalance | number | Short balance. |
shortMarginValue | number | Short margin value. |
shortOptionMarketValue | number | Short option market value. |
sma | number | Special memorandum account (SMA). |
mutualFundValue | number | Mutual fund value. |
bondValue | number | Bond value. |
InitialBalances : Object
Represents an account's financial summary.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
accruedInterest | number | Accrued interest. |
availableFundsNonMarginableTrade | number | Available funds for non-marginable trade. |
bondValue | number | Bond value. |
buyingPower | number | Buying power. |
cashBalance | number | Cash balance. |
cashAvailableForTrading | number | Cash available for trading. |
cashReceipts | number | Cash receipts. |
dayTradingBuyingPower | number | Day trading buying power. |
dayTradingBuyingPowerCall | number | Day trading buying power call. |
dayTradingEquityCall | number | Day trading equity call. |
equity | number | Equity. |
equityPercentage | number | Equity percentage. |
liquidationValue | number | Liquidation value. |
longMarginValue | number | Long margin value. |
longOptionMarketValue | number | Long option market value. |
longStockValue | number | Long stock value. |
maintenanceCall | number | Maintenance call amount. |
maintenanceRequirement | number | Maintenance requirement. |
margin | number | Margin amount. |
marginEquity | number | Margin equity. |
moneyMarketFund | number | Money market fund. |
mutualFundValue | number | Mutual fund value. |
regTCall | number | Regulation T call amount. |
shortMarginValue | number | Short margin value. |
shortOptionMarketValue | number | Short option market value. |
shortStockValue | number | Short stock value. |
totalCash | number | Total cash. |
isInCall | number | Is in call status. |
pendingDeposits | number | Pending deposits. |
marginBalance | number | Margin balance. |
shortBalance | number | Short balance. |
accountValue | number | Account value. |
ProjectedBalances : Object
Represents account-related data.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
availableFunds | number | The available funds in the account. |
availableFundsNonMarginableTrade | number | The available funds for non-marginable trades. |
buyingPower | number | The buying power of the account. |
dayTradingBuyingPower | number | The buying power for day trading. |
dayTradingBuyingPowerCall | number | The day trading buying power call. |
maintenanceCall | number | The maintenance call. |
regTCall | number | The Regulation T (Reg T) call. |
isInCall | number | Indicates whether the account is in a call state. |
stockBuyingPower | number | The buying power for stock trades. |
PositionData : Object
Represents data related to a trading position.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
shortQuantity | number | The quantity of short positions. |
averagePrice | number | The average price of the positions. |
currentDayCost | number | The current day cost. |
currentDayProfitLoss | number | The current day profit or loss. |
currentDayProfitLossPercentage | number | The percentage of profit or loss for the current day. |
longQuantity | number | The quantity of long positions. |
settledLongQuantity | number | The settled quantity of long positions. |
settledShortQuantity | number | The settled quantity of short positions. |
instrument | InstrumentData | Information about the financial instrument. |
marketValue | number | The market value of the positions. |
maintenanceRequirement | number | The maintenance requirement. |
previousSessionLongQuantity | number | The quantity of long positions from the previous session. |
ExchangeDelayStatus : Object
Represents a delay status for various exchanges.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
isNyseDelayed | boolean | Indicates if NYSE data is delayed. |
isNasdaqDelayed | boolean | Indicates if NASDAQ data is delayed. |
isOpraDelayed | boolean | Indicates if OPRA data is delayed. |
isAmexDelayed | boolean | Indicates if AMEX data is delayed. |
isCmeDelayed | boolean | Indicates if CME data is delayed. |
isIceDelayed | boolean | Indicates if ICE data is delayed. |
isForexDelayed | boolean | Indicates if Forex data is delayed. |
StreamerSubscriptionKey : Object
Represents a single streamer subscription key.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
key | string | The subscription key. |
StreamerSubscriptionKeys : Object
Represents an array of streamer subscription keys.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
keys | Array.<StreamerSubscriptionKey> | An array of streamer subscription keys. |
StreamerInfo : Object
Represents streamer information.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
accessLevel | string | The access level of the streamer. |
acl | string | The ACL (Access Control List) of the streamer. |
appId | string | The application ID of the streamer. |
streamerBinaryUrl | string | The binary URL of the streamer. |
streamerSocketUrl | string | The socket URL of the streamer. |
token | string | The token for authentication. |
tokenTimestamp | DateLikeNullable | The timestamp of the token. |
userGroup | string | The user group of the streamer. |
UserPrincipalAccount : Object
Represents an account with its preferences and authorizations.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
accountId | string | Account ID. |
displayName | string | The display name of the account. |
accountCdDomainId | string | The domain ID for the account. |
company | string | The company associated with the account. |
segment | string | The account segment. |
surrogateIds | Object.<string, string> | Surrogate IDs for the account. |
preferences | Object.<string, boolean> | Account preferences. |
acl | string | Access control list for the account. |
authorizations | Object.<string, boolean> | Account authorizations. |
UserPrincipalsData : Object
Represents principal data.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
accessLevel | string | The access level of the principal. |
accounts | Array.<UserPrincipalAccount> | Accounts |
exchangeAgreements | Object | Exchange agreements status. |
exchangeAgreements.NASDAQ_EXCHANGE_AGREEMENT | AcceptedOrRejected | NASDAQ exchange agreement status. |
exchangeAgreements.NYSE_EXCHANGE_AGREEMENT | AcceptedOrRejected | NYSE exchange agreement status. |
exchangeAgreements.OPRA_EXCHANGE_AGREEMENT | AcceptedOrRejected | OPRA exchange agreement status. |
lastLoginTime | DateLikeNullable | The timestamp of the last login time. |
loginTime | DateLikeNullable | The timestamp of the login time. |
primaryAccountId | TDAmeritradeAccountID | The primary account ID. |
professionaStatus | 'PROFESSIONAL' | 'NON_PROFESSIONAL' | The professional status. |
stalePassword | boolean | Indicates if the password is stale. |
tokenExpirationTime | DateLikeNullable | The timestamp of the token expiration time. |
userCdDomainId | string | The user's CD domain ID. |
userId | string | The user ID. |
streamerSubscriptionKeys | Array.<StreamerSubscriptionKeys> | An array of streamer subscription keys. |
quotes | ExchangeDelayStatus | Exchange delay status. |
streamerInfo | StreamerInfo | Streamer information. |
TradeTransactionFees : Object
Represents fees associated with a trade transaction.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
rFee | number | The R fee. |
additionalFee | number | Additional fees. |
cdscFee | number | CDSC (Contingent Deferred Sales Charge) fee. |
regFee | number | Registration fee. |
otherCharges | number | Other charges. |
commission | number | Commission fee. |
optRegFee | number | Options registration fee. |
secFee | number | SEC (U.S. Securities and Exchange Commission) fee. |
TransactionItem : Object
Represents a trade transaction item.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
accountId | TDAmeritradeAccountID | The ID of the account associated with the transaction item. |
amount | number | The amount of the transaction item. |
price | number | The price of the transaction item. |
positionEffect | PositionEffect | The position effect (e.g., "OPENING"). |
cost | number | The cost associated with the transaction item. |
instruction | BuyOrder | SellOrder | The instruction for the transaction item (e.g., "BUY"). |
instrument | InstrumentData | Information about the instrument involved in the transaction item. |
TransactionData : Object
Represents a trade transaction.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
type | string | The type of transaction (e.g., "TRADE"). |
subAccount | string | The sub-account associated with the transaction. |
settlementDate | DateLikeNullable | The settlement date of the transaction (e.g., "2022-09-14"). |
orderId | string | The ID of the order associated with the transaction. |
netAmount | number | The net amount of the transaction. |
transactionDate | DateLikeNullable | The date and time of the transaction in ISO 8601 format. |
orderDate | DateLikeNullable | The date and time when the order was placed in ISO 8601 format. |
transactionSubType | string | The sub-type of the transaction (e.g., "BY"). |
transactionId | number | The unique ID of the transaction. |
cashBalanceEffectFlag | boolean | Indicates whether the transaction affects the cash balance. |
description | OrderDescription | A description of the transaction. |
fees | TradeTransactionFees | Object containing various fee information related to the transaction. |
transactionItem | TransactionItem | Detailed information about the transaction item. |
OrderRequest : Object
Order Request
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
accountId | TDAmeritradeAccountID | TD Ameritrade Account ID |
symbol | TickerSymbol | Ticker Symbol |
quantity | number | Quantity of Shares / Option Contracts |
price | number | Price |
TDAmeritradeOrderLeg : Object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
instruction | BuyOrder | SellOrder | Instruction |
quantity | number | Quantity of Shares / Option Contracts |
instrument | Object | Instrument |
instrument.symbol | TickerSymbol | Ticker Symbol |
instrument.assetType | AssetType | Asset Type |
OrderData : Object
Represents an order object.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
session | string | The trading session for the order (e.g., "SEAMLESS"). |
duration | string | The duration of the order (e.g., "GOOD_TILL_CANCEL"). |
orderType | string | The type of the order (e.g., "LIMIT"). |
complexOrderStrategyType | string | The strategy type for complex orders (e.g., "NONE"). |
quantity | number | The total quantity of the order. |
filledQuantity | number | The quantity of the order that has been filled. |
remainingQuantity | number | The remaining quantity of the order. |
requestedDestination | string | The requested destination for the order (e.g., "AUTO"). |
destinationLinkName | string | The link name for the destination (e.g., "AutoRoute"). |
price | number | The price per unit of the order. |
orderLegCollection | Array.<OrderLeg> | An array of order legs. |
orderStrategyType | string | The strategy type for the order (e.g., "SINGLE"). |
orderId | number | The unique identifier for the order. |
cancelable | boolean | Indicates whether the order is cancelable. |
editable | boolean | Indicates whether the order is editable. |
status | string | The status of the order (e.g., "WORKING"). |
enteredTime | DateLikeNullable | The timestamp when the order was entered in ISO 8601 format. |
tag | string | A tag associated with the order (e.g., "tIP"). |
accountId | TDAmeritradeAccountID | The ID of the account associated with the order. |
OrderLeg : Object
Represents an order leg within an order.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
orderLegType | string | The type of the order leg (e.g., "EQUITY"). |
legId | number | The unique identifier for the order leg. |
instrument | InstrumentData | Information about the financial instrument. |
instruction | BuyOrder | SellOrder | The instruction for the order leg (e.g., "BUY"). |
positionEffect | PositionEffect | The position effect of the order leg (e.g., "OPENING"). |
quantity | number | The quantity of the order leg. |
TrendingEquity : Object
Represents Market Mover Trending Equity data.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
change | number | The change in stock status. Negative values indicate a decrease. |
description | string | The description of the stock status. |
direction | string | The direction of the change (e.g., "up" or "down"). |
last | number | The last traded price of the stock. |
symbol | string | The stock symbol. |
totalVolume | number | The total trading volume for the stock. |
MarketMovers : Object
Represents Market Movers - Current Trending Equities of $SPX.X, $COMPX, $DJI
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
up | Array.<TrendingEquity> | Equities Trending up |
down | Array.<TrendingEquity> | Equities Trending down |