Module: Datafeed
Datafeed JS API for TradingView Advanced Charts
Enumerations
Interfaces
- Bar
- CurrencyItem
- DOMData
- DOMLevel
- DatafeedConfiguration
- DatafeedQuoteValues
- DatafeedSymbolType
- Exchange
- HistoryMetadata
- IDatafeedChartApi
- IDatafeedQuotesApi
- IExternalDatafeed
- LibrarySubsessionInfo
- LibrarySymbolInfo
- Mark
- MarkCustomColor
- PeriodParams
- QuoteDataResponse
- QuoteErrorData
- QuoteOkData
- SearchSymbolResultItem
- SymbolInfoPriceSource
- SymbolResolveExtension
- SymbolSearchPaginatedOptions
- TimescaleMark
- Unit
Type Aliases
CustomTimezones
CustomTimezones: "Africa/Cairo" | "Africa/Casablanca" | "Africa/Johannesburg" | "Africa/Lagos" | "Africa/Nairobi" | "Africa/Tunis" | "America/Anchorage" | "America/Argentina/Buenos_Aires" | "America/Bogota" | "America/Caracas" | "America/Chicago" | "America/El_Salvador" | "America/Halifax" | "America/Juneau" | "America/Lima" | "America/Los_Angeles" | "America/Mexico_City" | "America/New_York" | "America/Phoenix" | "America/Santiago" | "America/Sao_Paulo" | "America/Toronto" | "America/Vancouver" | "Asia/Almaty" | "Asia/Ashkhabad" | "Asia/Bahrain" | "Asia/Bangkok" | "Asia/Chongqing" | "Asia/Colombo" | "Asia/Dhaka" | "Asia/Dubai" | "Asia/Ho_Chi_Minh" | "Asia/Hong_Kong" | "Asia/Jakarta" | "Asia/Jerusalem" | "Asia/Kabul" | "Asia/Karachi" | "Asia/Kathmandu" | "Asia/Kolkata" | "Asia/Kuala_Lumpur" | "Asia/Kuwait" | "Asia/Manila" | "Asia/Muscat" | "Asia/Nicosia" | "Asia/Qatar" | "Asia/Riyadh" | "Asia/Seoul" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Taipei" | "Asia/Tehran" | "Asia/Tokyo" | "Asia/Yangon" | "Atlantic/Azores" | "Atlantic/Reykjavik" | "Australia/Adelaide" | "Australia/Brisbane" | "Australia/Perth" | "Australia/Sydney" | "Europe/Amsterdam" | "Europe/Athens" | "Europe/Belgrade" | "Europe/Berlin" | "Europe/Bratislava" | "Europe/Brussels" | "Europe/Bucharest" | "Europe/Budapest" | "Europe/Copenhagen" | "Europe/Dublin" | "Europe/Helsinki" | "Europe/Istanbul" | "Europe/Lisbon" | "Europe/Ljubljana" | "Europe/London" | "Europe/Luxembourg" | "Europe/Madrid" | "Europe/Malta" | "Europe/Moscow" | "Europe/Oslo" | "Europe/Paris" | "Europe/Prague" | "Europe/Riga" | "Europe/Rome" | "Europe/Sofia" | "Europe/Stockholm" | "Europe/Tallinn" | "Europe/Vienna" | "Europe/Vilnius" | "Europe/Warsaw" | "Europe/Zagreb" | "Europe/Zurich" | "Pacific/Auckland" | "Pacific/Chatham" | "Pacific/Fakaofo" | "Pacific/Honolulu" | "Pacific/Norfolk" | "US/Mountain"
DOMCallback
DOMCallback: (data: DOMData) => void
Parameters
| Name | Type |
|---|---|
data | DOMData |
DatafeedErrorCallback
DatafeedErrorCallback: (reason: string) => void
Parameters
| Name | Type |
|---|---|
reason | string |
GetMarksCallback
GetMarksCallback<T>: (marks: T[]) => void
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
marks | T[] |
HistoryCallback
HistoryCallback: (bars: Bar[], meta?: HistoryMetadata) => void
Parameters
| Name | Type |
|---|---|
bars | Bar[] |
meta? | HistoryMetadata |
LibrarySessionId
LibrarySessionId: "regular" | "extended" | "premarket" | "postmarket" | "24h" | "night"
MarkConstColors
MarkConstColors: "red" | "green" | "blue" | "yellow"
Nominal
Nominal<T, Name>: T & { [species]: Name }
This is the generic type useful for declaring a nominal type, which does not structurally matches with the base type and the other types declared over the same base type
Usage:
Example
type Index = Nominal<number, 'Index'>;
// let i: Index = 42; // this fails to compile
let i: Index = 42 as Index; // OK
Example
type TagName = Nominal<string, 'TagName'>;
Type parameters
| Name | Type |
|---|---|
T | T |
Name | extends string |
OnReadyCallback
OnReadyCallback: (configuration: DatafeedConfiguration) => void
Parameters
| Name | Type |
|---|---|
configuration | DatafeedConfiguration |
QuoteData
QuoteData: QuoteOkData | QuoteErrorData
QuotesCallback
QuotesCallback: (data: QuoteData[]) => void
Callback to provide Quote data.
Parameters
| Name | Type | Description |
|---|---|---|
data | QuoteData[] | Quote Data |
QuotesErrorCallback
QuotesErrorCallback: (reason: string) => void
Error callback for quote data request.
Parameters
| Name | Type | Description |
|---|---|---|
reason | string | message describing the reason for the error |
ResolutionString
ResolutionString: Nominal<string, "ResolutionString">
Resolution or time interval is a time period of one bar. Advanced Charts supports tick, intraday (seconds, minutes, hours), and DWM (daily, weekly, monthly) resolutions. The table below describes how to specify different types of resolutions:
| Resolution | Format | Example |
|---|---|---|
| Ticks | xT | 1T — one tick, 5T — five ticks, 100T — one hundred ticks |
| Seconds | xS | 1S — one second |
| Minutes | x | 1 — one minute |
| Hours | x minutes | 60 — one hour |
| Days | xD | 1D — one day |
| Weeks | xW | 1W — one week |
| Months | xM | 1M — one month |
| Years | xM months | 12M — one year |
Refer to Resolution for more information.
ResolveCallback
ResolveCallback: (symbolInfo: LibrarySymbolInfo) => void
Parameters
| Name | Type |
|---|---|
symbolInfo | LibrarySymbolInfo |
SearchSymbolsCallback
SearchSymbolsCallback: (items: SearchSymbolResultItem[]) => void
Parameters
| Name | Type |
|---|---|
items | SearchSymbolResultItem[] |
SearchSymbolsPaginatedCallback
SearchSymbolsPaginatedCallback: (items: SearchSymbolResultItem[], symbolsRemaining: number) => void
Parameters
| Name | Type |
|---|---|
items | SearchSymbolResultItem[] |
symbolsRemaining | number |
SeriesFormat
SeriesFormat: "price" | "volume"
ServerTimeCallback
ServerTimeCallback: (serverTime: number) => void
Parameters
| Name | Type |
|---|---|
serverTime | number |
SubscribeBarsCallback
SubscribeBarsCallback: (bar: Bar) => void
Parameters
| Name | Type |
|---|---|
bar | Bar |
TimeScaleMarkShape
TimeScaleMarkShape: "circle" | "earningUp" | "earningDown" | "earning"
Timezone
Timezone: "Etc/UTC" | CustomTimezones
VisiblePlotsSet
VisiblePlotsSet: "ohlcv" | "ohlc" | "c" | "hlc"