Skip to main content

TradingView REST API Specification for Brokers (1.4.24)

Overview

This API is to be implemented by the Brokers in order to connect their backend systems to TradingView, that acts as a frontend.

Check the info page for more info and use the contact form there if you have any questions.

Types of requests

There are two types of requests — client and server. Client requests are executed at the browser. Server requests are initiated from the TradingView servers. If your integration does not imply brokerage data stream connection to the TradingView website - then there won't be any server requests.

Clients requests

The two possible ways of sending updates to the client's side are either done by making use of client regularly polling endpoints, or by opening a streaming connection and pushing updates.

HTTP requests

From the browser TradingView requests the info (list of orders and positions, balance info, etc.) from the broker’s server. The requests are sent periodically and the intervals can be set by using the /config endpoint. After that, TradingView compares the new data with the previous answer and calculates the difference. If the status of the order/position changes or new data appears - the user will see a notification and the changes will display in the Account manager on the website.

Requests to the endpoints for placing/modifying orders, positions closing, etc. occur only after actions made by the user.

The /quotes endpoint retrieves the current bid/ask from the broker. The /depth endpoint retrieves Level 2 market data.

HTTP streaming

If the integration uses HTTP streaming endpoints, the connections to them are established once at the start of a session. The http-streaming consists of messages separated with line breaks. The content of the messages must be in Compact JSON format, i.e. should not contain any line breaks, except a line break at the very end which will act as a message separator.

There are four types of messages:

  • Entities snapshot
  • Entities updates
  • Ping
  • Error

Please refer to the streaming endpoints for more details.

Server requests

In case if a Broker provides any Forex or CFD trading access for its clients it will require connection of its own market data at TradingView. In order to make it possible, you will need to implement the following endpoints - /symbol_info, /history and /streaming. Data requests are sent from different TradingView servers. Usually, at least 4 servers are used. The historical data is cached on TradingView servers and loaded to the client browser from our servers.

Restricting access to data

By default, the broker symbols will be available in the symbol search at TradingView and all the community will have access to your data streams without any limitation. In order to limit the access to your data streams please use the following endpoints - /groups and /permissions.

You can find more information about restricting access to the data in the description of these endpoints.

Change log

1.4.24. Added support for broker's hyperlinks to be displayed in an order preview or an order ticket.

1.4.23. Added the minimum allowed value for the expires_in parameter.

1.4.22. Added support for hyperlinks in /orderPreview response.

1.4.21. Added custom text field support. Added new textField field to the /accounts and /instruments endpoints for the orderDialogCustomFields object.

1.4.20. Changed the typespecs parameter type in /symbol_info endpoint's response.

1.4.19. The supportExecutions flag became deprecated. The Executions endpoint is now mandatory.

1.4.18. The supportOrdersHistory flag became deprecated. The Orders History endpoint is now mandatory.

1.4.17. Added new supportCloseIndividualPosition flag.

1.4.16. Added connection warning message configuration to the /accounts endpoint.

1.4.15. Added new flag supportRiskControlsAndInfo.

1.4.14. Added support for Guaranteed Stop brackets for orders and positions. Added new flag supportGuaranteedStop.

1.4.13. Added logout with redirect to OAuth 2 Code Flow.

1.4.12. Added a closed position description to the /stream/positions, /stream/individualPositions and /stream/netPositions endpoints responses.

1.4.11. Changed the transactionId parameter type, changed the common response description.

1.4.10. Added new typespecs field to /instruments endpoint's response. Added new applicable values for the type field in the same endpoint's response: spot, swap, commodity. Marked the cfd and crypto values in the type field as deprecated. Added new volume-type field to /symbol_info endpoint's response.

1.4.9. Added new roundTripStartTime field to the /trackLatency endpoint's request body.

1.4.8. Added new flag supportAddBracketsToExistingOrder.

1.4.7. Added new flag supportStrictCheckingLimitOrderPrice.

1.4.6. Added 'modify_individual_position' and 'close_individual_position' transaction types to the /trackLatency endpoint.

1.4.5. Added support for refresh_token_expires_in parameter for OAuth 2 Code Flow.

1.4.4. Added support for individual and net position streaming, added two new endpoints: /stream/individualPositions a streaming alternative to the /individualPositions endpoint. /stream/netPositions a streaming alternative to the /netPositions endpoint.

1.4.3. Added marginAvailable field to the AccountState parameters.

1.4.2. Added amount field to /individualPositions endpoint. Added new supportPartialCloseIndividualPosition flag.

1.4.1. Added two new endpoints: /stream/state. A streaming alternative to the /state endpoint. /stream/quotes. A streaming alternative to the /quotes endpoint.

1.4.0. Added support for http-streaming and two new endpoints: /stream/orders and /stream/positions.

1.3.35. Added support for net and individual positions. Added the following endpoints: /netPositions, /individualPositions, /closeNetPosition, /closeIndividualPosition and /modifyIndividualPosition. Added new flag supportIndividualPositionBrackets.

1.3.34. Added track latency support. Added new supportTrackLatency flag. Added new endpoint: /trackLatency.

1.3.33. Added new flag supportStopLimitOrdersInBothDirections.

1.3.32. Added new flag supportLeverageButton.

1.3.31. The locale parameter for the /authorization endpoint is now required only for trading integration.

1.3.30. Added new currentAsk and currentBid fields to the /modifyPosition endpoint.

1.3.29. Added custom checkbox support. Added new checkbox field to the /accounts and /instruments endpoints for the orderDialogCustomFields object.

1.3.28. Added new variableMinTick field to the /instruments endpoint.

1.3.27. Added hardToBorrow, notShortable, halted parameters to the /quotes endpoint.

1.3.26. In /symbol_info, the minmov2 property renamed to minmovement2, the Etc/UTC timezone added. In /history , the HistoryNextBarResponse response changed to HistoryEmptyBarResponse, the countback query parameter became deprecated. In /accounts, added the isVerified property.

1.3.25. Added locale parameter to the /authorize endpoint.

1.3.24. Added leverage support. Added new supportLeverage flag. Added three new endpoints: /getLeverage, /setLeverage and /previewLeverage.

1.3.23. Changed description of forceUserEnterInitialValue flag in the OrderDialogCustomFields parameters.

1.3.22. Added new flags - supportModifyOrderPrice and supportModifyBrackets. The supportModifyOrder flag became deprecated.

1.3.21. Added new units field to the /instruments endpoint.

1.3.20. Added new supportTrailingStop flag. Added support for trailing stops for orders and positions.

1.3.19. Added new logout endpoint, supportLogout flag.

1.3.18. Added new supportPartialClosePosition flag and amount field to the /closePosition endpoint parameters.

1.3.17. Added stopPercent and limitPercent validation rules to the /instruments endpoint.

1.3.16. Added new supportOrderHistoryCustomFields flag and orderHistoryCustomFields field to the ui object in the /accounts endpoint and /config.

1.3.15. Added supportedOrderTypes field to the Duration parameters.

1.3.14. Added isCapitalize field to the positionCustomFields and orderCustomFields parameters.

1.3.13. Added rules parameter to the /instruments endpoint.

1.3.12. Added prefix field to the Account parameters.

1.3.11. Changed description for /placeOrder, /modifyOrder, /previewOrder, OrderDialogCustomFields and customFields field in OrderCommon.

1.3.10. Added locale query parameter to /getOrders, /placeOrder, /modifyOrder, /cancelOrder, /getPositions, /modifyPosition, /closePosition, /getExecutions, /getOrdersHistory, /getQuotes, /getDepth and /getBalances endpoints.

1.3.9. Added orderId, isClose, positionId and commission fields to Execution.

1.3.8. Added id field to the /previewOrder endpoint parameters.

1.3.7. Added mutable field to the OrderDialogCustomFields parameters.

1.3.6. Added lang query parameter to OAuth authorization request.

1.3.5. Added accountId query parameter to depth endpoint.

1.3.4. Added Order dialog customization opportunity on the instrument basis. Moved OrderDialogCustomFields to the ui object in the /accounts endpoint.

1.3.3. Added new supportStopOrdersInBothDirections flag.

1.3.2. Added new previewOrder endpoint, supportPlaceOrderPreview and supportModifyOrderPreview flags.

1.3.1. Added OAuth 2 Code Flow.

1.3.0. Added overriding Account manager and Durations configuration on Account basis.

1.2.5. Added reserved, value and valueCurrency fields to Crypto Balances.

1.2.4. Added default values to the account flags. Added supportMarketBrackets account flag.

1.2.3. Added current ask/bid fields to the parameters of the order placement and modification requests.

1.2.2. Added supportPartialOrderExecution flag.

1.2.1. Added support for position's and order's Custom fields. Removed fixedWidth and sortable fields from AccountManagerColumn.

1.2.0. Introducing new Quote response. Deprecation of streaming Bid and Ask responses. All new integrations should use the Quote response to provide ask/bid values. Added supportMarketOrders, supportLimitOrders, supportStop orders account flags. Added informational message to order and position.

1.1.3. Added support for reverse of the position.

1.1.2. Added support for custom Account Summary Row.

1.1.1. Added type field to /accounts endpoint.

1.1.0. Refactor, added examples.

Authorization

Authorize

Username and password authentication.

Request Body schema: application/x-www-form-urlencoded
login
required
string

User login.

password
required
string

User password.

locale
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id. This parameter is required for trading integration only.

Responses

Request samples

Content type
application/x-www-form-urlencoded
login=user1&password=dfkjhoijogpoi&locale=en

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": {
    }
}

Logout

Send logout if the supportLogout flag is set as true.

Authorizations:
PasswordBearerOAuth2Bearer

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok"
}

Broker Configuration

Configuration

Get localized configuration.

Authorizations:
PasswordBearerOAuth2Bearer
query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": {
    }
}

Mapping

Return all broker instruments with corresponding TradingView instruments. It is required to add a Broker to TradingView.com. Please note that this endpoint works without authorization!

Responses

Response samples

Content type
application/json
{
  • "symbols": [
    ],
  • "fields": [
    ]
}

Account

Accounts

Get a list of accounts owned by the user.

Authorizations:
PasswordBearerOAuth2Bearer
query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": [
    ]
}

Instruments

Get the list of the instruments that are available for trading with the specified account.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": [
    ]
}

State

Get account information. Consider using stream/state instead, as it can decrease the workload on the servers.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": {
    }
}

Stream State

Stream account information. Unlike /stream/orders or /stream/positions the whole state object must be sent to the client every time an update occurs.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
{
  • "balance": 41757.91,
  • "unrealizedPl": 1053.02,
  • "equity": 42857.56,
  • "amData": [
    ],
  • "accountSummaryRowData": [
    ]
}

Orders

Get current session orders for the account. It also includes working orders from previous sessions. Filled/cancelled/rejected orders should be included in the list till the end of the session. Consider using stream/orders instead, as it can decrease the workload on the servers.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": [
    ]
}

Stream Orders

Stream orders of the current session for the account. It also includes working orders from the previous sessions. A snapshot of all orders should be sent as the first message in the stream. After that the server must only send updates. It's not required to send the list of all orders in every message. If there are updated fields in an order, the server must send the whole order, including unchanged fields. If there were no updates for 5 seconds, a ping message must be sent.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
[
  • {
    }
]

Positions

Get positions for an account. Consider using stream/positions instead, as it can decrease the workload on the servers.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": [
    ]
}

Stream Positions

Stream positions for an account. A snapshot of all positions should be sent as the first message in the stream. After that the server must only send updates. It's not required to send the list of all positions in every message. If there are updated fields in a position, the server must send the whole position, including unchanged fields. The server must send a message with position id and qty field equal to 0 if a position is closed. If there were no updates for 5 seconds, a ping message must be sent.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
[
  • {
    },
  • {
    }
]

Net Positions

Get net positions for an account.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": [
    ]
}

Stream Net Positions

Stream net positions for an account. A snapshot of all net positions should be sent as the first message in the stream. After that the server must only send updates. It's not required to send the list of all net positions in every message. If there are updated fields in a net position, the server must send the whole net position, including unchanged fields. The server must send a message with position id and qty field equal to 0 if a position is closed. If there were no updates for 5 seconds, a ping message must be sent.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
[
  • {
    },
  • {
    }
]

Individual Positions

Get individual positions for an account

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": [
    ]
}

Stream Individual Positions

Stream individual positions for an account. A snapshot of all individual positions should be sent as the first message in the stream. After that the server must only send updates. It's not required to send the list of all individual positions in every message. If there are updated fields in a individual position, the server must send the whole individual position, including unchanged fields. The server must send a message with position id and qty field equal to 0 if a position is closed. If there were no updates for 5 seconds, a ping message must be sent.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
[
  • {
    },
  • {
    },
  • {
    }
]

Balances

Get crypto balances for an account. Balances are displayed as the first table of the Account Summary tab. Used for crypto currencies only.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": [
    ]
}

Executions

Get a list of executions (i.e. fills or trades) for an account and an instrument. Executions are displayed on a chart.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

instrument
required
string

Broker instrument name.

maxCount
number

Maximum count of executions to return.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": [
    ]
}

Orders History

Get order history for an account. It is expected that returned orders will have a final status (rejected, filled, cancelled).

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

maxCount
number

Maximum count of orders to return.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": [
    ]
}

Get Leverage

Request to this endpoint will be sent when the user opens the order ticket or changes any of the symbol, order type, side and any of the custom fields in the order ticket. Custom Order dialog fields defined in the /accounts are sent along with the standard fields in the order object.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Request Body schema: application/x-www-form-urlencoded
instrument
required
string

Broker instrument name.

side
required
string
Enum: "buy" "sell"

Current order side in the order ticket.

orderType
required
string
Enum: "market" "stop" "limit" "stoplimit"

Current order type selected in the order ticket.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": {
    }
}

Set Leverage

Will be sent when the user confirms changing the leverage. Additional "leverage" field will be added to the payload, the value of which was set by the user. Custom Order dialog fields defined in the /accounts are sent along with the standard fields in the order object.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Request Body schema: application/x-www-form-urlencoded
instrument
required
string

Broker instrument name.

side
required
string
Enum: "buy" "sell"

Current order side in the order ticket.

orderType
required
string
Enum: "market" "stop" "limit" "stoplimit"

Current order type selected in the order ticket.

leverage
required
number

Leverage value set by the user

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": {
    }
}

Preview Leverage

Will be sent when the user is editing the leverage. Custom Order dialog fields defined in the /accounts are sent along with the standard fields in the order object.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Request Body schema: application/x-www-form-urlencoded
instrument
required
string

Broker instrument name.

side
required
string
Enum: "buy" "sell"

Current order side in the order ticket.

orderType
required
string
Enum: "market" "stop" "limit" "stoplimit"

Current order type selected in the order ticket.

leverage
required
number

Leverage value set by user

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": {
    }
}

Trading

Place Order

Place a new order. Custom Order dialog fields defined in the /accounts are sent along with the standard fields in the order object.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

requestId
string
Example: requestId=23425678343

Unique identifier for a request.

Request Body schema: application/x-www-form-urlencoded
instrument
required
string

Instrument.

qty
required
number

The number of units.

side
required
string
Enum: "buy" "sell"

Side.

type
required
string
Enum: "market" "stop" "limit" "stoplimit"

Type.

currentAsk
required
number

Current ask price for the instrument that the user sees in the order panel.

currentBid
required
number

Current bid price for the instrument that the user sees in the order panel.

limitPrice
number

Limit Price for Limit or StopLimit order.

stopPrice
number

Stop Price for Stop or StopLimit order.

durationType
string

Duration ID (if supported).

durationDateTime
number

Expiration datetime Unix timestamp (if supported by duration type).

stopLoss
number

StopLoss price (if supported).

trailingStopPips
number

Distance from the stop loss level to the current market price in pips (if supported by the broker).

guaranteedStop
number

Stop price of Guaranteed Stop bracket (if supported).

takeProfit
number

TakeProfit price (if supported).

digitalSignature
string

Digital signature (if supported).

confirmId
string (ConfirmId)

An optional order identifier, which was received in the /previewOrder response.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": {
    }
}

Modify Order

Modify an existing order. Custom Order dialog fields defined in the /accounts are sent along with the standard fields in the order object.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

orderId
required
string

Order identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Request Body schema: application/x-www-form-urlencoded
qty
required
number

The number of units.

limitPrice
number

Limit Price for Limit or StopLimit order.

stopPrice
number

Stop Price for Stop or StopLimit order.

durationType
string

Duration ID (if supported).

durationDateTime
number

Expiration datetime Unix timestamp (if supported by duration type).

stopLoss
number

StopLoss price (if supported).

trailingStopPips
number

Distance from the stop loss level to the current market price in pips (if supported by the broker).

guaranteedStop
number

Stop price of Guaranteed Stop bracket (if supported).

takeProfit
number

TakeProfit price (if supported).

digitalSignature
string

Digital signature (if supported).

currentAsk
number

Current ask price for the instrument that the user sees in the order panel.

currentBid
number

Current bid price for the instrument that the user sees in the order panel.

confirmId
string (ConfirmId)

An optional order identifier, which was received in the /previewOrder response.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok"
}

Cancel Order

Cancel an existing order.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

orderId
required
string

Order identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok"
}

Preview Order

Get estimated cost, commission and other information for an order without the order actually being placed or modified. This information is displayed in the Order Ticket Preview. This endpoint is used if supportPlaceOrderPreview and/or supportModifyOrderPreview flag is true. TradingView displays the following information by itself: symbol, bid/ask, order type, side, quantity, price (except market orders), stop loss, take profit and currency. Custom Order dialog fields defined in the /accounts are sent along with the standard fields in the order object.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Request Body schema: application/x-www-form-urlencoded
instrument
required
string

Instrument.

qty
required
number

The number of units.

side
required
string
Enum: "buy" "sell"

Side.

type
required
string
Enum: "market" "stop" "limit" "stoplimit"

Type.

limitPrice
number

Limit Price for Limit or StopLimit order.

stopPrice
number

Stop Price for Stop or StopLimit order.

durationType
string

Duration ID (if supported).

durationDateTime
number

Expiration datetime Unix timestamp (if supported by duration type).

stopLoss
number

StopLoss price (if supported).

trailingStopPips
number

Distance from the stop loss level to the current market price in pips (if supported by the broker).

guaranteedStop
number

Stop price of Guaranteed Stop bracket (if supported).

takeProfit
number

TakeProfit price (if supported).

digitalSignature
string

Digital signature (if supported).

currentAsk
number

Current ask price for the instrument that the user sees in the order panel.

currentBid
number

Current bid price for the instrument that the user sees in the order panel.

id
string

Identifier of the order that is being modified by the user. This parameter is sent only if supportModifyOrderPreview flag is true.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": {
    }
}

Modify Position

Modify an existing position stop loss or take profit or both.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

positionId
required
string

Position identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Request Body schema: application/x-www-form-urlencoded
stopLoss
number

StopLoss price.

trailingStopPips
number

Distance from the stop loss level to the order price in pips (if supported).

guaranteedStop
number

Stop price of Guaranteed Stop bracket (if supported).

takeProfit
number

TakeProfit price.

currentAsk
number

Current ask price for the instrument that the user sees in the order panel.

currentBid
number

Current bid price for the instrument that the user sees in the order panel.

side
string
Enum: "buy" "sell"

New side of the position. This parameter is used to reverse the position, if the supportNativeReversePosition flag is enabled in the account config. Please see the /accounts endpoint.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok"
}

Close Position

Close an existing position.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

positionId
required
string

Position identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Request Body schema: application/x-www-form-urlencoded
amount
number

Amount to close. This property is used if supportPartialClosePosition flag is true.

Responses

Request samples

Content type
application/x-www-form-urlencoded
amount=5

Response samples

Content type
application/json
Example
{
  • "s": "ok"
}

Close Net Position

Close an existing net position and all of the individual positions on the symbol.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

netPositionId
required
string

Net position identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok"
}

Modify Individual Position

Modify an existing individual position stop loss or take profit or both.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

individualPositionId
required
string

Individual position identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Request Body schema: application/x-www-form-urlencoded
stopLoss
number

StopLoss price.

trailingStopPips
number

Distance from the stop loss level to the order price in pips (if supported).

guaranteedStop
number

Stop price of Guaranteed Stop bracket (if supported).

takeProfit
number

TakeProfit price.

currentAsk
number

Current ask price for the instrument that the user sees in the order panel.

currentBid
number

Current bid price for the instrument that the user sees in the order panel.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok"
}

Close Individual Position

Close an individual position.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

individualPositionId
required
string

Individual position identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Request Body schema: application/x-www-form-urlencoded
amount
number

Amount to close. This property is used if supportPartialCloseIndividualPosition flag is true.

Responses

Request samples

Content type
application/x-www-form-urlencoded
amount=5

Response samples

Content type
application/json
Example
{
  • "s": "ok"
}

Latency Tracking

Endpoint is used to collect performance and statistical data for a particular request. Applies to the following endpoints: Place order: /placeOrder Modify order: /modifyOrder Cancel order: /cancelOrder Modify position: /modifyPosition Close position: /closePosition To enable latency tracking functionality the supportTrackLatency flag should be set to true in the account config. Please see the /accounts endpoint.

Authorizations:
PasswordBearerOAuth2Bearer
path Parameters
accountId
required
string

Account identifier.

Request Body schema: application/x-www-form-urlencoded
transactionId
required
string

Request identifier for which the performance data is being sent.

transactionType
required
string
Enum: "place_order" "modify_order" "cancel_order" "modify_position" "close_position" "modify_individual_position" "close_individual_position" "close_net_position"

Type of the transaction

instrument
required
string

Instrument.

side
required
string
Enum: "buy" "sell"

Side.

ask
required
number

Current ask price for the instrument that the user sees in the order panel.

bid
required
number

Current bid price for the instrument that the user sees in the order panel.

timestamp
required
number

Timestamp of the price quote user has seen on the UI. In milliseconds.

roundTripDuration
required
number

Request duration in milliseconds.

qty
number

Placed or modified orders quantity. Not applied to Cancel order / modify position / close position requests.

roundTripStartTime
number

Timestamp in UTC when the request round trip started. In milliseconds.

Responses

Response samples

Content type
application/json
{
  • "s": "ok"
}

Market Data

Quotes

Get current prices of the instrument. The bid and ask fields are required, and the buyPipValue and sellPipValue fields are desirable if the account currency is different from the currency of the instrument. The same values should be sent for these fields if different values for buying and selling are not supported.

Authorizations:
PasswordBearerOAuth2Bearer
query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

accountId
required
string

Account identifier.

symbols
required
string

Comma separated symbol list.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": [
    ]
}

Stream Quotes

Stream current prices of the instrument. The bid and ask fields are required, and the buyPipValue and sellPipValue fields are desirable if the account currency is different from the currency of the instrument. The same values should be sent for these fields if different values for buying and selling are not supported.

Authorizations:
PasswordBearerOAuth2Bearer
query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

accountId
required
string

Account identifier.

symbols
required
string

Comma separated symbol list.

Responses

Response samples

Content type
application/json
Example
[ ]

Depth

Get current depth of market for the instrument. Optional.

Authorizations:
PasswordBearerOAuth2Bearer
query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

accountId
required
string

Account identifier.

symbol
required
string

Instrument name.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": {
    }
}

Data Permissions

Groups

Get a list of possible groups of symbols. A group is a set of symbols that share a common access level. Any user can have access to any number of such groups. In case your data integration does not require separating symbols into several groups, implementing this endpoint is still mandatory. You will be able to add a single group and place all symbols there.

IMPORTANT: Please plan your symbol grouping carefully. Groups cannot be deleted, you can only remove all the symbols from there.

LIMITATIONS: Each integration is limited to have up to 10 symbol groups. Each symbol group is limited to have up to 10K symbols in it. You cannot put the same symbol into 2 different groups.

This endpoint allows you to specify a list of groups, and the /permissions endpoint specifies which groups are available for the certain user.

When TradingView user logs into his broker account - he will gain access to one or more groups, depending on the /permissions endpoint.

At the /symbol_info endpoint TradingView adds the GET argument group with the name of the group. Thus, TradingView will receive information about which group each symbol belongs to.

Authorizations:
PasswordBearerServerOAuth2Bearer

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": {
    }
}

Permissions

Get a list of symbol groups allowed for the user. It is only required if you use groups of symbols to restrict access to instrument's data.

Authorizations:
PasswordBearerOAuth2Bearer

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": {
    }
}

Data Integration

Groups

Get a list of possible groups of symbols. A group is a set of symbols that share a common access level. Any user can have access to any number of such groups. In case your data integration does not require separating symbols into several groups, implementing this endpoint is still mandatory. You will be able to add a single group and place all symbols there.

IMPORTANT: Please plan your symbol grouping carefully. Groups cannot be deleted, you can only remove all the symbols from there.

LIMITATIONS: Each integration is limited to have up to 10 symbol groups. Each symbol group is limited to have up to 10K symbols in it. You cannot put the same symbol into 2 different groups.

This endpoint allows you to specify a list of groups, and the /permissions endpoint specifies which groups are available for the certain user.

When TradingView user logs into his broker account - he will gain access to one or more groups, depending on the /permissions endpoint.

At the /symbol_info endpoint TradingView adds the GET argument group with the name of the group. Thus, TradingView will receive information about which group each symbol belongs to.

Authorizations:
PasswordBearerServerOAuth2Bearer

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "d": {
    }
}

Symbol Info

Get a list of all instruments.

Authorizations:
PasswordBearerServerOAuth2Bearer
query Parameters
group
string

ID of a symbol group. If it presents then only symbols that belong to this group should be returned. Possible values are provided by the /groups endpoint. It is only required if you use groups of symbols to restrict access to instrument's data.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "symbol": [
    ],
  • "description": [
    ],
  • "currency": [
    ],
  • "base-currency": [
    ],
  • "exchange-listed": [
    ],
  • "exchange-traded": [
    ],
  • "minmovement": [
    ],
  • "minmovement2": [
    ],
  • "fractional": [
    ],
  • "pricescale": [
    ],
  • "root": [
    ],
  • "root-description": [
    ],
  • "has-intraday": [
    ],
  • "has-no-volume": [
    ],
  • "type": [
    ],
  • "typespecs": [
    ],
  • "volume-type": [
    ],
  • "is-cfd": [
    ],
  • "ticker": [
    ],
  • "timezone": [
    ],
  • "session-regular": [
    ],
  • "session-extended": [
    ],
  • "session-premarket": [
    ],
  • "session-postmarket": [
    ],
  • "has-daily": [
    ],
  • "has-weekly-and-monthly": [
    ],
  • "pointvalue": [
    ],
  • "expiration": [
    ],
  • "bar-source": [
    ],
  • "bar-transform": [
    ],
  • "bar-fillgaps": [
    ],
  • "isin": [
    ],
  • "wkn": [
    ]
}

History

Request for history bars. Each property of the response object is treated as a table column.

Data should meet the following requirements:

  • real-time data obtained from the API streaming endpoint must match the historical data, obtained from the /history API. The allowed count of mismatched bars (candles) must not exceed 5% for frequently traded symbols, otherwise the integration to TradingView is not possible;
  • the data must not include unreasonable price gaps, historical data gaps on 1-minute and Daily-resolutions (temporal gaps), obviously incorrect prices (adhesions).

Bar time for daily bars should be 00:00 UTC and is expected to be a trading day (not a day when the session starts).

Bar time for monthly bars should be 00:00 UTC and is the first trading day of the month.

If there is no data in the requested time period, you should return an empty response: {"s":"ok","t":[],"o":[],"h":[],"l":[],"c":[],"v":[]}

Authorizations:
PasswordBearerServerOAuth2Bearer
query Parameters
symbol
required
string

Symbol name or ticker.

resolution
required
string

Symbol resolution. Possible resolutions are daily (D or 1D, 2D ... ), weekly (1W, 2W ...), monthly (1M, 2M...) and an intra-day resolution – minutes(1, 2 ...).

from
required
number

Unix timestamp (UTC) of the leftmost required bar, including from.

to
required
number

Unix timestamp (UTC) of the rightmost required bar, including to. It can be in the future. In this case, the rightmost required bar is the latest available bar.

countback
number
Deprecated

Number of bars (higher priority than from) starting with to. If countback is set, from should be ignored.

Responses

Response samples

Content type
application/json
Example
{
  • "s": "ok",
  • "t": [
    ],
  • "o": [
    ],
  • "h": [
    ],
  • "l": [
    ],
  • "c": [
    ],
  • "v": [
    ]
}

Stream of prices

Stream of prices. Server constantly keeps the connection alive. If the connection is broken - the server constantly tries to restore it. TradingView establishes up to 4 simultaneous connections to this endpoint and expects to get the same data to all of them. Transfer mode is chunked encoding. The data feed should set 'Transfer-Encoding: chunked' and make sure that all intermediate proxies are set to use this mode. All messages are to be ended with \n. Data stream should contain real-time data only. It shouldn't contain snapshots of data.

Data feed should provide trades and quotes:

  • If trades are not provided, then data feed should set trades with bid price and bid size (mid price with 0 size in case of Forex).
  • Size is always greater than 0, except for the correction. In that case size can be 0.
  • Quote must contain prices of the best ask and the best bid.
  • Daily bars are required if they cannot be built from trades (has-daily should be set to true in the symbol information in that case).

The broker must remove unnecessary restrictions (firewall, rate limits, etc.) for the set of IP addresses of our servers.

StreamingHeartbeatResponse is a technical message that prevents the feed from unsubscribing from streaming. It doesn't affect the price data and should be sent to /streaming every 5 seconds by default. The message can be used, for example, when the trading session is closed on weekends or in case of low liquidity on the exchange when TradingView does not receive price updates for a long time.

Please note, that StreamingAskResponse and StreamingBidResponse are deprecated. The StreamingQuoteResponse should be used to provide ask / bid data.

Authorizations:
PasswordBearerServerOAuth2Bearer

Responses

Response samples

Content type
application/json
Example
{
  • "f": "q",
  • "id": "EURUSD",
  • "t": 1547942400,
  • "ap": 1.47245,
  • "as": 100,
  • "bp": 1.47245,
  • "bs": 100
}