TradingView REST API Specification for Brokers (1.4.27)

Download OpenAPI specification:Download

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.27. Added a new supportCustomOrderInfo flag. This flag enables the new /orderInfo endpoint, which retrieves order data displayed in the Order Ticket. The data is dynamically updated in the Order Info section of the Order Ticket based on the fields updates listed in the dependencies property of the new orderInfoConfig parameter from /config.

1.4.26. Added a new /userInfo endpoint to retrieve detailed information specific to each user.

1.4.25. Added new supportStopLoss flag.

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.

Authentication

PasswordBearer

This flow uses login and password to authenticate a user. Username and password are sent as parameters to the /authorize endpoint.

If the username and password are valid, then the broker issues an access token and returns it in the response. The access token is sent with every request in the Authorization header.

Security Scheme Type HTTP
HTTP Authorization Scheme bearer
Bearer format "Bearer ACCESS_TOKEN"

OAuth2Bearer

TradingView is using the Implicit or Code flow of OAuth 2 as it is described in the RFC 6749. After performing authorization, the access token is sent with every request in the Authorization header.

Implicit Flow:

For OAuth 2 Implicit Flow the broker provides TradingView with the following OAuth 2 application parameters:

Application parameter Description Example value
client id A unique client identifier sQeww4FgtythHTUrhrfMo9rRTq
authorization URI An authorization endpoint URI https://your-rest-implementation.com/api/authorize
scope A scope of the access request as a list of space-delimited, case-sensitive strings read trade profile

TradingView provides the broker with two redirect URIs, one for the staging environment and the other for the production environment.

Authorization Request

TradingView sends the authorization request according to OAuth 2 specification, 4.2.1. The following parameters will be in the query part of the authorization URI:

OAuth2 parameter Description
response_type Response type. The value will be set to token
client_id A client identifier string provided by the broker
redirect_uri Redirection Endpoint
scope A scope of the access request if it is provided by the broker
prompt The value will be set to login
state A literal string that the broker should return to TradingView without changes in the authorization response.

Note: The redirect_uri parameter should be verified by the broker's OAuth service, and should be whitelisted on the broker's service.

TradingView could send the lang parameter additionally if it is required by the broker, with the following possible values: ar, br, cs, de, el, en, es, fa, fr, he ,hu, id, in, it, ja, kr, ms, nl, pl, ro, ru, sv, th, tr, uk, vi, zh.

In case of successful authorization, the OAuth service redirects the user-agent (browser) to redirect_uri with the access token added as a fragment, according to OAuth 2 specification, 4.2.2. The state parameter should be passed without modifications. The expires_in parameter is optional, but is recommended to provide a more secure environment for integration users. A minimum value for the expires_in parameter is 60 sec.

Refresh Request

In order to refresh the access token the broker should support additional prompt parameter in the authorization requests, that is not a part of the OAuth specification, but it presents in the OpenID Connect specification. The broker should respect the none value of this parameter and display no authentication UI and just return an error if the user session is already expired (the specific error codes is also standardized by the OpenID Connect specification).

Code Flow:

For OAuth 2 Code Flow the broker provides TradingView with the following OAuth 2 application parameters:

Application parameter Description Example value
client id A unique client identifier sQeww4FgtythHTUrhrfMo9rRTq
client secret A client secret 45dd67oi56ds678st6788dffdyu
authorization URI An authorization endpoint URI https://your-rest-implementation.com/oauth/authorize
token URI A token endpoint URI https://your-rest-implementation.com/oauth/token
logout URI (optional) A logout URI https://your-rest-implementation.com/oauth/logout
scope A scope of the access request as a list of space-delimited, case-sensitive strings read trade profile

TradingView provides the broker with two redirect URIs, one for the staging environment and the other for the production environment.

TradingView also provides a redirect_uri URI if the broker supports user logout with a redirect.

Note: The redirect_uri parameter should be verified by the broker's OAuth service, and should be whitelisted on the broker's side.

Authorization Request

TradingView sends the Authorization Request according to OAuth 2 specification, 4.1.1. The following parameters will be in the query part of the authorization URI:

OAuth2 parameter Description
response_type Response type. The value will be set to code
client_id A client identifier string provided by the broker
redirect_uri Redirection Endpoint
scope A scope of the access request if it is provided by the broker
state A literal string that the broker should return back to TradingView without changes in the authorization response

Note: The redirect_uri parameter should be verified by the broker's OAuth service, and should be whitelisted on the broker's service.

TradingView could send the lang parameter additionally if it is required by the broker, with the following possible values: ar, br, cs, de, el, en, es, fa, fr, he ,hu, id, in, it, ja, kr, ms, nl, pl, ro, ru, sv, th, tr, uk, vi, zh.

If all the parameters of the authorization request are valid and access is granted, the broker issues an authorization code and redirects to the redirect URI with the following parameters added to the request URI component:

OAuth2 parameter Description
code The authorization code. It must expire shortly after its release to prevent the risk of leakage
state The exact value which was sent in the authorization request

Access Token Request

TradingView makes an Access Token Request by sending the following parameters using the application/x-www-form-urlencoded format:

OAuth2 parameter Description
grant_type The grant type. The value will be set to authorization_code
client_id A client identifier string provided by the broker
client_secret A client secret string provided by the broker
code The authorization code received from the broker
redirect_uri The same redirect URI used in the Authorization Request

After successful verification of the authorization code broker issues an access token, a refresh token and responds to the access token request as follows:

OAuth2 parameter Description
access_token The access token which will be used in every request to the API
refresh_token Token used to obtain new access tokens
token_type Token type. Should be set to bearer
expires_in The life time of the access token in seconds
refresh_token_expires_in The life time of the refresh token in seconds

The expires_in and refresh_token_expires_in parameters are optional, but are recommended to provide a more secure environment for integration users.

Refresh Request

To refresh the access token TradingView makes a Refresh Request to the token endpoint using the application/x-www-form-urlencoded format with the following parameters:

OAuth2 parameter Description
grant_type The grant type. The value will be set to refresh_token
refresh_token The refresh token issued by the broker
client_secret The client secret value provided by the broker

If all parameters are valid, the broker issues a new access token and, if necessary, a new refresh token and responds to the request as described in the Access token request section above.

Logout Request

To log the user out of the integration, TradingView makes a Logout Request to the logout endpoint with the following query string parameters:

OAuth2 parameter Description Example
client_id A client identifier string provided by the broker
redirect_uri The url where the user should be redirected to after logging out https://www.tradingview.com/trading/logout-redirect/
Security Scheme Type OAuth2
implicit OAuth Flow
Authorization URL: https://your-rest-implementation.com/api/authorize
Scopes:
  • general -

    permission to perform all requests

authorizationCode OAuth Flow
Authorization URL: https://your-rest-implementation.com/api/authorize
Token URL: https://your-rest-implementation.com/api/oauth/token
Scopes:
  • general -

    permission to perform all requests

ServerOAuth2Bearer

This authentication flow is used for server-to-server requests where authentication needs to be done without human intervention. It can be used with the /history, /symbol_info, /streaming and /groups endpoints.

JSON Web Token (JWT) is used to securely transmit information between broker and TradingView. More information about JWT can be found here.

Application and OAuth2 parameters

The broker provides the following application and OAuth2 parameters to TradingView:

Application parameter Description Example value
AppUrl A URL uniquely representing broker's application https://your-rest-implementation.com
UserId A user identifier for which the access token will be issued testuser1
OAuth2 parameter Description Example value
client_id A unique client Identifier FGGH7-TRVC3-ECDD2-CDHRG3-FYUDG5
client_secret Secret code adfegywrtyw
token_url An url to which the access token request will be sent https://your-rest-implementation.com/authorize/token
grant_type Indicates the type of grant being presented in exchange for an access token urn:your-broker:oauth:grant-type:personal-jwt

X.509 Certificate

The broker provides a valid X.509 certificate to TradingView for signing JWT.

JSON Web Token

JWT for the access token request is created with the following headers and claims:

Header Description Standard Sample Value
x5t Thumbprint of provided X.509 certificate used for signing JWT RFC 7515 935093f1690900asdfd98626dfw35fa22b41d9dfd
alg Algorithm used to sign JWT. RS256 is only supported at the moment RFC 1518 RS256
Claim Description Sample Value
iss Issuer - Value should be client_id FGGH7-TRVC3-ECDD2-CDHRG3
sub UserId - Value should be the UserId for which token is needed testuser1
exp Expiry - Value should be a Unix time stamp indicating expiry of the token 1549465914
aud Audience - Value should be the token_url https://your-rest-implementation.com/authorize/token
spurl AppUrl - The AppUrl of your application https://your-rest-implementation.com

Requesting the access token

TradingView sends a POST request to the token_url to obtain an access token. The client_id and client_secret are included as parameters in the request body. The JWT is sent in a parameter named assertion.

Example Access Token request

POST /token HTTP/1.1
Host: sim.logonvalidation.net
Content-Type: application/x-www-form-urlencoded

grant_type=urn%3Ayour-broker%3Aoauth%3Agrant-type%3Apersonal-jwt
&assertion=eyJhbGciOiJFUzI1NiIsImtpZCI6IjE2In0.eyJpc3Mi[...omitted for brevity...]
&client_id=1234-5678-9101
&client_secret=abcdefghijklmn

The response to this request should contain an access_token. A refresh_token is optional and can be omitted:

Example Access Token response

{
  "access_token" : "eyJhbfGujudUf.eyJvYWEiOiIw[omitted for brevity]",
  "expires_in": 1200,
  "token_type": "Bearer",
  "refresh_token": "86fy7fa3d2-5e13-4736-86031-9ehiyiufrow0b",
  "refresh_token_expires_in": 2400
}
Security Scheme Type OAuth2
clientCredentials OAuth Flow
Token URL: https://your-rest-implementation.com/api/authorize/token
Scopes:
  • general -

    permission to perform all requests

Authorization

Authorize

post /authorize

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/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" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

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

Responses

200

response

Response Schema: application/json
One of
  • AuthorizeResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (AccessToken)

Access token.

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"login=user1&password=dfkjhoijogpoi&locale=en"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Logout

post /logout

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/logout

Send logout if the supportLogout flag is set as true.

Responses

200

response

Response Schema: application/json
One of
  • SuccessResponse
  • ErrorResponse
s
required
string
Value: "ok"

Status will always be ok.

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok"
}

Broker Configuration

Configuration

get /config

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/config

Get localized configuration.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • ConfigResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (Config)

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Mapping

get /mapping

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/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

200

response

Response Schema: application/json
symbols
Array of objects (SingleMapping)
fields
Array of strings (SingleField) 1 items
Items Value: "brokerSymbol"

Array with the only one element ['brokerSymbol'].

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "symbols":
    [
    ],
  • "fields":
    [
    ]
}

Account

Accounts

get /accounts

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts

Get a list of accounts owned by the user.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • AccountResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
Array of objects (Account) non-empty

Response samples

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

User Info

get /userInfo

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/userInfo

Get detailed user-specific information.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • UserInfoResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (UserInfo)

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Instruments

get /accounts/{accountId}/instruments

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/instruments

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

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • InstrumentsResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
Array of objects (Instrument)

Response samples

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

State

get /accounts/{accountId}/state

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/state

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

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • AccountStateResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (AccountState)

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Stream State

get /accounts/{accountId}/stream/state

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/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.

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • AccountStateMessage
  • PingMessage
  • ErrorMessage
balance
required
number

Account Balance.

unrealizedPl
required
number

Unrealized profit/loss.

equity
number

Equity. If this field is not specified, then it is calculated as balance + unrealizedPl.

amData
Array of Array of Array of strings non-empty

Account manager data. Structure of Account manager is defined by the /config endpoint. Each element of this array is a table.

accountSummaryRowData
Array of strings non-empty

Account Summary Row data. Structure of Account Summary Row is defined by the /config endpoint.

marginAvailable
number

Current available margin for account.

Response samples

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

Orders

get /accounts/{accountId}/orders

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/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.

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • OrdersResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
Array of objects (Order)

Response samples

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

Stream Orders

get /accounts/{accountId}/stream/orders

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/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.

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • OrdersMessage
  • PingMessage
  • ErrorMessage
Array
id
required
string

Unique identifier.

instrument
required
string

Instrument name that is used on a broker's side.

qty
required
number

Quantity.

side
required
string
Enum: "buy" "sell"

Side.

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

Type.

status
required
string
Enum: "placing" "inactive" "working" "rejected" "filled" "cancelled"

String constants to describe an order status.

Status Description
placing order is not created on a broker's side yet
inactive bracket order is created but waiting for a base order to be filled
working order is created but not fully executed yet
rejected order is rejected for some reason
filled order is fully executed
cancelled order is cancelled
filledQty
number

Filled quantity.

avgPrice
number

Average price of order fills. It should be provided for filled / partly filled orders.

limitPrice
number

Limit Price for Limit or StopLimit orders only. You should not send this field for other order types.

stopPrice
number

Stop Price for Stop or StopLimit orders only. You should not send this field for other order types.

trailingStopPips
number

Distance from the stop loss level to the current market price in pips for a position or to the order price if the parent is a stop or limit order.

isTrailingStop
boolean

If this flag is set to true, then the stop order is a trailing stop.

isGuaranteedStop
boolean

If this flag is set to true, then the stop order is a guaranteed stop.

parentId
string

Identifier of a parent order or a parent position (for position brackets) depending on parentType. Should be set only for bracket orders.

parentType
string
Enum: "order" "position"

Type of order's parent. Should be set only for bracket orders.

duration
object

Expiration type and Unix timestamp date/time.

lastModified
number

Indicates the time when the order was last modified, Unix timestamp (UTC).

customFields
Array of objects (CustomFieldsValueItem) non-empty

Localized order custom fields values data. Custom fields are configured in the /config endpoint response. Custom Order dialog fields are to be sent along with the standard fields in the order object.

message
object (OrderInformationalMessage)

Informational message description, that will be displayed for the order in the Account manager. The message will be marked with a color, corresponding to a message type. The text message will also be displayed in the notification pop-up in case the order status gets changed.

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
[
  • {
    }
]

Positions

get /accounts/{accountId}/positions

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/positions

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

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • PositionsResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
Array of objects (Position)

Response samples

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

Stream Positions

get /accounts/{accountId}/stream/positions

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/stream/positions

Stream positions for an account. The first message must be a snapshot including all active positions and their required fields. Subsequent messages should include only updates; there is no need to resend the full list of positions. If any fields of an active position change, the server must send an updated position with all fields included. When a position is closed, the server must send an update with position id and qty:0, omitting all other fields. If no updates occur within 5 seconds, a ping message must be sent.

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • StreamPositionsMessage
  • PingMessage
  • ErrorMessage
Array
Any of
  • Position
  • StreamClosedPosition
id
required
string

Unique identifier.

instrument
required
string

Instrument name that is used on a broker's side.

qty
required
number

Quantity.

side
required
string
Enum: "buy" "sell"

Side.

avgPrice
required
number

Average price of position trades.

unrealizedPl
number

Unrealized (open) profit/loss.

message
object (PositionInformationalMessage)

Informational message description, that will be displayed for the position in the Account manager. The message will be marked with a color, corresponding to a message type.

customFields
Array of objects (CustomFieldsValueItem) non-empty

Localized position custom fields values data. Custom fields are configured in the /config endpoint response.

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
[
  • {
    },
  • {
    }
]

Net Positions

get /accounts/{accountId}/netPositions

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/netPositions

Get net positions for an account.

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • NetPositionsResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
Array of objects (NetPosition)

Response samples

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

Stream Net Positions

get /accounts/{accountId}/stream/netPositions

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/stream/netPositions

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.

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • StreamNetPositionsMessage
  • PingMessage
  • ErrorMessage
Array
Any of
  • NetPosition
  • StreamClosedPosition
id
required
string

Unique identifier.

instrument
required
string

Instrument name that is used on a broker's side.

qty
required
number

Net quantity.

longQty
number

Net quantity of long positions.

shortQty
number

Net quantity of short positions.

avgPrice
number

Average price of net position trades.

customFields
Array of objects (CustomFieldsValueItem) non-empty

Localized net position custom fields values data. Custom fields are configured in the /config endpoint response.

message
object (PositionInformationalMessage)

Informational message description, that will be displayed for the position in the Account manager. The message will be marked with a color, corresponding to a message type.

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
[
  • {
    },
  • {
    }
]

Individual Positions

get /accounts/{accountId}/individualPositions

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/individualPositions

Get individual positions for an account

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • IndividualPositionsResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
Array of objects (IndividualPosition)

Response samples

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

Stream Individual Positions

get /accounts/{accountId}/stream/individualPositions

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/stream/individualPositions

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.

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • StreamIndividualPositionsMessage
  • PingMessage
  • ErrorMessage
Array
Any of
  • IndividualPosition
  • StreamClosedPosition
id
required
string

Unique identifier.

instrument
required
string

Instrument name that is used on a broker's side.

qty
required
number

Quantity.

side
required
string
Enum: "buy" "sell"

Side.

price
required
number

Individual position's price.

date
required
string

The date when the individual position was opened. UNIX timestamp in milliseconds.

unrealizedPl
number

Individual position's profit/loss.

customFields
Array of objects (CustomFieldsValueItem) non-empty

Localized individual position custom fields values data. Custom fields are configured in the /config endpoint response.

message
object (PositionInformationalMessage)

Informational message description, that will be displayed for the position in the Account manager. The message will be marked with a color, corresponding to a message type.

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
[
  • {
    },
  • {
    },
  • {
    }
]

Balances

get /accounts/{accountId}/balances

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/balances

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

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • CryptoBalancesResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
Array of objects (CryptoBalance)

Response samples

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

Executions

get /accounts/{accountId}/executions

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/executions

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

path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • ExecutionsResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
Array of objects (Execution)

Response samples

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

Orders History

get /accounts/{accountId}/ordersHistory

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/ordersHistory

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

path Parameters
accountId
required
string

Account identifier.

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

Locale (language) id.

maxCount
number

Maximum count of orders to return.

Responses

200

response

Response Schema: application/json
One of
  • OrdersHistoryResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
Array of objects (OrderHistory)

Response samples

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

Get Leverage

post /accounts/{accountId}/getLeverage

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/getLeverage

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.

path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • GetLeverageResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (GetLeverage)

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"instrument=BTCPERP&side=buy&orderType=market"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Set Leverage

post /accounts/{accountId}/setLeverage

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/setLeverage

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.

path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • SetLeverageResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (SetLeverage)

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"instrument=BTCPERP&side=buy&orderType=market&leverage=25"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Preview Leverage

post /accounts/{accountId}/previewLeverage

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/previewLeverage

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.

path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • PreviewLeverageResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (PreviewLeverage)

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"instrument=BTCPERP&side=buy&orderType=market&leverage=25"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Trading

Place Order

post /accounts/{accountId}/orders

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/orders

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

path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • PostOrderResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"instrument=EURUSD&side=buy&type=limit&qty=1&limitPrice=1.23456&stopPrice=0&durationType=gtt&durationDateTime=1548406235&stopLoss=0&trailingStopPips=0&guaranteedStop=0&takeProfit=0&digitalSignature=954345868&currentAsk=1.25&currentBid=1.23&confirmId=112358"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Modify Order

put /accounts/{accountId}/orders/{orderId}

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/orders/{orderId}

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

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" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • SuccessResponse
  • SuccessResponseWithTransactionId
  • ErrorResponse
s
required
string
Value: "ok"

Status will always be ok.

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"qty=1&limitPrice=1.23456&stopPrice=0&durationType=gtt&durationDateTime=1548406235&stopLoss=0&trailingStopPips=0&guaranteedStop=0&takeProfit=0&digitalSignature=954345868&currentAsk=1.25&currentBid=1.23&confirmId=112358"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok"
}

Cancel Order

delete /accounts/{accountId}/orders/{orderId}

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/orders/{orderId}

Cancel an existing order.

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" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • SuccessResponse
  • SuccessResponseWithTransactionId
  • ErrorResponse
s
required
string
Value: "ok"

Status will always be ok.

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok"
}

Preview Order

post /accounts/{accountId}/previewOrder

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/previewOrder

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.

path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • PreviewOrderResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (PreviewOrder)

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"qty=1&limitPrice=1.23456&stopPrice=0&durationType=gtt&durationDateTime=1548406235&stopLoss=0&trailingStopPips=0&guaranteedStop=0&takeProfit=0&digitalSignature=954345868&currentAsk=1.25&currentBid=1.23&instrument=EURUSD&side=buy&type=limit&id=21698953"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Order Info

post /accounts/{accountId}/orderInfo

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/orderInfo

Retrieves order data displayed in the Order Ticket. This information is displayed in the Order Info section. This endpoint is used if supportCustomOrderInfo flag is set to true.

path Parameters
accountId
required
string

Account identifier.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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.

id
string

Identifier of the order.

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.

Responses

200

response

Response Schema: application/json
One of
  • OrderInfoResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (OrderInfo)

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"id=21698953&instrument=EURUSD&side=buy&type=limit&qty=1&limitPrice=1.23456&stopPrice=0&durationType=gtt&durationDateTime=1548406235&stopLoss=0&trailingStopPips=0&guaranteedStop=0&takeProfit=0&digitalSignature=954345868&currentAsk=1.25&currentBid=1.23"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Modify Position

put /accounts/{accountId}/positions/{positionId}

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/positions/{positionId}

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

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" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • SuccessResponse
  • SuccessResponseWithTransactionId
  • ErrorResponse
s
required
string
Value: "ok"

Status will always be ok.

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"stopLoss=1.283568&trailingStopPips=0&guaranteedStop=0&takeProfit=1.294436&currentAsk=1.287367&currentBid=1.28554&side=buy"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok"
}

Close Position

delete /accounts/{accountId}/positions/{positionId}

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/positions/{positionId}

Close an existing position.

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" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • SuccessResponse
  • SuccessResponseWithTransactionId
  • ErrorResponse
s
required
string
Value: "ok"

Status will always be ok.

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"amount=5"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok"
}

Close Net Position

delete /accounts/{accountId}/netPositions/{netPositionId}

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/netPositions/{netPositionId}

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

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" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW"

Locale (language) id.

Responses

200

response

Response Schema: application/json
One of
  • SuccessResponse
  • SuccessResponseWithTransactionId
  • ErrorResponse
s
required
string
Value: "ok"

Status will always be ok.

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok"
}

Modify Individual Position

put /accounts/{accountId}/individualPositions/{individualPositionId}

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/individualPositions/{individualPositionId}

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

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" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • SuccessResponse
  • SuccessResponseWithTransactionId
  • ErrorResponse
s
required
string
Value: "ok"

Status will always be ok.

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"stopLoss=1.283568&trailingStopPips=0&guaranteedStop=0&takeProfit=1.294436&currentAsk=1.287367&currentBid=1.28554"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok"
}

Close Individual Position

delete /accounts/{accountId}/individualPositions/{individualPositionId}

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/individualPositions/{individualPositionId}

Close an individual position.

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" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • SuccessResponse
  • SuccessResponseWithTransactionId
  • ErrorResponse
s
required
string
Value: "ok"

Status will always be ok.

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"amount=5"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok"
}

Latency Tracking

post /accounts/{accountId}/trackLatency

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/accounts/{accountId}/trackLatency

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.

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

200

response

Response Schema: application/json
s
required
string
Value: "ok"

Status will always be ok.

Request samples

Content type
application/x-www-form-urlencoded
Copy
Expand all Collapse all
"transactionId=string&transactionType=place_order&instrument=string&qty=0&side=buy&ask=1.287367&bid=1.28554&timestamp=1548406235000&roundTripStartTime=1548406230000&roundTripDuration=183"

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "s": "ok"
}

Market Data

Quotes

get /quotes

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/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.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • QuotesResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
Array of objects (Quotes) non-empty

Response samples

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

Stream Quotes

get /stream/quotes

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/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.

query Parameters
locale
required
string (Locale)
Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "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

200

response

Response Schema: application/json
One of
  • Quotes
  • PingMessage
  • ErrorMessage
Array
n
required
string

Symbol name. Should be equal to the requested one.

v
required
object (SingleQuote)

Price and restriction data for an instrument.

s
string (Status)
Enum: "ok" "error"

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
[
  • {
    }
]

Depth

get /depth

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/depth

Get current depth of market for the instrument. Optional.

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

Locale (language) id.

accountId
required
string

Account identifier.

symbol
required
string

Instrument name.

Responses

200

response

Response Schema: application/json
One of
  • DepthResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (Depth)

Depth of market for an instrument.

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Data Permissions

Groups

get /groups

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/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.

Responses

200

response

Response Schema: application/json
One of
  • GroupListResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (GroupList)

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Permissions

get /permissions

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/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.

Responses

200

response

Response Schema: application/json
One of
  • PermissionsResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (PermissionGroups)

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Data Integration

Groups

get /groups

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/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.

Responses

200

response

Response Schema: application/json
One of
  • GroupListResponse
  • ErrorResponse
s
required
string (OkStatus)
Value: "ok"

Status will always be ok.

d
required
object (GroupList)

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "s": "ok",
  • "d":
    {
    }
}

Symbol Info

get /symbol_info

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/symbol_info

Get a list of all instruments.

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

200

response

Response Schema: application/json
One of
  • SymbolInfoResponse
  • ErrorResponse
s
required
string
Value: "ok"

Status will always be ok.

symbol
required
Array of strings non-empty

It is a symbol name which is a string that users see. Also, the symbol name is used for data requests if you are not using tickers. symbol must contain uppercase letters and can optionally contain numbers, dots, or underscores. Learn more about symbol in the manual.

description
required
Array of strings

Description of a symbol. Will be displayed in the chart legend for this symbol.

currency
required
Array of strings Nullable
Default: null

Symbol currency, also named as counter currency. If a symbol is a currency pair, then the currency field has to contain the second currency of this pair. For example, USD is a currency for EURUSD ticker. Fiat currency must meet the ISO 4217 standard.

exchange-listed
required
Array of strings

Short name of exchange where this symbol is listed.

exchange-traded
required
Array of strings

Short name of exchange where this symbol is traded.

minmovement
required
Array of numbers

Minimal integer price change.

pricescale
required
Array of numbers

Indicates how many decimal points the price has. For example, if the price has 2 decimal points (ex., 300.01), then pricescale is 100. If it has 3 decimals, then pricescale is 1000 etc. If the price doesn't have decimals, set pricescale to 1.

timezone
required
Array of strings
Items Enum: "America/New_York" "America/Los_Angeles" "America/Chicago" "America/Phoenix" "America/Toronto" "America/Vancouver" "America/Argentina/Buenos_Aires" "America/El_Salvador" "America/Sao_Paulo" "America/Bogota" "Europe/Moscow" "Europe/Athens" "Europe/Berlin" "Europe/London" "Europe/Madrid" "Europe/Paris" "Europe/Warsaw" "Australia/Sydney" "Australia/Brisbane" "Australia/Adelaide" "Australia/ACT" "Asia/Almaty" "Asia/Ashkhabad" "Asia/Tokyo" "Asia/Taipei" "Asia/Singapore" "Asia/Shanghai" "Asia/Seoul" "Asia/Tehran" "Asia/Dubai" "Asia/Kolkata" "Asia/Hong_Kong" "Asia/Bangkok" "Pacific/Auckland" "Pacific/Chatham" "Pacific/Fakaofo" "Pacific/Honolulu" "America/Mexico_City" "Africa/Johannesburg" "Asia/Kathmandu" "US/Mountain" "Etc/UTC"

Timezone of the exchange for this symbol. We expect to get the name of the time zone in olsondb format.

type
required
Array of strings (SymbolType)
Items Enum: "stock" "dr" "right" "bond" "warrant" "structured" "index" "forex" "futures" "spot" "swap" "commodity" "crypto" "cfd" "option"

Symbol type (forex/stock etc.). Deprecated values: crypto, cfd

session-regular
required
Array of strings

Session time format is HHMM-HHMM. E.g., a session that starts at 9:30 am and ends at 4:00 pm should look like 0930-1600. There is a special case for symbols traded 24/7 (e.g., Bitcoin and other cryptocurrencies): the session string should be 24x7. To specify an overnight session set start time greater than end time (ie, 1700-0900). Session time is expected to be in exchange time zone.

base-currency
Array of strings Nullable
Default: null

For currency pairs only. This field contains the first currency of the pair. For example, base currency for EURUSD ticker is EUR. Fiat currency must meet the ISO 4217 standard.

minmovement2
Array of numbers

This is a number for complex price formatting cases. The default value is 0.

fractional
Array of booleans

Boolean showing whether this symbol wants to have complex price formatting (see minmovement2) or not. The default value is false.

root
Array of strings Nullable
Default: null

Root of the features. It's required for futures symbol types only. Provide a null value for other symbol types.

root-description
Array of strings Nullable
Default: null

Short description of the futures root that will be displayed in the symbol search. It's required for futures only. Provide a null value for other symbol types.

has-intraday
Array of booleans

Boolean value showing whether the symbol includes intraday (minutes) historical data. If it's false then all buttons for intraday resolutions will be disabled for this particular symbol.

has-no-volume
Array of booleans

Boolean showing whether the symbol includes volume data or not. The default value is false.

typespecs
Array of strings Nullable

An array of strings. Each element can be a list of comma separated values. Applicable values:

  • cfd
  • spreadbet
  • crypto
volume-type
Array of strings Nullable
Items Enum: "base" "quote" "tick" "contract"

The volume type of the symbol. Required if the typespecs field includes 'crypto' and the has-no-volume field is set to false.

is-cfd
Array of booleans
Deprecated

Boolean value showing whether the symbol is CFD. The base instrument type is set using the type field. Deprecated. Use typespecs instead.

ticker
Array of strings

This is a unique identifier for this particular symbol in your symbology. If you specify this property then its value will be used for all data requests for this symbol.

session-extended
Array of strings

An extended session, includes session-premarket and session-postmarket. The start time should be earlier or be equal to the start time of the session-regular and be equal to the start time of the session-premarket if it exists.

session-premarket
Array of strings

An additional session before session-regular. The start time should be equal to the start time of the session-extended. The end time should be equal or less than the start time of the session-regular.

session-postmarket
Array of strings

An additional session after the session-regular. The start time should be equal or greater than the end time of the session-regular. The end time should be equal to the end time of the session-extended.

has-daily
Array of booleans

The boolean value showing whether data feed has its own daily resolution bars or not. If has-daily = false then Charting Library will build the respective resolutions using 1-minute bars by itself. If not, then it will request those bars from the data feed. The default value is true.

has-weekly-and-monthly
Array of booleans

The boolean value showing whether data feed has its own weekly and monthly resolution bars or not. If has-weekly-and-monthly = false then Charting Library will build the respective resolutions using daily bars by itself. If not, then it will request those bars from the data feed. The default value is false.

pointvalue
Array of numbers

The currency value of a single whole unit price change in the instrument's currency. If the value is not provided it is assumed to be 1.

expiration
Array of numbers Nullable
Default: null

Expiration of the futures in the following format: YYYYMMDD. Required for futures type symbols only.

bar-source
Array of strings
Items Enum: "bid" "ask" "mid" "trade"

The principle of building bars. The default value is trade.

bar-transform
Array of strings
Items Enum: "none" "openprev" "prevopen"

The principle of bar alignment. The default value is none.

bar-fillgaps
Array of booleans

Is used to create the zero-volume bars in the absence of any trades (i.e. bars with zero volume and equal OHLC values ). The default value is false.

isin
Array of strings

International Securities Identification Number. It's needed for classic stock instruments only.

wkn
Array of strings

German Securities Identification Code. It's needed for classic German stock instruments only.

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "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

get /history

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/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":[]}

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

200

response

Response Schema: application/json
One of
  • HistorySuccessResponse
  • HistoryEmptyBarResponse
  • ErrorResponse
s
required
string
Value: "ok"

Status will always be ok.

t
required
Array of numbers

Bar time, Unix timestamp (UTC). Daily bars should only have the date part, time should be 0.

o
required
Array of numbers

Open price.

h
required
Array of numbers

High price.

l
required
Array of numbers

Low price.

c
required
Array of numbers

Close price.

v
required
Array of numbers

Volume.

Response samples

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

Stream of prices

get /streaming

Your REST API implementation url. Change it to your real REST API url.

https://your-rest-implementation.com/api/streaming

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.

Responses

200

response

Response Schema: application/json
One of
  • StreamingQuoteResponse
  • StreamingTradeResponse
  • StreamingDailyBarResponse
  • StreamingHeartbeatResponse
  • StreamingAskResponse(deprecated)
  • StreamingBidResponse(deprecated)
f
required
string

Should always be q.

id
required
string

Symbol.

t
required
number

Unix time UTC.

ap
required
number

Best ask price.

as
required
number

Best ask size.

bp
required
number

Best bid price.

bs
required
number

Best bid size.

Response samples

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