Skip to main content

Groups

Groups are sets of symbols that are used to restrict access to symbols for different users. The /groups endpoint gets a list of available symbol groups in the integration.

Use cases

You should implement groups in the following cases:

  • You plan to restrict users from accessing certain symbols based on their location or subscription plan.
  • Your integration contains or will contain CFD stocks. Only users with a broker account can access stocks.

To simplify symbol support, TradingView also recommends using groups if you plan to add different types of instruments. For example, your integration has futures, spots, and swaps. In this case, you need to create separate groups for each of the instrument type. If you only want to add one instrument, TradingView still recommends to implement groups.

Access restrictions for users

If you plan to restrict access to some symbol groups for users, you also need to implement the /permissions endpoint. This endpoint gets the list of groups available for a particular user. When a TradingView user logs into their broker account, they get access to one or more groups, depending on the list returned in /permissions. Refer to Permissions for more information.

Limitations

Consider the following usage details and limitations on groups before implementation:

  • Groups cannot be deleted, you can only remove all symbols from them.
  • Each integration can contain no more than 10 symbol groups.
  • Each symbol group can contain up to 10,000 symbols.
  • Each symbol can belong to only one group.
  • Group names must contain a prefix which is the broker/exchange name. The prefix must be the same for all groups.
  • You cannot change group names yourself. Notify the TradingView team about the intended changes.

Groups in /symbol_info

Requests to the /symbol_info endpoint include the group parameter which represents a group name. /symbol_info returns only those symbols that belong to the specified group. This way, TradingView can get information about which group each symbol belongs to.

If you choose to split symbols into groups, requests to /symbol_info should always be handled with the group parameter. If the group parameter is not specified, the entire list of symbols from all groups should be returned in the /symbol_info response.

If you do not want to group symbols, your API should ignore all /symbol_info query parameters. For example, your API should return the same symbols for both a request with "group": "example_group" (for any group) and a request without group.

Response examples

An example of division into groups for Crypto brokers:

{
"s": "ok",
"d": {
"groups": [
{
"id": "<broker_name>_spots"
},
{
"id": "<broker_name>_futures"
},
{
"id": "<broker_name>_swaps"
}
]
}
}

An example of division into groups for the Forex and CFD brokers:

{
"s": "ok",
"d": {
"groups": [
{
"id": "<broker_name>_forex"
},
{
"id": "<broker_name>_commodities"
},
{
"id": "<broker_name>_cfd"
},
{
"id": "<broker_name>_indices"
}
]
}
}

Adding new groups

To add new symbol groups, follow the steps below:

  1. Confirm the changes with the TradingView team.
  2. Implement the groups and add them to your staging environment.
  3. Run data integration tests and ensure that all tests have passed.
  4. Notify the TradingView team to test the changes on their side. New group testing usually takes 1−2 weeks.

Note that you can deploy new groups to your production environment only after successful testing by the TradingView team.