td-streamer
Classes
Constants
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
- TDAmeritradeStreamEventProcessor
- new TDAmeritradeStreamEventProcessor()
- .TDAmeritradeStreamEventProcessor
- .emitter :
EventEmitter
- .handleMessage(TDAmeritradeStreamResponse)
- .emitEvent(evt, [data])
- .handleAccountActivity(msg)
- .handleQuotes(msg)
- .handleTimeSales(msg)
- .handleOptions(msg)
- .handleLevelOneFutures(msg)
- .handleNews(msg)
- .handleActivesNasdaq(msg)
- .handleActivesNYSE(msg)
- .handleListedBook(msg)
- .handleNasdaqBook(msg)
- .handleActiveOptions(msg)
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
Param | Type | Description |
---|---|---|
emitter | EventEmitter | an instance of EventEmitter |
[handleLevelOneFeedUpdate] | function | Custom L1 feed data callback |
[handleLevelOneTimeSaleUpdate] | function | Custom 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
Param | Type | Description |
---|---|---|
TDAmeritradeStreamResponse | TDAmeritradeStreamEventProcessorEventMessage | |
TDAmeritradeStreamResponse.response | TDAmeritradeStreamServiceResponse | Response |
TDAmeritradeStreamResponse.data | Array.<TDAmeritradeStreamDataResponse> | Response Data |
TDAmeritradeStreamResponse.snapshot | TDAmeritradeStreamDataResponse | Response Data Snapshot |
tdAmeritradeStreamEventProcessor.emitEvent(evt, [data])
Emits Events
Kind: instance method of TDAmeritradeStreamEventProcessor
Param | Type | Description |
---|---|---|
evt | string | Event Name |
[data] | Object | Array | string | number | boolean | Event Data |
tdAmeritradeStreamEventProcessor.handleAccountActivity(msg)
Handles Account Activity
Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: ACCT_ACTIVITY
Param | Type | Description |
---|---|---|
msg | TDAmeritradeStreamDataResponse | Stream Data Response |
tdAmeritradeStreamEventProcessor.handleQuotes(msg)
Handles Quotes
Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: QUOTE
Param | Type | Description |
---|---|---|
msg | TDAmeritradeStreamDataResponse | Stream Data Response |
tdAmeritradeStreamEventProcessor.handleTimeSales(msg)
Handles Time & Sales
Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: TIMESALE_EQUITY_UPDATE
Param | Type | Description |
---|---|---|
msg | TDAmeritradeStreamDataResponse | Stream Data Response |
tdAmeritradeStreamEventProcessor.handleOptions(msg)
Handles Options
Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: OPTION
Param | Type | Description |
---|---|---|
msg | TDAmeritradeStreamDataResponse | Stream Data Response |
tdAmeritradeStreamEventProcessor.handleLevelOneFutures(msg)
Handles Futures Level One / Time & Sales
Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: TIMESALE_FUTURES_UPDATE
, LEVELONE_FUTURES_UPDATE
Param | Type | Description |
---|---|---|
msg | TDAmeritradeStreamDataResponse | Stream Data Response |
tdAmeritradeStreamEventProcessor.handleNews(msg)
Handle News Headlines
Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: NEWS_HEADLINE
Param | Type |
---|---|
msg | TDAmeritradeStreamDataResponse |
tdAmeritradeStreamEventProcessor.handleActivesNasdaq(msg)
Handle Nasdaq Active Equities
Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: ACTIVES_NASDAQ
Param | Type |
---|---|
msg | TDAmeritradeStreamDataResponse |
tdAmeritradeStreamEventProcessor.handleActivesNYSE(msg)
Handle NYSE Active Equities
Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: ACTIVES_NYSE
Param | Type |
---|---|
msg | TDAmeritradeStreamDataResponse |
tdAmeritradeStreamEventProcessor.handleListedBook(msg)
Handle Nasdaq Order Book
Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: LISTED_BOOK
Param | Type |
---|---|
msg | TDAmeritradeStreamDataResponse |
tdAmeritradeStreamEventProcessor.handleNasdaqBook(msg)
Handle Nasdaq Order Book
Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: NASDAQ_BOOK
Param | Type |
---|---|
msg | TDAmeritradeStreamDataResponse |
tdAmeritradeStreamEventProcessor.handleActiveOptions(msg)
Handle Active Options
Kind: instance method of TDAmeritradeStreamEventProcessor
Emits: ACTIVES_OPTIONS
Param | Type |
---|---|
msg | TDAmeritradeStreamDataResponse |
TDAmeritradeStreamer
Kind: global class
- TDAmeritradeStreamer
- new TDAmeritradeStreamer()
- .TDAmeritradeStreamer
- .on(evt, method, context)
- .add(evt, method, context)
- .subscribeAccountActivity()
- .getChartHistoryAndSubscribeQuotes(symbol)
- .subscribeQuotes(symbol)
- .subscribeCharts(symbol)
- .subscribeOptions(symbol)
- .subscribeTimeAndSales(symbol)
- .subscribeFutures(symbol)
- .subscribeTimeSalesFutures(symbol)
- .subscribeFuturesOptions(symbol)
- .subscribeActives()
- .subscribeNewsHeadlines(symbol)
- .setQualityOfService(qoslevel)
- .subscribeListedBook(symbol)
- .subscribeNasdaqBook(symbol)
- .subscribeOptionsBook(symbol)
- "AUTHORIZED" (data)
- "ACCT_ACTIVITY" (data)
- "QUOTE" (data)
- "TIMESALE_EQUITY_UPDATE" (data)
- "OPTION" (data)
- "TIMESALE_FUTURES_UPDATE" (data)
- "LEVELONE_FUTURES_UPDATE" (data)
- "NEWS_HEADLINE" (data)
- "ACTIVES_NASDAQ" (data)
- "ACTIVES_NYSE" (data)
- "ACTIVES_OPTIONS" (data)
- "LISTED_BOOK" (data)
- "NASDAQ_BOOK" (data)
- "CHART_SNAPSHOT" (data)
- "CHART_UPDATE" (data)
new TDAmeritradeStreamer()
Represents the TDAmeritradeStreamer class for handling streaming.
tdAmeritradeStreamer.TDAmeritradeStreamer
Kind: instance class of TDAmeritradeStreamer
new exports.TDAmeritradeStreamer(streamerConnectionOptions, [handleLevelOneFeedUpdate], [handleLevelOneTimeSaleUpdate])
Param | Type | Description |
---|---|---|
streamerConnectionOptions | TDAmeritradeStreamerConnectionOptions | Streamer Connection Options |
[handleLevelOneFeedUpdate] | function | Custom L1 feed data callback |
[handleLevelOneTimeSaleUpdate] | function | Custom L1 time & sales feed data callback |
tdAmeritradeStreamer.on(evt, method, context)
EventEmitter on event handler
Kind: instance method of TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
evt | string | Event Name |
method | string | Method |
context | * | Context |
tdAmeritradeStreamer.add(evt, method, context)
EventEmitter addListener handler
Kind: instance method of TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
evt | string | Event Name |
method | string | Method |
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
Param | Type |
---|---|
symbol | TickerSymbolKeys |
tdAmeritradeStreamer.subscribeQuotes(symbol)
Subscribe to Quote Service
Kind: instance method of TDAmeritradeStreamer
Param | Type |
---|---|
symbol | TickerSymbolKeys |
tdAmeritradeStreamer.subscribeCharts(symbol)
Subscribe to Chart Equity Service
Kind: instance method of TDAmeritradeStreamer
Param | Type |
---|---|
symbol | TickerSymbolKeys |
tdAmeritradeStreamer.subscribeOptions(symbol)
Subscribe to Option Service
Kind: instance method of TDAmeritradeStreamer
Param | Type |
---|---|
symbol | TickerSymbolKeys |
tdAmeritradeStreamer.subscribeTimeAndSales(symbol)
Subscribe to Time & Sales Equity Service
Kind: instance method of TDAmeritradeStreamer
Param | Type |
---|---|
symbol | TickerSymbolKeys |
tdAmeritradeStreamer.subscribeFutures(symbol)
Subscribe to Futures Chart History, Chart, Time & Sales & Level One Services
Kind: instance method of TDAmeritradeStreamer
Param | Type | Default |
---|---|---|
symbol | TickerSymbolKeys | /ES |
tdAmeritradeStreamer.subscribeTimeSalesFutures(symbol)
Subscribe to Futures Time & Sales Service
Kind: instance method of TDAmeritradeStreamer
Param | Type | Default |
---|---|---|
symbol | TickerSymbolKeys | /ES |
tdAmeritradeStreamer.subscribeFuturesOptions(symbol)
Subscribe to Level One Futures Options Service './EW1X20C3510, ./EW1X20C3525'
Kind: instance method of TDAmeritradeStreamer
Param | Type |
---|---|
symbol | TickerSymbolKeys |
tdAmeritradeStreamer.subscribeActives()
Subscribe to Actives Feed
Kind: instance method of TDAmeritradeStreamer
tdAmeritradeStreamer.subscribeNewsHeadlines(symbol)
Subscribe to News Headlines
Kind: instance method of TDAmeritradeStreamer
Param | Type | Default |
---|---|---|
symbol | TickerSymbolKeys | ALL |
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
Param | Type | Default | Description |
---|---|---|---|
qoslevel | number | 0 | Quality of Service level |
tdAmeritradeStreamer.subscribeListedBook(symbol)
Subscribe to Listed Order Book Service
Kind: instance method of TDAmeritradeStreamer
Param | Type |
---|---|
symbol | TickerSymbolKeys |
tdAmeritradeStreamer.subscribeNasdaqBook(symbol)
Subscribe to Nasdaq Order Book Service
Kind: instance method of TDAmeritradeStreamer
Param | Type |
---|---|
symbol | TickerSymbolKeys |
tdAmeritradeStreamer.subscribeOptionsBook(symbol)
Subscribe to Options Order Book Service
Kind: instance method of TDAmeritradeStreamer
Param | Type |
---|---|
symbol | TickerSymbolKeys |
"AUTHORIZED" (data)
Emitted when AUTHORIZED
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"ACCT_ACTIVITY" (data)
Emitted when ACCT_ACTIVITY
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"QUOTE" (data)
Emitted when QUOTE
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"TIMESALE_EQUITY_UPDATE" (data)
Emitted when TIMESALE_EQUITY_UPDATE
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"OPTION" (data)
Emitted when OPTION
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"TIMESALE_FUTURES_UPDATE" (data)
Emitted when TIMESALE_FUTURES_UPDATE
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"LEVELONE_FUTURES_UPDATE" (data)
Emitted when LEVELONE_FUTURES_UPDATE
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"NEWS_HEADLINE" (data)
Emitted when NEWS_HEADLINE
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"ACTIVES_NASDAQ" (data)
Emitted when ACTIVES_NASDAQ
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"ACTIVES_NYSE" (data)
Emitted when ACTIVES_NYSE
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"ACTIVES_OPTIONS" (data)
Emitted when ACTIVES_OPTIONS
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"LISTED_BOOK" (data)
Emitted when LISTED_BOOK
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"NASDAQ_BOOK" (data)
Emitted when NASDAQ_BOOK
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"CHART_SNAPSHOT" (data)
Emitted when CHART_SNAPSHOT
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream Event Data |
"CHART_UPDATE" (data)
Emitted when CHART_UPDATE
streamer event is emitted.
Kind: event emitted by TDAmeritradeStreamer
Param | Type | Description |
---|---|---|
data | Object | Stream 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
Param | Type | Description |
---|---|---|
streamerConnectionOptions | TDAmeritradeStreamerConnectionOptions | API Client Configuration |
handleLevelOneFeedUpdate | function | Level one feed callback |
handleLevelOneTimeSaleUpdate | function | Level 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
Name | Type | Description |
---|---|---|
primaryAccountId | string | Primary Account ID |
accountId | string | Account ID to connect |
token | string | Token from streamerInfo |
accountCdDomainId | string | Account CD Domain ID from accounts |
streamerSocketUrl | string | Streamer Socket URL |
tokenTimestamp | Date | Token Timestamp |
tokenExpirationTime | Date | Token Expiration Time |
appId | string | App ID |
acl | string | ACL from streamerInfo |
userGroup | string | User Group |
accessLevel | string | Access Level |
company | string | Company Name |
segment | string | Segment |
streamerSubscriptionKeys | Array.<Object> | Streamer Subscription Keys |
streamerSubscriptionKeys[].key | string | Subscription Key |
quotes | object | Realtime Quotes |
TDAmeritradeStreamerCommand : Object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
service | string | Service Name |
command | string | Command Name |
parameters | Object | Service Command Parameters |
TDAmeritradeStreamServiceResponse : Object
TD Ameritrade Stream Response
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
service | string | Service Name. |
requestid | string | Request ID. |
command | string | Command. |
timestamp | Date | Timestamp. |
content | Object | Stream Response Content. |
content.code | number | Response Code. |
content.msg | string | Response Message. |
TDAmeritradeStreamDataResponse : Object
TD Ameritrade Data Response
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
service | string | Service Name. |
timestamp | Date | Timestamp. |
command | string | Command. |
content | Array.<Object> | Object | Stream Response Content. |
snapshot? | Array.<Object> | Object | Snapshot Data. |
TDAmeritradeStreamNotifyResponse : Object
TD Ameritrade Stream Notify Response
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
heartbeat | Date | Heartbeat. |