API Reference
Structure
The API is structured as a modular system of types, interfaces, and enumerations. The library's API is divided into three modules, where each module consists of interfaces that define properties and methods specific to its functionality.
Charting Library module
The Charting Library module is designed to manage chart creation, customize the UI appearance, and handle user interactions.
Key features
- Manage drawings and indicators displayed on the chart.
- Customize chart themes, layouts, and behaviors.
- Handle user interactions through events and methods.
Common interfaces
Advanced Charts Widget Options
Properties for Advanced Chart widget to customize its appearance and behavior
Trading Platform Widget Options
Properties for Trading Platform widget to customize its appearance and behavior
IChartingLibrary Widget
Primary interface for library interactions
IChart Widget
Primary interface for chart interactions, such as creating drawings and indicators
Datafeed module
The Datafeed module is designed to integrate custom data sources and controlling data flow to the chart.
Key features
- Connect any market data source to Advanced Charts.
- Handle custom symbology logic to map your backend symbols to TradingView's requirements.
- Synchronize chart data with live market data updates.
Common interfaces
SymbolInfo
Defines the structure and metadata for symbols, including properties like ticker and exchange
IExternal Datafeed
Acts as the entry point for connecting custom datafeeds to the library
IDatafeed Chart
Provides methods for fetching and managing historical and real-time data
IDatafeed Quotes
Enables the retrieval and management of real-time market quotes
Broker module
The Broker module is designed to integrate trading capabilities provided by Trading Platform.
Key features
- Enable creating market, limit, and other order types directly from the chart interface.
- Provide real-time market quotes to power trading features like the Order Ticket, Watchlist, and Depth of Market.
- Support multiple account setups for users with diverse trading needs.
Common interfaces
Broker API
Enables trading features and connects the charts with your trading logic
Trading Host
Receives trading information from your backend server and provides the library with updates
Broker configuration
Defines configuration for additional Trading Platform features
Best practices for navigation
- Identify the module relevant to your task: creating charts, managing datafeeds, or enabling trading.
- Examine the available interfaces within the module. Each interface defines a set of properties and methods relevant to a specific feature or functionality.
- Follow type links and explore enumerations. If a property uses a non-primitive type, follow the link to the corresponding type definition. This will reveal additional properties and their relationships.
- Get back into the context and use your browser’s navigation to return to higher-level modules or interfaces when needed.
Browse TypeScript definition
Alternatively, if you are more comfortable browsing the API through a TypeScript definition file, you can use the following links:
Keyboard shortcuts for Visual Studio Code
Action | Windows shortcut | macOS shortcut |
---|---|---|
Find | Ctrl + F | Cmd + F |
Go to definition | F12 or Ctrl + Click | F12 or Cmd + Click |
Go back | Ctrl + - | Cmd + - |