Skip to main content

td-streamer

Classes

TDAmeritradeStreamEventProcessor
TDAmeritradeStreamer

Constants

STATE

Functions

createTDAmeritradeStreamer(streamerConnectionOptions, handleLevelOneFeedUpdate, handleLevelOneTimeSaleUpdate)TDAmeritradeStreamer

Creates a new instance of TD Ameritrade Streamer

Typedefs

TickerSymbolKeys : string | Array.<string>

Single Symbol, Comma Seperated Symbols or Array of Symbols ("SPY" | "SPY, QQQ" | ["SPY", "QQQ"])

FuturesSymbol : string | Array.<string>
TDAmeritradeStreamerConnectionOptions : Object

TD Ameritrade Stream Connection Options

TDAmeritradeStreamerCommand : Object
TDAmeritradeStreamServiceResponse : Object

TD Ameritrade Stream Response

TDAmeritradeStreamDataResponse : Object

TD Ameritrade Data Response

TDAmeritradeStreamNotifyResponse : Object

TD Ameritrade Stream Notify Response

TDAmeritradeStreamEventProcessor

Kind: global class

new TDAmeritradeStreamEventProcessor()

Represents the TDAmeritradeStreamEventProcessor class for processing stream messages / events.

tdAmeritradeStreamEventProcessor.TDAmeritradeStreamEventProcessor

Kind: instance class of TDAmeritradeStreamEventProcessor

new exports.TDAmeritradeStreamEventProcessor(emitter, [handleLevelOneFeedUpdate], [handleLevelOneTimeSaleUpdate])

TDAmeritradeStreamEventProcessor - Handle's stream response

ParamTypeDescription
emitterEventEmitteran instance of EventEmitter
[handleLevelOneFeedUpdate]functionCustom L1 feed data callback
[handleLevelOneTimeSaleUpdate]functionCustom L1 time & sales feed data callback

tdAmeritradeStreamEventProcessor.emitter : EventEmitter

Kind: instance property of TDAmeritradeStreamEventProcessor

tdAmeritradeStreamEventProcessor.handleMessage(TDAmeritradeStreamResponse)

Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: AUTHORIZED, CHART_SNAPSHOT, CHART_UPDATE

ParamTypeDescription
TDAmeritradeStreamResponseTDAmeritradeStreamEventProcessorEventMessage
TDAmeritradeStreamResponse.responseTDAmeritradeStreamServiceResponseResponse
TDAmeritradeStreamResponse.dataArray.<TDAmeritradeStreamDataResponse>Response Data
TDAmeritradeStreamResponse.snapshotTDAmeritradeStreamDataResponseResponse Data Snapshot

tdAmeritradeStreamEventProcessor.emitEvent(evt, [data])

Emits Events

Kind: instance method of TDAmeritradeStreamEventProcessor

ParamTypeDescription
evtstringEvent Name
[data]Object | Array | string | number | booleanEvent Data

tdAmeritradeStreamEventProcessor.handleAccountActivity(msg)

Handles Account Activity

Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: ACCT_ACTIVITY

ParamTypeDescription
msgTDAmeritradeStreamDataResponseStream Data Response

tdAmeritradeStreamEventProcessor.handleQuotes(msg)

Handles Quotes

Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: QUOTE

ParamTypeDescription
msgTDAmeritradeStreamDataResponseStream Data Response

tdAmeritradeStreamEventProcessor.handleTimeSales(msg)

Handles Time & Sales

Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: TIMESALE_EQUITY_UPDATE

ParamTypeDescription
msgTDAmeritradeStreamDataResponseStream Data Response

tdAmeritradeStreamEventProcessor.handleOptions(msg)

Handles Options

Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: OPTION

ParamTypeDescription
msgTDAmeritradeStreamDataResponseStream Data Response

tdAmeritradeStreamEventProcessor.handleLevelOneFutures(msg)

Handles Futures Level One / Time & Sales

Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: TIMESALE_FUTURES_UPDATE, LEVELONE_FUTURES_UPDATE

ParamTypeDescription
msgTDAmeritradeStreamDataResponseStream Data Response

tdAmeritradeStreamEventProcessor.handleNews(msg)

Handle News Headlines

Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: NEWS_HEADLINE

ParamType
msgTDAmeritradeStreamDataResponse

tdAmeritradeStreamEventProcessor.handleActivesNasdaq(msg)

Handle Nasdaq Active Equities

Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: ACTIVES_NASDAQ

ParamType
msgTDAmeritradeStreamDataResponse

tdAmeritradeStreamEventProcessor.handleActivesNYSE(msg)

Handle NYSE Active Equities

Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: ACTIVES_NYSE

ParamType
msgTDAmeritradeStreamDataResponse

tdAmeritradeStreamEventProcessor.handleListedBook(msg)

Handle Nasdaq Order Book

Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: LISTED_BOOK

ParamType
msgTDAmeritradeStreamDataResponse

tdAmeritradeStreamEventProcessor.handleNasdaqBook(msg)

Handle Nasdaq Order Book

Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: NASDAQ_BOOK

ParamType
msgTDAmeritradeStreamDataResponse

tdAmeritradeStreamEventProcessor.handleActiveOptions(msg)

Handle Active Options

Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: ACTIVES_OPTIONS

ParamType
msgTDAmeritradeStreamDataResponse

TDAmeritradeStreamer

Kind: global class

new TDAmeritradeStreamer()

Represents the TDAmeritradeStreamer class for handling streaming.

tdAmeritradeStreamer.TDAmeritradeStreamer

Kind: instance class of TDAmeritradeStreamer

new exports.TDAmeritradeStreamer(streamerConnectionOptions, [handleLevelOneFeedUpdate], [handleLevelOneTimeSaleUpdate])

ParamTypeDescription
streamerConnectionOptionsTDAmeritradeStreamerConnectionOptionsStreamer Connection Options
[handleLevelOneFeedUpdate]functionCustom L1 feed data callback
[handleLevelOneTimeSaleUpdate]functionCustom L1 time & sales feed data callback

tdAmeritradeStreamer.on(evt, method, context)

EventEmitter on event handler

Kind: instance method of TDAmeritradeStreamer

ParamTypeDescription
evtstringEvent Name
methodstringMethod
context*Context

tdAmeritradeStreamer.add(evt, method, context)

EventEmitter addListener handler

Kind: instance method of TDAmeritradeStreamer

ParamTypeDescription
evtstringEvent Name
methodstringMethod
context*Context

tdAmeritradeStreamer.subscribeAccountActivity()

Subscribe to Account Activity Service

Kind: instance method of TDAmeritradeStreamer

tdAmeritradeStreamer.getChartHistoryAndSubscribeQuotes(symbol)

Subscribe to Chart and Quotes Service

Kind: instance method of TDAmeritradeStreamer

ParamType
symbolTickerSymbolKeys

tdAmeritradeStreamer.subscribeQuotes(symbol)

Subscribe to Quote Service

Kind: instance method of TDAmeritradeStreamer

ParamType
symbolTickerSymbolKeys

tdAmeritradeStreamer.subscribeCharts(symbol)

Subscribe to Chart Equity Service

Kind: instance method of TDAmeritradeStreamer

ParamType
symbolTickerSymbolKeys

tdAmeritradeStreamer.subscribeOptions(symbol)

Subscribe to Option Service

Kind: instance method of TDAmeritradeStreamer

ParamType
symbolTickerSymbolKeys

tdAmeritradeStreamer.subscribeTimeAndSales(symbol)

Subscribe to Time & Sales Equity Service

Kind: instance method of TDAmeritradeStreamer

ParamType
symbolTickerSymbolKeys

tdAmeritradeStreamer.subscribeFutures(symbol)

Subscribe to Futures Chart History, Chart, Time & Sales & Level One Services

Kind: instance method of TDAmeritradeStreamer

ParamTypeDefault
symbolTickerSymbolKeys/ES

tdAmeritradeStreamer.subscribeTimeSalesFutures(symbol)

Subscribe to Futures Time & Sales Service

Kind: instance method of TDAmeritradeStreamer

ParamTypeDefault
symbolTickerSymbolKeys/ES

tdAmeritradeStreamer.subscribeFuturesOptions(symbol)

Subscribe to Level One Futures Options Service './EW1X20C3510, ./EW1X20C3525'

Kind: instance method of TDAmeritradeStreamer

ParamType
symbolTickerSymbolKeys

tdAmeritradeStreamer.subscribeActives()

Subscribe to Actives Feed

Kind: instance method of TDAmeritradeStreamer

tdAmeritradeStreamer.subscribeNewsHeadlines(symbol)

Subscribe to News Headlines

Kind: instance method of TDAmeritradeStreamer

ParamTypeDefault
symbolTickerSymbolKeysALL

tdAmeritradeStreamer.setQualityOfService(qoslevel)

Set Quality of Service Level

0 = Express(500 ms) 1 = Real - Time(750 ms) default value for http binary protocol 2 = Fast(1, 000 ms) default value for websocket and http asynchronous protocol 3 = Moderate(1, 500 ms) 4 = Slow(3, 000 ms) 5 = Delayed(5, 000 ms)

Kind: instance method of TDAmeritradeStreamer

ParamTypeDefaultDescription
qoslevelnumber0Quality of Service level

tdAmeritradeStreamer.subscribeListedBook(symbol)

Subscribe to Listed Order Book Service

Kind: instance method of TDAmeritradeStreamer

ParamType
symbolTickerSymbolKeys

tdAmeritradeStreamer.subscribeNasdaqBook(symbol)

Subscribe to Nasdaq Order Book Service

Kind: instance method of TDAmeritradeStreamer

ParamType
symbolTickerSymbolKeys

tdAmeritradeStreamer.subscribeOptionsBook(symbol)

Subscribe to Options Order Book Service

Kind: instance method of TDAmeritradeStreamer

ParamType
symbolTickerSymbolKeys

"AUTHORIZED" (data)

Emitted when AUTHORIZED streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"ACCT_ACTIVITY" (data)

Emitted when ACCT_ACTIVITY streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"QUOTE" (data)

Emitted when QUOTE streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"TIMESALE_EQUITY_UPDATE" (data)

Emitted when TIMESALE_EQUITY_UPDATE streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"OPTION" (data)

Emitted when OPTION streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"TIMESALE_FUTURES_UPDATE" (data)

Emitted when TIMESALE_FUTURES_UPDATE streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"LEVELONE_FUTURES_UPDATE" (data)

Emitted when LEVELONE_FUTURES_UPDATE streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"NEWS_HEADLINE" (data)

Emitted when NEWS_HEADLINE streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"ACTIVES_NASDAQ" (data)

Emitted when ACTIVES_NASDAQ streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"ACTIVES_NYSE" (data)

Emitted when ACTIVES_NYSE streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"ACTIVES_OPTIONS" (data)

Emitted when ACTIVES_OPTIONS streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"LISTED_BOOK" (data)

Emitted when LISTED_BOOK streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"NASDAQ_BOOK" (data)

Emitted when NASDAQ_BOOK streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"CHART_SNAPSHOT" (data)

Emitted when CHART_SNAPSHOT streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

"CHART_UPDATE" (data)

Emitted when CHART_UPDATE streamer event is emitted.

Kind: event emitted by TDAmeritradeStreamer

ParamTypeDescription
dataObjectStream Event Data

STATE

Kind: global constant
Author: Allen Sarkisyan
License: MIT Open Source License
Copyright: 2019 - 2023 XT-TX

createTDAmeritradeStreamer(streamerConnectionOptions, handleLevelOneFeedUpdate, handleLevelOneTimeSaleUpdate) ⇒ TDAmeritradeStreamer

Creates a new instance of TD Ameritrade Streamer

Kind: global function

ParamTypeDescription
streamerConnectionOptionsTDAmeritradeStreamerConnectionOptionsAPI Client Configuration
handleLevelOneFeedUpdatefunctionLevel one feed callback
handleLevelOneTimeSaleUpdatefunctionLevel one time & sales callback

TickerSymbolKeys : string | Array.<string>

Single Symbol, Comma Seperated Symbols or Array of Symbols ("SPY" | "SPY, QQQ" | ["SPY", "QQQ"])

Kind: global typedef

FuturesSymbol : string | Array.<string>

Kind: global typedef

TDAmeritradeStreamerConnectionOptions : Object

TD Ameritrade Stream Connection Options

Kind: global typedef
Properties

NameTypeDescription
primaryAccountIdstringPrimary Account ID
accountIdstringAccount ID to connect
tokenstringToken from streamerInfo
accountCdDomainIdstringAccount CD Domain ID from accounts
streamerSocketUrlstringStreamer Socket URL
tokenTimestampDateToken Timestamp
tokenExpirationTimeDateToken Expiration Time
appIdstringApp ID
aclstringACL from streamerInfo
userGroupstringUser Group
accessLevelstringAccess Level
companystringCompany Name
segmentstringSegment
streamerSubscriptionKeysArray.<Object>Streamer Subscription Keys
streamerSubscriptionKeys[].keystringSubscription Key
quotesobjectRealtime Quotes

TDAmeritradeStreamerCommand : Object

Kind: global typedef
Properties

NameTypeDescription
servicestringService Name
commandstringCommand Name
parametersObjectService Command Parameters

TDAmeritradeStreamServiceResponse : Object

TD Ameritrade Stream Response

Kind: global typedef
Properties

NameTypeDescription
servicestringService Name.
requestidstringRequest ID.
commandstringCommand.
timestampDateTimestamp.
contentObjectStream Response Content.
content.codenumberResponse Code.
content.msgstringResponse Message.

TDAmeritradeStreamDataResponse : Object

TD Ameritrade Data Response

Kind: global typedef
Properties

NameTypeDescription
servicestringService Name.
timestampDateTimestamp.
commandstringCommand.
contentArray.<Object> | ObjectStream Response Content.
snapshot?Array.<Object> | ObjectSnapshot Data.

TDAmeritradeStreamNotifyResponse : Object

TD Ameritrade Stream Notify Response

Kind: global typedef
Properties

NameTypeDescription
heartbeatDateHeartbeat.