Skip to main content

Module: Datafeed

Datafeed JS API for TradingView Advanced Charts

Enumerations​

Interfaces​

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​
NameType
dataDOMData

DatafeedErrorCallback​

DatafeedErrorCallback: (reason: string) => void

Parameters​
NameType
reasonstring

GetMarksCallback​

GetMarksCallback<T>: (marks: T[]) => void

Type parameters​

Name
T
Parameters​
NameType
marksT[]

HistoryCallback​

HistoryCallback: (bars: Bar[], meta?: HistoryMetadata) => void

Parameters​
NameType
barsBar[]
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:

type Index = Nominal<number, 'Index'>;
// let i: Index = 42; // this fails to compile
let i: Index = 42 as Index; // OK

type TagName = Nominal<string, 'TagName'>;

Type parameters​

NameType
TT
Nameextends string

OnReadyCallback​

OnReadyCallback: (configuration: DatafeedConfiguration) => void

Parameters​
NameType
configurationDatafeedConfiguration

QuoteData​


QuotesCallback​

QuotesCallback: (data: QuoteData[]) => void

Callback to provide Quote data.

Parameters​
NameTypeDescription
dataQuoteData[]Quote Data

QuotesErrorCallback​

QuotesErrorCallback: (reason: string) => void

Error callback for quote data request.

Parameters​
NameTypeDescription
reasonstringmessage 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:

ResolutionFormatExample
TicksxT1T — one tick, 5T — five ticks, 100T — one hundred ticks
SecondsxS1S — one second
Minutesx1 — one minute
Hoursx minutes60 — one hour
DaysxD1D — one day
WeeksxW1W — one week
MonthsxM1M — one month
YearsxM months12M — one year

Refer to Resolution for more information.


ResolveCallback​

ResolveCallback: (symbolInfo: LibrarySymbolInfo) => void

Parameters​
NameType
symbolInfoLibrarySymbolInfo

SearchSymbolsCallback​

SearchSymbolsCallback: (items: SearchSymbolResultItem[]) => void

Parameters​
NameType
itemsSearchSymbolResultItem[]

SearchSymbolsPaginatedCallback​

SearchSymbolsPaginatedCallback: (items: SearchSymbolResultItem[], symbolsRemaining: number) => void

Parameters​
NameType
itemsSearchSymbolResultItem[]
symbolsRemainingnumber

SeriesFormat​

SeriesFormat: "price" | "volume"


ServerTimeCallback​

ServerTimeCallback: (serverTime: number) => void

Parameters​
NameType
serverTimenumber

SubscribeBarsCallback​

SubscribeBarsCallback: (bar: Bar) => void

Parameters​
NameType
barBar

TimeScaleMarkShape​

TimeScaleMarkShape: "circle" | "earningUp" | "earningDown" | "earning"


Timezone​

Timezone: "Etc/UTC" | CustomTimezones


VisiblePlotsSet​

VisiblePlotsSet: "ohlcv" | "ohlc" | "c" | "hlc"