This repository contains sample code for the Datafeed API tutorial, which demonstrates how to implement real-time data streaming in Advanced Charts. As an example, the tutorial describes a connection via the free CryptoCompare API that provides data from different crypto exchanges.
Note
Advanced Charts is a standalone client-side library that is used to display financial charts, prices, and technical analysis tools. Learn more about Advanced Charts on the TradingView website.
- The Advanced Charts repository is private. Refer to Getting Access for more information on how to get the library.
- To use the CryptoCompare API, you should create an account and generate a free API key. For more information, refer to the CryptoCompare documentation.
Take the following steps to run this project:
-
Clone the repository. Note that for the real project, it is better to use this repository as a submodule in yours.
git clone https://github.com/tradingview/charting-library-tutorial.git
-
Go to the repository folder and initialize the Git submodule with the library:
git submodule update --init --recursive
Alternatively, you can download the library repository from a ZIP file or clone it using Git.
-
Run the following command to serve static files:
npx serve
The latest version introduces several key improvements:
- Intraday resolutions: Added support for minute and hour resolutions.
- SymbolInfo update: Removed
full_name
from theSymbolInfo
object. Now,ticker
is used instead. - Improved search:
searchSymbols
now properly filters results by user input, selected exchange, and symbol type. - Improved
getBars
:getBars
now selects the correct API endpoint based on the requestedresolution
(minute, hour, or day), ensuring the most appropriate data is used. - Enhanced streaming: Reworked streaming logic to support multiple subscriptions to data updates.