Skip to main content
Version: latest

Datafeed

Datafeed JS API for TradingView Advanced Charts

Interfaces

Type Aliases

CustomTimezones

Type

"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/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/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/London" | "Europe/Luxembourg" | "Europe/Madrid" | "Europe/Malta" | "Europe/Moscow" | "Europe/Oslo" | "Europe/Paris" | "Europe/Prague" | "Europe/Riga" | "Europe/Rome" | "Europe/Stockholm" | "Europe/Tallinn" | "Europe/Vienna" | "Europe/Vilnius" | "Europe/Warsaw" | "Europe/Zurich" | "Pacific/Auckland" | "Pacific/Chatham" | "Pacific/Fakaofo" | "Pacific/Honolulu" | "Pacific/Norfolk" | "US/Mountain"


DOMCallback

Type

(data: DOMData) => void

Type declaration

Signature

(data: DOMData) => void
Parameters
NameType
dataDOMData
Returns

void


DatafeedErrorCallback

Type

(reason: string) => void

Type declaration

Signature

(reason: string) => void
Parameters
NameType
reasonstring
Returns

void


GetMarksCallback

Type

(marks: T[]) => void

Type parameters

Name
T

Type declaration

Signature

(marks: T[]) => void
Parameters
NameType
marksT[]
Returns

void


HistoryCallback

Type

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

Type declaration

Signature

(bars: Bar[], meta?: HistoryMetadata) => void
Parameters
NameType
barsBar[]
meta?HistoryMetadata
Returns

void


LibrarySessionId

Type

"regular" | "extended" | "premarket" | "postmarket"


MarkConstColors

Type

"red" | "green" | "blue" | "yellow"


Nominal

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

T & { [species]: Name }

Type parameters

NameType
TT
Nameextends string

OnReadyCallback

Type

(configuration: DatafeedConfiguration) => void

Type declaration

Signature

(configuration: DatafeedConfiguration) => void
Parameters
NameType
configurationDatafeedConfiguration
Returns

void


QuoteData

Type

QuoteOkData | QuoteErrorData


QuotesCallback

Callback to provide Quote data.

Type

(data: QuoteData[]) => void

Type declaration

Signature

(data: QuoteData[]) => void
Parameters
NameTypeDescription
dataQuoteData[]Quote Data
Returns

void


QuotesErrorCallback

Error callback for quote data request.

Type

(reason: string) => void

Type declaration

Signature

(reason: string) => void
Parameters
NameTypeDescription
reasonstringmessage describing the reason for the error
Returns

void


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.

Type

Nominal<string, "ResolutionString">


ResolveCallback

Type

(symbolInfo: LibrarySymbolInfo) => void

Type declaration

Signature

(symbolInfo: LibrarySymbolInfo) => void
Parameters
NameType
symbolInfoLibrarySymbolInfo
Returns

void


SearchSymbolsCallback

Type

(items: SearchSymbolResultItem[]) => void

Type declaration

Signature

(items: SearchSymbolResultItem[]) => void
Parameters
NameType
itemsSearchSymbolResultItem[]
Returns

void


SeriesFormat

Type

"price" | "volume"


ServerTimeCallback

Type

(serverTime: number) => void

Type declaration

Signature

(serverTime: number) => void
Parameters
NameType
serverTimenumber
Returns

void


SubscribeBarsCallback

Type

(bar: Bar) => void

Type declaration

Signature

(bar: Bar) => void
Parameters
NameType
barBar
Returns

void


TimeScaleMarkShape

Type

"circle" | "earningUp" | "earningDown" | "earning"


Timezone

Type

"Etc/UTC" | CustomTimezones


VisiblePlotsSet

Type

"ohlcv" | "ohlc" | "c"