Skip to content

Latest commit

 

History

History
141 lines (109 loc) · 5.67 KB

data.md

File metadata and controls

141 lines (109 loc) · 5.67 KB

Data structure

You need to store all symbol data and its description in a repository. To do this, provide two directories and add your data files.

  • For each symbol, create a CSV file with daily data in the data/repo_name directory.
  • Create a JSON file with symbol descriptions in the symbol_info directory.

Data format

Each symbol and its daily data must be placed into a separate CSV file in the data/repo_name directory. Daily data represents the symbol's OHLC (open-high-low-close) prices on charts.

Note

The EOD (End-of-Day) feed has a limit of 1,000 symbols per repository. Keep this in mind when adding data files. To connect more symbols, you can create another data repository.

Follow these requirements when creating a file:

  • File names must be equal to symbol names and must be URL encoded.
  • File extension must be .csv.
  • Values must be comma-separated.
  • Do not use headers, blank lines, and spaces.
  • The lines of the file must be sorted by date in ascending order.
  • The lines should not contain duplicates by date.
Field Description Sample
date Date in YYYYMMDDT format. 20210101T
open First tick price. 0.1
high Maximum tick price. 0.1
low Minimum tick price. 0.1
close Last tick price. 0.1
volume Total number of shares traded. Cannot be negative. 0.0

Note

If your data series has a single value only, fill the open, close, high, and low fields with the same value and volume with 0.

CSV file example:

20210101T,0.1,0.1,0.1,0.1,0

Data update

Your EOD data is checked and uploaded to the TradingView repository daily. You can see the data for all previous days on the chart. The data checked and uploaded today will appear on the chart the next day. If you don't update the data for three months, it will be removed from the TradingView storage.

Intraday data and real-time updates are possible using a REST protocol, but this option is only available for brokerage integration.

Symbol_info format

Symbol information must be placed into a single JSON file in the symbol_info directory.

Follow these requirements when creating a file:

  • The file name must be equal to the repository name, and the extension must be .json.
  • The file consists of a JSON object that cannot be empty.

The object consists of the following required fields:

Field Type Description Note
symbol String Symbol name used in TradingView. Cannot be empty. Validation rule: ^[A-Z0-9._]+$.
currency String Three-letter currency code according to ISO 4217. Can be empty. Validation rule: ^[A-Z0-9._]+$.
description String Symbol description. Cannot be empty.
pricescale Integer Indicates how many decimal places the price has. The value format is 10^n, where n is the number of decimal places. For example, if the price has two decimal places 300.01, set pricescale to 100. If it has three decimal places 300.001, set pricescale to 1000, etc. If the price doesn't have decimals, set pricescale to 1.

Note

Each object field is an array with values. For all fields, the length of these arrays must match. However, if all the values in the array are the same, you can specify a single value for the field instead of an array.

Consider the following example. If you specify three symbols in the object, then you also need to specify three descriptions, three price scales, and three currencies (which can be empty) for each symbol.

{
   "symbol": [
      "BTC_DEV_ACTIVITY",
      "BTC_SOCIAL_VOLUME_TOTAL",
      "ETH_DEV_ACTIVITY"
   ],
   "pricescale": [10, 10, 10],
   "currency": "",
   "description": [
      "Bitcoin developer activity",
      "Bitcoin social volume total",
      "Ethereum developer activity"
   ]
}

However, if all added symbols have the same price scale, you can only specify a single value in the pricescale field: "pricescale": 10 instead of "pricescale": [10, 10, 10].

{
   "symbol": [
      "BTC_DEV_ACTIVITY",
      "BTC_SOCIAL_VOLUME_TOTAL",
      "ETH_DEV_ACTIVITY"
   ],
   "pricescale": 10,
   "currency": "",
   "description": [
      "Bitcoin developer activity",
      "Bitcoin social volume total",
      "Ethereum developer activity"
   ]
}

Both examples above are equivalent and will not cause a validation error.

Data validation

When your data is merged, the Check data and create pr action will run on the repository Actions page automatically. This action validates your files and loads them into the TradingView storage.

Before merging your data, ensure that your files and their content follow the requirements described in this article. Otherwise, you will get errors in the Actions page logs.

Data repository access

Your repository can be either public or private. If you store data in a public one, we recommend using environment variables to store access keys.