Datafeed
Datafeed JS API for TradingView Advanced Charts
Interfaces
- Bar
- CurrencyItem
- DOMData
- DOMLevel
- DatafeedConfiguration
- DatafeedQuoteValues
- DatafeedSymbolType
- Exchange
- HistoryMetadata
- IDatafeedChartApi
- IDatafeedQuotesApi
- IExternalDatafeed
- LibrarySubsessionInfo
- LibrarySymbolInfo
- Mark
- MarkCustomColor
- PeriodParams
- QuoteDataResponse
- QuoteErrorData
- QuoteOkData
- SearchSymbolResultItem
- SymbolInfoPriceSource
- SymbolResolveExtension
- TimescaleMark
- Unit
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/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/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/Riga" | "Europe/Rome" | "Europe/Stockholm" | "Europe/Tallinn" | "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
Name | Type |
---|---|
data | DOMData |
Returns
void
ErrorCallback
Type
(reason: string) => void
Type declaration
Signature
(reason: string) => void
Parameters
Name | Type |
---|---|
reason | string |
Returns
void
GetMarksCallback
Type
(marks: T[]) => void
Type parameters
Name |
---|
T |
Type declaration
Signature
(marks: T[]) => void
Parameters
Name | Type |
---|---|
marks | T[] |
Returns
void
HistoryCallback
Type
(bars: Bar[], meta?: HistoryMetadata) => void
Type declaration
Signature
(bars: Bar[], meta?: HistoryMetadata) => void
Parameters
Name | Type |
---|---|
bars | Bar[] |
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
Name | Type |
---|---|
T | T |
Name | extends string |
OnReadyCallback
Type
(configuration: DatafeedConfiguration) => void
Type declaration
Signature
(configuration: DatafeedConfiguration) => void
Parameters
Name | Type |
---|---|
configuration | DatafeedConfiguration |
Returns
void
QuoteData
Type
QuotesCallback
Callback to provide Quote data.
Type
(data: QuoteData[]) => void
Type declaration
Signature
(data: QuoteData[]) => void
Parameters
Name | Type | Description |
---|---|---|
data | QuoteData[] | Quote Data |
Returns
void
QuotesErrorCallback
Error callback for quote data request.
Type
(reason: string) => void
Type declaration
Signature
(reason: string) => void
Parameters
Name | Type | Description |
---|---|---|
reason | string | message 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:
Resolution | Format | Example |
---|---|---|
Ticks | xT | 1T — one tick |
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.
Type
Nominal<string, "ResolutionString">
ResolveCallback
Type
(symbolInfo: LibrarySymbolInfo) => void
Type declaration
Signature
(symbolInfo: LibrarySymbolInfo) => void
Parameters
Name | Type |
---|---|
symbolInfo | LibrarySymbolInfo |
Returns
void
SearchSymbolsCallback
Type
(items: SearchSymbolResultItem[]) => void
Type declaration
Signature
(items: SearchSymbolResultItem[]) => void
Parameters
Name | Type |
---|---|
items | SearchSymbolResultItem[] |
Returns
void
SeriesFormat
Type
"price" | "volume"
ServerTimeCallback
Type
(serverTime: number) => void
Type declaration
Signature
(serverTime: number) => void
Parameters
Name | Type |
---|---|
serverTime | number |
Returns
void
SubscribeBarsCallback
Type
(bar: Bar) => void
Type declaration
Signature
(bar: Bar) => void
Parameters
Name | Type |
---|---|
bar | Bar |
Returns
void
TimeScaleMarkShape
Type
"circle" | "earningUp" | "earningDown" | "earning"
Timezone
Type
"Etc/UTC" | CustomTimezones
VisiblePlotsSet
Type
"ohlcv" | "ohlc" | "c"