TradingView REST API Specification for Brokers (1.4.24)
This API is to be implemented by the Brokers in order to connect their backend systems to TradingView, that acts as a frontend.
Check the info page for more info and use the contact form there if you have any questions.
Types of requests
There are two types of requests — client and server. Client requests are executed at the browser. Server requests are initiated from the TradingView servers. If your integration does not imply brokerage data stream connection to the TradingView website - then there won't be any server requests.
Clients requests
The two possible ways of sending updates to the client's side are either done by making use of client regularly polling endpoints, or by opening a streaming connection and pushing updates.
HTTP requests
From the browser TradingView requests the info (list of orders and positions, balance info, etc.) from the broker’s server. The requests are sent periodically and the intervals can be set by using the /config endpoint. After that, TradingView compares the new data with the previous answer and calculates the difference. If the status of the order/position changes or new data appears - the user will see a notification and the changes will display in the Account manager on the website.
Requests to the endpoints for placing/modifying orders, positions closing, etc. occur only after actions made by the user.
The /quotes endpoint retrieves the current bid/ask from the broker. The /depth endpoint retrieves Level 2 market data.
HTTP streaming
If the integration uses HTTP streaming endpoints, the connections to them are established once at the start of a session. The http-streaming consists of messages separated with line breaks. The content of the messages must be in Compact JSON format, i.e. should not contain any line breaks, except a line break at the very end which will act as a message separator.
There are four types of messages:
- Entities snapshot
- Entities updates
- Ping
- Error
Please refer to the streaming endpoints for more details.
Server requests
In case if a Broker provides any Forex or CFD trading access for its clients it will require connection of its own market data at TradingView. In order to make it possible, you will need to implement the following endpoints - /symbol_info, /history and /streaming. Data requests are sent from different TradingView servers. Usually, at least 4 servers are used. The historical data is cached on TradingView servers and loaded to the client browser from our servers.
Restricting access to data
By default, the broker symbols will be available in the symbol search at TradingView and all the community will have access to your data streams without any limitation. In order to limit the access to your data streams please use the following endpoints - /groups and /permissions.
You can find more information about restricting access to the data in the description of these endpoints.
Change log
1.4.24. Added support for broker's hyperlinks to be displayed in an order preview or an order ticket.
1.4.23. Added the minimum allowed value for the expires_in
parameter.
1.4.22. Added support for hyperlinks in /orderPreview response.
1.4.21. Added custom text field support.
Added new textField
field to the /accounts and /instruments endpoints
for the orderDialogCustomFields
object.
1.4.20. Changed the typespecs parameter type in /symbol_info endpoint's response.
1.4.19. The supportExecutions
flag became deprecated. The Executions endpoint is now mandatory.
1.4.18. The supportOrdersHistory
flag became deprecated. The Orders History endpoint is now mandatory.
1.4.17. Added new supportCloseIndividualPosition
flag.
1.4.16. Added connection warning message configuration to the /accounts endpoint.
1.4.15. Added new flag supportRiskControlsAndInfo
.
1.4.14. Added support for Guaranteed Stop brackets for orders and positions. Added new flag supportGuaranteedStop
.
1.4.13. Added logout with redirect to OAuth 2 Code Flow.
1.4.12. Added a closed position description to the /stream/positions, /stream/individualPositions and /stream/netPositions endpoints responses.
1.4.11. Changed the transactionId parameter type, changed the common response description.
1.4.10. Added new typespecs
field to /instruments endpoint's response.
Added new applicable values for the type
field in the same endpoint's response: spot
, swap
, commodity
.
Marked the cfd
and crypto
values in the type
field as deprecated.
Added new volume-type
field to /symbol_info endpoint's response.
1.4.9. Added new roundTripStartTime
field to the /trackLatency endpoint's request body.
1.4.8. Added new flag supportAddBracketsToExistingOrder
.
1.4.7. Added new flag supportStrictCheckingLimitOrderPrice
.
1.4.6. Added 'modify_individual_position' and 'close_individual_position' transaction types to the /trackLatency endpoint.
1.4.5. Added support for refresh_token_expires_in
parameter for OAuth 2 Code Flow.
1.4.4. Added support for individual and net position streaming, added two new endpoints: /stream/individualPositions a streaming alternative to the /individualPositions endpoint. /stream/netPositions a streaming alternative to the /netPositions endpoint.
1.4.3. Added marginAvailable
field to the AccountState
parameters.
1.4.2. Added amount
field to /individualPositions endpoint. Added new supportPartialCloseIndividualPosition
flag.
1.4.1. Added two new endpoints: /stream/state. A streaming alternative to the /state endpoint. /stream/quotes. A streaming alternative to the /quotes endpoint.
1.4.0. Added support for http-streaming and two new endpoints: /stream/orders and /stream/positions.
1.3.35. Added support for net and individual positions. Added the following endpoints:
/netPositions, /individualPositions,
/closeNetPosition, /closeIndividualPosition
and /modifyIndividualPosition.
Added new flag supportIndividualPositionBrackets
.
1.3.34. Added track latency support. Added new supportTrackLatency
flag. Added new endpoint:
/trackLatency.
1.3.33. Added new flag supportStopLimitOrdersInBothDirections
.
1.3.32. Added new flag supportLeverageButton
.
1.3.31. The locale parameter for the /authorization endpoint is now required only for trading integration.
1.3.30. Added new currentAsk
and currentBid
fields to the /modifyPosition endpoint.
1.3.29. Added custom checkbox support.
Added new checkbox
field to the /accounts and /instruments endpoints
for the orderDialogCustomFields
object.
1.3.28. Added new variableMinTick
field to the /instruments endpoint.
1.3.27. Added hardToBorrow
, notShortable
, halted
parameters to the /quotes endpoint.
1.3.26. In /symbol_info, the minmov2
property renamed to minmovement2
, the Etc/UTC
timezone added. In /history , the HistoryNextBarResponse
response changed to
HistoryEmptyBarResponse
, the countback
query parameter became deprecated.
In /accounts, added the isVerified
property.
1.3.25. Added locale
parameter to the /authorize endpoint.
1.3.24. Added leverage support. Added new supportLeverage
flag. Added three new endpoints:
/getLeverage, /setLeverage and /previewLeverage.
1.3.23. Changed description of forceUserEnterInitialValue
flag in the OrderDialogCustomFields
parameters.
1.3.22. Added new flags - supportModifyOrderPrice
and supportModifyBrackets
. The supportModifyOrder
flag became deprecated.
1.3.21. Added new units
field to the /instruments endpoint.
1.3.20. Added new supportTrailingStop
flag. Added support for trailing stops for orders and positions.
1.3.19. Added new logout
endpoint, supportLogout
flag.
1.3.18. Added new supportPartialClosePosition
flag and amount
field to the /closePosition
endpoint parameters.
1.3.17. Added stopPercent
and limitPercent
validation rules to the /instruments endpoint.
1.3.16. Added new supportOrderHistoryCustomFields
flag and orderHistoryCustomFields
field to the ui
object
in the /accounts endpoint and /config.
1.3.15. Added supportedOrderTypes
field to the Duration
parameters.
1.3.14. Added isCapitalize
field to the positionCustomFields
and orderCustomFields
parameters.
1.3.13. Added rules parameter to the /instruments endpoint.
1.3.12. Added prefix
field to the Account
parameters.
1.3.11. Changed description for /placeOrder, /modifyOrder,
/previewOrder, OrderDialogCustomFields
and customFields
field in OrderCommon
.
1.3.10. Added locale
query parameter to /getOrders, /placeOrder,
/modifyOrder, /cancelOrder, /getPositions,
/modifyPosition, /closePosition,
/getExecutions, /getOrdersHistory,
/getQuotes, /getDepth and /getBalances endpoints.
1.3.9. Added orderId
, isClose
, positionId
and commission
fields to Execution.
1.3.8. Added id
field to the /previewOrder endpoint parameters.
1.3.7. Added mutable
field to the OrderDialogCustomFields
parameters.
1.3.6. Added lang
query parameter to OAuth authorization request.
1.3.5. Added accountId
query parameter to depth
endpoint.
1.3.4. Added Order dialog customization opportunity on the instrument basis. Moved OrderDialogCustomFields
to
the ui
object in the /accounts endpoint.
1.3.3. Added new supportStopOrdersInBothDirections
flag.
1.3.2. Added new previewOrder
endpoint, supportPlaceOrderPreview
and supportModifyOrderPreview
flags.
1.3.1. Added OAuth 2 Code Flow.
1.3.0. Added overriding Account manager and Durations configuration on Account basis.
1.2.5. Added reserved
, value
and valueCurrency
fields to Crypto Balances.
1.2.4. Added default values to the account flags. Added supportMarketBrackets
account flag.
1.2.3. Added current ask/bid fields to the parameters of the order placement and modification requests.
1.2.2. Added supportPartialOrderExecution flag.
1.2.1. Added support for position's and order's Custom fields. Removed fixedWidth
and sortable
fields from AccountManagerColumn
.
1.2.0. Introducing new Quote response. Deprecation of streaming Bid and Ask responses. All new integrations should use the Quote response to provide ask/bid values. Added supportMarketOrders, supportLimitOrders, supportStop orders account flags. Added informational message to order and position.
1.1.3. Added support for reverse of the position.
1.1.2. Added support for custom Account Summary Row.
1.1.1. Added type
field to /accounts endpoint.
1.1.0. Refactor, added examples.
Configuration
Get localized configuration.
Authorizations:
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": {
- "accountSummaryRow": [
- {
- "id": "accountBalance",
- "title": "Account Balance"
}, - {
- "id": "Equity",
- "title": "Realized P/L"
}, - {
- "id": "Open Profit",
- "title": "Unrealized P/L"
}
], - "accountManager": [
- {
- "id": "accountSummary",
- "title": "",
- "columns": [
- {
- "id": "todayPL",
- "title": "Today's P&L"
}, - {
- "id": "accountValue",
- "title": "Account Value"
}, - {
- "id": "balance",
- "title": "Balance"
}, - {
- "id": "totalMargin",
- "title": "Margin"
}, - {
- "id": "held",
- "title": "Held"
}, - {
- "id": "buyingPower",
- "title": "Buying Power"
}
]
}
], - "durations": [
- {
- "id": "GTT",
- "title": "Good Till Time",
- "hasDatePicker": true,
- "hasTimePicker": true,
- "default": true,
- "supportedOrderTypes": [
- "stop",
- "stoplimit"
]
}
], - "orderCustomFields": [
- {
- "id": "commission",
- "title": "Commission",
- "tooltip": "Commission Fees",
- "alignment": "right"
}
], - "orderHistoryCustomFields": [
- {
- "id": "commission",
- "title": "Commission",
- "tooltip": "Commission Fees",
- "alignment": "right"
}
], - "positionCustomFields": [
- {
- "id": "exchangeFee",
- "title": "Exchange fee",
- "tooltip": "Exchange fee for the position",
- "alignment": "right"
}, - {
- "id": "routeFee",
- "title": "Route fee",
- "tooltip": "Route fee for the position",
- "alignment": "right"
}
], - "netPositionCustomFields": [
- {
- "id": "exchangeFee",
- "title": "Exchange fee",
- "tooltip": "Exchange fee for the position",
- "alignment": "right"
}, - {
- "id": "routeFee",
- "title": "Route fee",
- "tooltip": "Route fee for the position",
- "alignment": "right"
}
], - "individualPositionCustomFields": [
- {
- "id": "exchangeFee",
- "title": "Exchange fee",
- "tooltip": "Exchange fee for the position",
- "alignment": "right"
}, - {
- "id": "routeFee",
- "title": "Route fee",
- "tooltip": "Route fee for the position",
- "alignment": "right"
}
], - "pullingInterval": {
- "quotes": 500,
- "orders": 500,
- "positions": 1000,
- "accountManager": 1000,
- "balances": 1000
}
}
}
Mapping
Return all broker instruments with corresponding TradingView instruments. It is required to add a Broker to TradingView.com. Please note that this endpoint works without authorization!
Responses
Response samples
- 200
{- "symbols": [
- {
- "f": [
- "EURUSD"
], - "s": "FX_IDC:EURUSD"
}, - {
- "f": [
- "AAPLE"
], - "s": "NASDAQ:AAPLE"
}
], - "fields": [
- "brokerSymbol"
]
}
Accounts
Get a list of accounts owned by the user.
Authorizations:
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": [
- {
- "id": "ACC-001",
- "name": "Demo trading account",
- "type": "demo",
- "currency": "JPY",
- "currencySign": "¥",
- "config": {
- "supportBrackets": true,
- "supportOrderBrackets": false,
- "supportAddBracketsToExistingOrder": true,
- "supportMarketBrackets": true,
- "supportPositionBrackets": false,
- "supportPositions": true,
- "supportMultiposition": false,
- "supportClosePosition": false,
- "supportPartialClosePosition": false,
- "supportReversePosition": true,
- "supportNativeReversePosition": false,
- "supportMarketOrders": true,
- "supportLimitOrders": true,
- "supportStopOrders": true,
- "supportStopLimitOrders": false,
- "supportTrailingStop": false,
- "supportGuaranteedStop": false,
- "supportStopOrdersInBothDirections": false,
- "supportStopLimitOrdersInBothDirections": false,
- "supportPartialOrderExecution": false,
- "supportModifyOrder": true,
- "supportModifyOrderPrice": true,
- "supportEditAmount": true,
- "supportModifyBrackets": true,
- "supportModifyDuration": false,
- "supportCryptoExchangeOrderTicket": false,
- "supportDigitalSignature": false,
- "supportPlaceOrderPreview": false,
- "supportModifyOrderPreview": false,
- "showQuantityInsteadOfAmount": false,
- "supportBalances": false,
- "supportOrdersHistory": false,
- "supportLeverage": false,
- "supportLeverageButton": true,
- "supportDOM": true,
- "supportLevel2Data": false,
- "supportPLUpdate": true,
- "supportDisplayBrokerNameInSymbolSearch": true,
- "supportLogout": false,
- "supportCustomAccountSummaryRow": false,
- "supportPositionCustomFields": false,
- "supportOrderCustomFields": false,
- "supportOrderHistoryCustomFields": false,
- "supportTrackLatency": false,
- "supportPositionNetting": false,
- "supportIndividualPositionBrackets": false,
- "supportCloseIndividualPosition": false,
- "supportPartialCloseIndividualPosition": false,
- "supportStrictCheckingLimitOrderPrice": false,
- "supportRiskControlsAndInfo": true
}, - "ui": {
- "accountSummaryRow": [
- {
- "id": "accountBalance",
- "title": "Account Balance"
}, - {
- "id": "Equity",
- "title": "Realized P/L"
}, - {
- "id": "Open Profit",
- "title": "Unrealized P/L"
}
], - "accountManager": [
- {
- "id": "accountSummary",
- "title": "",
- "columns": [
- {
- "id": "todayPL",
- "title": "Today's P&L"
}, - {
- "id": "accountValue",
- "title": "Account Value"
}, - {
- "id": "balance",
- "title": "Balance"
}, - {
- "id": "totalMargin",
- "title": "Margin"
}, - {
- "id": "held",
- "title": "Held"
}, - {
- "id": "buyingPower",
- "title": "Buying Power"
}
]
}
], - "orderCustomFields": [
- {
- "id": "commission",
- "title": "Commission",
- "tooltip": "Commission Fees",
- "alignment": "right"
}
], - "orderHistoryCustomFields": [
- {
- "id": "commission",
- "title": "Commission",
- "tooltip": "Commission Fees",
- "alignment": "right"
}
], - "positionCustomFields": [
- {
- "id": "exchangeFee",
- "title": "Exchange fee",
- "tooltip": "Exchange fee for the position",
- "alignment": "right"
}, - {
- "id": "routeFee",
- "title": "Route fee",
- "tooltip": "Route fee for the position",
- "alignment": "right"
}
], - "netPositionCustomFields": [
- {
- "id": "exchangeFee",
- "title": "Exchange fee",
- "tooltip": "Exchange fee for the position",
- "alignment": "right"
}, - {
- "id": "routeFee",
- "title": "Route fee",
- "tooltip": "Route fee for the position",
- "alignment": "right"
}
], - "individualPositionCustomFields": [
- {
- "id": "exchangeFee",
- "title": "Exchange fee",
- "tooltip": "Exchange fee for the position",
- "alignment": "right"
}, - {
- "id": "routeFee",
- "title": "Route fee",
- "tooltip": "Route fee for the position",
- "alignment": "right"
}
], - "orderDialogCustomFields": {
- "comboBox": [
- {
- "id": "customInputFieldId",
- "title": "Additional parameters",
- "saveToSettings": true,
- "mutable": false,
- "forceUserEnterInitialValue": true,
- "items": [
- {
- "text": "text",
- "value": "value"
}
]
}
], - "checkbox": [
- {
- "id": "customInputFieldId",
- "title": "Additional parameter",
- "saveToSettings": true,
- "help": "Brief help text",
- "checked": false,
- "mutable": false
}
], - "textField": [
- {
- "id": "customInputFieldId",
- "title": "Additional parameters",
- "saveToSettings": true,
- "mutable": false,
- "forceUserEnterInitialValue": true,
- "placeholder": "string",
- "maskWithAsterisk": false
}
]
},
}, - "durations": [
- {
- "id": "GTT",
- "title": "Good Till Time",
- "hasDatePicker": true,
- "hasTimePicker": true,
- "default": true,
- "supportedOrderTypes": [
- "stop",
- "stoplimit"
]
}
], - "prefix": "NASDAQ",
- "isVerified": true,
- "connectWarningConfig": {
- "key": "string",
- "skippable": false
}
}
]
}
Instruments
Get the list of the instruments that are available for trading with the specified account.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": [
- {
- "name": "EURUSD",
- "description": "EUR/USD",
- "minQty": 1,
- "maxQty": 100000000,
- "qtyStep": 100,
- "pipSize": 0.0001,
- "pipValue": 0.00008845,
- "minTick": 0.00001,
- "lotSize": 10,
- "currency": "EUR",
- "baseCurrency": "LTC",
- "quoteCurrency": "BTC",
- "marginRate": 0.05,
- "hasQuotes": false,
- "units": "string",
- "variableMinTick": "0.01 10 0.02 25 0.05",
- "type": "forex",
- "typespecs": "crypto,cfd",
- "ui": {
- "orderDialogCustomFields": {
- "comboBox": [
- {
- "id": "customInputFieldId",
- "title": "Additional parameters",
- "saveToSettings": true,
- "mutable": false,
- "forceUserEnterInitialValue": true,
- "items": [
- {
- "text": "text",
- "value": "value"
}
]
}
], - "checkbox": [
- {
- "id": "customInputFieldId",
- "title": "Additional parameter",
- "saveToSettings": true,
- "help": "Brief help text",
- "checked": false,
- "mutable": false
}
], - "textField": [
- {
- "id": "customInputFieldId",
- "title": "Additional parameters",
- "saveToSettings": true,
- "mutable": false,
- "forceUserEnterInitialValue": true,
- "placeholder": "string",
- "maskWithAsterisk": false
}
]
}, - "validationRules": [
- {
- "id": "slPercent",
- "options": {
- "min": 10,
- "max": 90
}
}, - {
- "id": "tpPercent",
- "options": {
- "min": 10,
- "max": 90
}
}, - {
- "id": "limitPercent",
- "options": {
- "min": 10,
- "max": 20
}
}, - {
- "id": "stopPercent",
- "options": {
- "min": 10,
- "max": 20
}
}, - {
- "id": "gsPercent",
- "options": {
- "min": 10,
- "max": 20
}
}
]
}
}
]
}
State
Get account information. Consider using stream/state instead, as it can decrease the workload on the servers.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": {
- "balance": 41757.91,
- "unrealizedPl": 1053.02,
- "equity": 42857.56,
- "amData": [
- [
- [
- "90.22",
- "42857.56",
- "42857.56",
- "1099.65",
- "0.00",
- "41757.91"
]
]
], - "accountSummaryRowData": [
- "96883.89",
- "96837.12",
- "-46.77"
]
}
}
Stream State
Stream account information. Unlike /stream/orders or /stream/positions the whole state object must be sent to the client every time an update occurs.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
{- "balance": 41757.91,
- "unrealizedPl": 1053.02,
- "equity": 42857.56,
- "amData": [
- [
- [
- "90.22",
- "42857.56",
- "42857.56",
- "1099.65",
- "0.00",
- "41757.91"
]
]
], - "accountSummaryRowData": [
- "96883.89",
- "96837.12",
- "-46.77"
]
}
Orders
Get current session orders for the account. It also includes working orders from previous sessions. Filled/cancelled/rejected orders should be included in the list till the end of the session. Consider using stream/orders instead, as it can decrease the workload on the servers.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": [
- {
- "id": "1",
- "instrument": "EURUSD",
- "qty": 100,
- "side": "buy",
- "type": "limit",
- "avgPrice": 0,
- "limitPrice": 1.14344,
- "duration": {
- "type": "gtt",
- "datetime": 1548406235
}, - "status": "working",
- "customFields": [
- {
- "id": "commission",
- "value": "1.25"
}
]
}, - {
- "id": "2",
- "instrument": "EURUSD",
- "qty": 100,
- "side": "sell",
- "type": "limit",
- "filledQty": 50,
- "avgPrice": 0,
- "limitPrice": 1.15094,
- "parentId": "1",
- "parentType": "order",
- "duration": {
- "type": "gtt",
- "datetime": 1548406235
}, - "status": "inactive",
- "customFields": [
- {
- "id": "commission",
- "value": ""
}
]
}, - {
- "id": "3",
- "instrument": "EURUSD",
- "qty": 1000000,
- "side": "sell",
- "type": "limit",
- "filledQty": 0,
- "avgPrice": 0,
- "limitPrice": 1.15094,
- "parentId": "1",
- "parentType": "order",
- "duration": {
- "type": "gtt",
- "datetime": 1548406235
}, - "status": "rejected",
- "message": {
- "text": "This order has been rejected due to the closed market",
- "type": "error"
}
}
]
}
Stream Orders
Stream orders of the current session for the account. It also includes working orders from the previous sessions. A snapshot of all orders should be sent as the first message in the stream. After that the server must only send updates. It's not required to send the list of all orders in every message. If there are updated fields in an order, the server must send the whole order, including unchanged fields. If there were no updates for 5 seconds, a ping message must be sent.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
[- {
- "id": "1",
- "instrument": "EURUSD",
- "qty": 101,
- "side": "buy",
- "type": "limit",
- "avgPrice": 0,
- "limitPrice": 1.2093,
- "duration": {
- "type": "gtt",
- "datetime": 1548406235
}, - "status": "working",
- "customFields": [
- {
- "id": "commission",
- "value": "1.25"
}
]
}
]
Positions
Get positions for an account. Consider using stream/positions instead, as it can decrease the workload on the servers.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": [
- {
- "id": "1",
- "instrument": "EURUSD",
- "qty": 1,
- "side": "buy",
- "avgPrice": 1.1347091,
- "unrealizedPl": 19.4739,
- "message": {
- "text": "You can add brackets to this position to protect it",
- "type": "Information"
}, - "customFields": [
- {
- "id": "string",
- "value": "string"
}
]
}
]
}
Stream Positions
Stream positions for an account. A snapshot of all positions should be sent as the first message in the stream. After that the server must only send updates. It's not required to send the list of all positions in every message. If there are updated fields in a position, the server must send the whole position, including unchanged fields. The server must send a message with position id and qty
field equal to 0
if a position is closed. If there were no updates for 5 seconds, a ping message must be sent.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
[- {
- "id": "1",
- "instrument": "EURUSD",
- "qty": 1,
- "side": "buy",
- "avgPrice": 1.1347091,
- "unrealizedPl": 19.4739,
- "message": {
- "text": "You can add brackets to this position to protect it",
- "type": "Information"
}, - "customFields": [
- {
- "id": "customField1",
- "value": "Value of custom field"
}
]
}, - {
- "id": "2",
- "qty": 0
}
]
Net Positions
Get net positions for an account.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": [
- {
- "id": "1",
- "instrument": "EURUSD",
- "qty": 1,
- "longQty": 2,
- "shortQty": 1,
- "avgPrice": 1.23,
- "customFields": [
- {
- "id": "string",
- "value": "string"
}
], - "message": {
- "text": "You can add brackets to this position to protect it",
- "type": "Information"
}
}
]
}
Stream Net Positions
Stream net positions for an account. A snapshot of all net positions should be sent as the first message in the stream. After that the server must only send updates. It's not required to send the list of all net positions in every message. If there are updated fields in a net position, the server must send the whole net position, including unchanged fields. The server must send a message with position id and qty
field equal to 0
if a position is closed. If there were no updates for 5 seconds, a ping message must be sent.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
[- {
- "id": "np1",
- "instrument": "EUR/USD",
- "qty": 90,
- "side": "buy",
- "longQty": 90,
- "shortQty": 0,
- "avgPrice": 1.1247
}, - {
- "id": "np2",
- "qty": 0
}
]
Individual Positions
Get individual positions for an account
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": [
- {
- "id": "1",
- "instrument": "EURUSD",
- "date": "1683818630353",
- "qty": 1,
- "side": "buy",
- "price": 23.274,
- "unrealizedPl": 3.094,
- "customFields": [
- {
- "id": "string",
- "value": "string"
}
], - "message": {
- "text": "You can add brackets to this position to protect it",
- "type": "Information"
}
}
]
}
Stream Individual Positions
Stream individual positions for an account. A snapshot of all individual positions should be sent as the first message in the stream. After that the server must only send updates. It's not required to send the list of all individual positions in every message. If there are updated fields in a individual position, the server must send the whole individual position, including unchanged fields. The server must send a message with position id and qty
field equal to 0
if a position is closed. If there were no updates for 5 seconds, a ping message must be sent.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
[- {
- "id": "ip1",
- "instrument": "EUR/USD",
- "qty": 50,
- "side": "buy",
- "price": 1.1347,
- "pl": 555.44
}, - {
- "id": "ip2",
- "instrument": "EUR/USD",
- "qty": 40,
- "side": "buy",
- "price": 1.12,
- "pl": 405.44
}, - {
- "id": "ip3",
- "qty": 0
}
]
Balances
Get crypto balances for an account. Balances are displayed as the first table of the Account Summary tab. Used for crypto currencies only.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": [
- {
- "symbol": "BTC",
- "longName": "Bitcoin",
- "total": 1000,
- "available": 10,
- "reserved": 90,
- "btcValue": 1000,
- "value": 100000,
- "valueCurrency": "USD"
}
]
}
Executions
Get a list of executions (i.e. fills or trades) for an account and an instrument. Executions are displayed on a chart.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
instrument required | string Broker instrument name. |
maxCount | number Maximum count of executions to return. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": [
- {
- "id": "EX34567",
- "instrument": "EURUSD",
- "price": 1.23564,
- "time": 1548406235,
- "qty": 1,
- "side": "buy",
- "orderId": "1263159154",
- "isClose": false,
- "positionId": "10098",
- "commission": 0.004
}
]
}
Orders History
Get order history for an account. It is expected that returned orders will have a final status (rejected
,
filled
, cancelled
).
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
maxCount | number Maximum count of orders to return. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": [
- {
- "id": "1",
- "instrument": "EURUSD",
- "qty": 100,
- "side": "buy",
- "type": "limit",
- "avgPrice": 0,
- "limitPrice": 1.14344,
- "duration": {
- "type": "gtt",
- "datetime": 1548406235
}, - "status": "filled"
}, - {
- "id": "2",
- "instrument": "EURUSD",
- "qty": 100,
- "side": "sell",
- "type": "limit",
- "filledQty": 50,
- "avgPrice": 0,
- "limitPrice": 1.15094,
- "parentId": "1",
- "parentType": "order",
- "duration": {
- "type": "gtt",
- "datetime": 1548406235
}, - "status": "cancelled"
}
]
}
Get Leverage
Request to this endpoint will be sent when the user opens the order ticket or changes any of the symbol, order type, side and any of the custom fields in the order ticket.
Custom Order dialog
fields defined in the /accounts are sent along with the standard fields in the order object.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Request Body schema: application/x-www-form-urlencoded
instrument required | string Broker instrument name. |
side required | string Enum: "buy" "sell" Current order side in the order ticket. |
orderType required | string Enum: "market" "stop" "limit" "stoplimit" Current order type selected in the order ticket. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": {
- "title": "Adjust Leverage",
- "leverage": 5,
- "min": 1,
- "max": 10,
- "step": 1
}
}
Set Leverage
Will be sent when the user confirms changing the leverage.
Additional "leverage" field will be added to the payload, the value of which was set by the user.
Custom Order dialog
fields defined in the /accounts are sent along with the standard fields in the order object.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Request Body schema: application/x-www-form-urlencoded
instrument required | string Broker instrument name. |
side required | string Enum: "buy" "sell" Current order side in the order ticket. |
orderType required | string Enum: "market" "stop" "limit" "stoplimit" Current order type selected in the order ticket. |
leverage required | number Leverage value set by the user |
Responses
Response samples
- 200
{- "s": "ok",
- "d": {
- "leverage": 25
}
}
Preview Leverage
Will be sent when the user is editing the leverage.
Custom Order dialog
fields defined in the /accounts are sent along with the standard fields in the order object.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Request Body schema: application/x-www-form-urlencoded
instrument required | string Broker instrument name. |
side required | string Enum: "buy" "sell" Current order side in the order ticket. |
orderType required | string Enum: "market" "stop" "limit" "stoplimit" Current order type selected in the order ticket. |
leverage required | number Leverage value set by user |
Responses
Response samples
- 200
{- "s": "ok",
- "d": {
- "infos": [
- "Borrowing limit at current leverage 0.3057 BTC or 0.00000 USDT",
- "Required position margin at current leverage 0.3057 BTC"
], - "warnings": [
- "Your leverage is comparatively high. Please be aware of risks"
], - "errors": [
- "Invalid leverage value"
]
}
}
Place Order
Place a new order. Custom Order dialog
fields defined in the /accounts are sent along with the standard fields in the order object.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
requestId | string Example: requestId=23425678343 Unique identifier for a request. |
Request Body schema: application/x-www-form-urlencoded
instrument required | string Instrument. |
qty required | number The number of units. |
side required | string Enum: "buy" "sell" Side. |
type required | string Enum: "market" "stop" "limit" "stoplimit" Type. |
currentAsk required | number Current ask price for the instrument that the user sees in the order panel. |
currentBid required | number Current bid price for the instrument that the user sees in the order panel. |
limitPrice | number Limit Price for Limit or StopLimit order. |
stopPrice | number Stop Price for Stop or StopLimit order. |
durationType | string Duration ID (if supported). |
durationDateTime | number Expiration datetime Unix timestamp (if supported by duration type). |
stopLoss | number StopLoss price (if supported). |
trailingStopPips | number Distance from the stop loss level to the current market price in pips (if supported by the broker). |
guaranteedStop | number Stop price of Guaranteed Stop bracket (if supported). |
takeProfit | number TakeProfit price (if supported). |
digitalSignature | string Digital signature (if supported). |
confirmId | string (ConfirmId) An optional order identifier, which was received in the /previewOrder response. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": {
- "orderId": "441fdB023",
- "transactionId": "1adf4578-cdf"
}
}
Modify Order
Modify an existing order. Custom Order dialog
fields defined in the /accounts are sent along with the standard fields in the order object.
Authorizations:
path Parameters
accountId required | string Account identifier. |
orderId required | string Order identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Request Body schema: application/x-www-form-urlencoded
qty required | number The number of units. |
limitPrice | number Limit Price for Limit or StopLimit order. |
stopPrice | number Stop Price for Stop or StopLimit order. |
durationType | string Duration ID (if supported). |
durationDateTime | number Expiration datetime Unix timestamp (if supported by duration type). |
stopLoss | number StopLoss price (if supported). |
trailingStopPips | number Distance from the stop loss level to the current market price in pips (if supported by the broker). |
guaranteedStop | number Stop price of Guaranteed Stop bracket (if supported). |
takeProfit | number TakeProfit price (if supported). |
digitalSignature | string Digital signature (if supported). |
currentAsk | number Current ask price for the instrument that the user sees in the order panel. |
currentBid | number Current bid price for the instrument that the user sees in the order panel. |
confirmId | string (ConfirmId) An optional order identifier, which was received in the /previewOrder response. |
Responses
Response samples
- 200
{- "s": "ok"
}
Cancel Order
Cancel an existing order.
Authorizations:
path Parameters
accountId required | string Account identifier. |
orderId required | string Order identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
{- "s": "ok"
}
Preview Order
Get estimated cost, commission and other information for an order without the order actually being placed or modified. This information is displayed in the Order Ticket Preview.
This endpoint is used if supportPlaceOrderPreview and/or supportModifyOrderPreview flag is true
.
TradingView displays the following information by itself: symbol, bid/ask, order type, side, quantity, price (except market orders), stop loss, take profit and currency.
Custom Order dialog
fields defined in the /accounts are sent along with the standard fields in the order object.
Authorizations:
path Parameters
accountId required | string Account identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Request Body schema: application/x-www-form-urlencoded
instrument required | string Instrument. |
qty required | number The number of units. |
side required | string Enum: "buy" "sell" Side. |
type required | string Enum: "market" "stop" "limit" "stoplimit" Type. |
limitPrice | number Limit Price for Limit or StopLimit order. |
stopPrice | number Stop Price for Stop or StopLimit order. |
durationType | string Duration ID (if supported). |
durationDateTime | number Expiration datetime Unix timestamp (if supported by duration type). |
stopLoss | number StopLoss price (if supported). |
trailingStopPips | number Distance from the stop loss level to the current market price in pips (if supported by the broker). |
guaranteedStop | number Stop price of Guaranteed Stop bracket (if supported). |
takeProfit | number TakeProfit price (if supported). |
digitalSignature | string Digital signature (if supported). |
currentAsk | number Current ask price for the instrument that the user sees in the order panel. |
currentBid | number Current bid price for the instrument that the user sees in the order panel. |
id | string Identifier of the order that is being modified by the user. This parameter is sent only if |
Responses
Response samples
- 200
{- "s": "ok",
- "d": {
- "confirmId": 112358,
- "sections": [
- {
- "header": "Estimated",
- "rows": [
- {
- "title": "Estimated Commission",
- "value": 0.01
}, - {
- "title": "Estimated Price",
- "value": 4091
}
]
}, - {
- "rows": [
- {
- "title": "Margin Value",
- "value": 12100
}, - {
- "title": "Time In Force",
- "value": "DAY"
}
]
}
], - "warnings": [
- "Estimated money impact is for main order only.",
- "Order can be executed outside regular trading hours.",
- [
- "Click ",
- " to read the terms and conditions"
]
], - "errors": [
- "Failed to build order confirmation."
]
}
}
Modify Position
Modify an existing position stop loss or take profit or both.
Authorizations:
path Parameters
accountId required | string Account identifier. |
positionId required | string Position identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Request Body schema: application/x-www-form-urlencoded
stopLoss | number StopLoss price. |
trailingStopPips | number Distance from the stop loss level to the order price in pips (if supported). |
guaranteedStop | number Stop price of Guaranteed Stop bracket (if supported). |
takeProfit | number TakeProfit price. |
currentAsk | number Current ask price for the instrument that the user sees in the order panel. |
currentBid | number Current bid price for the instrument that the user sees in the order panel. |
side | string Enum: "buy" "sell" New side of the position. This parameter is used to reverse the position,
if the |
Responses
Response samples
- 200
{- "s": "ok"
}
Close Position
Close an existing position.
Authorizations:
path Parameters
accountId required | string Account identifier. |
positionId required | string Position identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Request Body schema: application/x-www-form-urlencoded
amount | number Amount to close. This property is used if supportPartialClosePosition flag is |
Responses
Request samples
- Payload
amount=5
Response samples
- 200
{- "s": "ok"
}
Close Net Position
Close an existing net position and all of the individual positions on the symbol.
Authorizations:
path Parameters
accountId required | string Account identifier. |
netPositionId required | string Net position identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Responses
Response samples
- 200
{- "s": "ok"
}
Modify Individual Position
Modify an existing individual position stop loss or take profit or both.
Authorizations:
path Parameters
accountId required | string Account identifier. |
individualPositionId required | string Individual position identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Request Body schema: application/x-www-form-urlencoded
stopLoss | number StopLoss price. |
trailingStopPips | number Distance from the stop loss level to the order price in pips (if supported). |
guaranteedStop | number Stop price of Guaranteed Stop bracket (if supported). |
takeProfit | number TakeProfit price. |
currentAsk | number Current ask price for the instrument that the user sees in the order panel. |
currentBid | number Current bid price for the instrument that the user sees in the order panel. |
Responses
Response samples
- 200
{- "s": "ok"
}
Close Individual Position
Close an individual position.
Authorizations:
path Parameters
accountId required | string Account identifier. |
individualPositionId required | string Individual position identifier. |
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
Request Body schema: application/x-www-form-urlencoded
amount | number Amount to close. This property is used if supportPartialCloseIndividualPosition flag is |
Responses
Request samples
- Payload
amount=5
Response samples
- 200
{- "s": "ok"
}
Latency Tracking
Endpoint is used to collect performance and statistical data for a particular request.
Applies to the following endpoints:
Place order: /placeOrder
Modify order: /modifyOrder
Cancel order: /cancelOrder
Modify position: /modifyPosition
Close position: /closePosition
To enable latency tracking functionality the supportTrackLatency
flag should be set to true in the account config. Please see the /accounts endpoint.
Authorizations:
path Parameters
accountId required | string Account identifier. |
Request Body schema: application/x-www-form-urlencoded
transactionId required | string Request identifier for which the performance data is being sent. |
transactionType required | string Enum: "place_order" "modify_order" "cancel_order" "modify_position" "close_position" "modify_individual_position" "close_individual_position" "close_net_position" Type of the transaction |
instrument required | string Instrument. |
side required | string Enum: "buy" "sell" Side. |
ask required | number Current ask price for the instrument that the user sees in the order panel. |
bid required | number Current bid price for the instrument that the user sees in the order panel. |
timestamp required | number Timestamp of the price quote user has seen on the UI. In milliseconds. |
roundTripDuration required | number Request duration in milliseconds. |
qty | number Placed or modified orders quantity. Not applied to Cancel order / modify position / close position requests. |
roundTripStartTime | number Timestamp in UTC when the request round trip started. In milliseconds. |
Responses
Response samples
- 200
{- "s": "ok"
}
Quotes
Get current prices of the instrument.
The bid
and ask
fields are required, and the buyPipValue
and sellPipValue
fields
are desirable if the account currency is different from the currency of the instrument.
The same values should be sent for these fields if different values for buying and selling are not supported.
Authorizations:
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
accountId required | string Account identifier. |
symbols required | string Comma separated symbol list. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": [
- {
- "s": "ok",
- "n": "EURUSD",
- "v": {
- "ask": 1.13836,
- "bid": 1.13834,
- "buyPipValue": 1,
- "sellPipValue": 1,
- "hardToBorrow": false,
- "notShortable": false,
- "halted": false
}
}
]
}
Stream Quotes
Stream current prices of the instrument.
The bid
and ask
fields are required, and the buyPipValue
and sellPipValue
fields
are desirable if the account currency is different from the currency of the instrument.
The same values should be sent for these fields if different values for buying and selling are not supported.
Authorizations:
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
accountId required | string Account identifier. |
symbols required | string Comma separated symbol list. |
Responses
Response samples
- 200
[ ]
Depth
Get current depth of market for the instrument. Optional.
Authorizations:
query Parameters
locale required | string (Locale) Enum: "ar_AE" "br" "cs" "de_DE" "el" "en" "es" "fa_IR" "fr" "he_IL" "hu_HU" "id" "in" "it" "ja" "kr" "ms_MY" "nl_NL" "pl" "ro" "ru" "sv_SE" "th_TH" "tr" "uk" "vi_VN" "zh_CN" "zh_TW" Locale (language) id. |
accountId required | string Account identifier. |
symbol required | string Instrument name. |
Responses
Response samples
- 200
{- "s": "ok",
- "d": {
- "asks": [
- [
- 45.1,
- 100
], - [
- 48.4,
- 120
]
], - "bids": [
- [
- 24.7,
- 80
], - [
- 35.6,
- 30
]
]
}
}
Groups
Get a list of possible groups of symbols. A group is a set of symbols that share a common access level. Any user can have access to any number of such groups. In case your data integration does not require separating symbols into several groups, implementing this endpoint is still mandatory. You will be able to add a single group and place all symbols there.
IMPORTANT: Please plan your symbol grouping carefully. Groups cannot be deleted, you can only remove all the symbols from there.
LIMITATIONS: Each integration is limited to have up to 10 symbol groups. Each symbol group is limited to have up to 10K symbols in it. You cannot put the same symbol into 2 different groups.
This endpoint allows you to specify a list of groups, and the /permissions endpoint specifies which groups are available for the certain user.
When TradingView user logs into his broker account - he will gain access to one or more groups, depending on the /permissions endpoint.
At the /symbol_info endpoint TradingView adds the GET argument group
with the name of the group. Thus, TradingView will receive information about which group each symbol belongs to.
Authorizations:
Responses
Response samples
- 200
{- "s": "ok",
- "d": {
- "groups": [
- {
- "id": "broker_stocks"
}, - {
- "id": "broker_futures"
}, - {
- "id": "broker_forex"
}, - {
- "id": "broker_crypto"
}
]
}
}
Permissions
Get a list of symbol groups allowed for the user. It is only required if you use groups of symbols to restrict access to instrument's data.
Authorizations:
Responses
Response samples
- 200
{- "s": "ok",
- "d": {
- "groups": [
- "broker_futures",
- "broker_stocks",
- "broker_forex"
]
}
}
Groups
Get a list of possible groups of symbols. A group is a set of symbols that share a common access level. Any user can have access to any number of such groups. In case your data integration does not require separating symbols into several groups, implementing this endpoint is still mandatory. You will be able to add a single group and place all symbols there.
IMPORTANT: Please plan your symbol grouping carefully. Groups cannot be deleted, you can only remove all the symbols from there.
LIMITATIONS: Each integration is limited to have up to 10 symbol groups. Each symbol group is limited to have up to 10K symbols in it. You cannot put the same symbol into 2 different groups.
This endpoint allows you to specify a list of groups, and the /permissions endpoint specifies which groups are available for the certain user.
When TradingView user logs into his broker account - he will gain access to one or more groups, depending on the /permissions endpoint.
At the /symbol_info endpoint TradingView adds the GET argument group
with the name of the group. Thus, TradingView will receive information about which group each symbol belongs to.
Authorizations:
Responses
Response samples
- 200
{- "s": "ok",
- "d": {
- "groups": [
- {
- "id": "broker_stocks"
}, - {
- "id": "broker_futures"
}, - {
- "id": "broker_forex"
}, - {
- "id": "broker_crypto"
}
]
}
}
Symbol Info
Get a list of all instruments.
Authorizations:
query Parameters
group | string ID of a symbol group. If it presents then only symbols that belong to this group should be returned. Possible values are provided by the /groups endpoint. It is only required if you use groups of symbols to restrict access to instrument's data. |
Responses
Response samples
- 200
{- "s": "ok",
- "symbol": [
- "VIXG2019",
- "AAPLE",
- "EURUSD",
- "BTCUSD"
], - "description": [
- "Volatility Index",
- "Apple Inc",
- "EUR/USD",
- "Bitcoin / US Dollar"
], - "currency": [
- "USD",
- "USD",
- "USD",
- "USD"
], - "base-currency": [
- null,
- null,
- "EUR",
- "BTC"
], - "exchange-listed": [
- "CBOE",
- "NASDAQ",
- "FOREX",
- "CRYPTO"
], - "exchange-traded": [
- "CBOE",
- "NASDAQ",
- "FOREX",
- "CRYPTO"
], - "minmovement": [
- 1,
- 1,
- 1,
- 1
], - "minmovement2": [
- 0,
- 0,
- 0,
- 0
], - "fractional": [
- false,
- false,
- false,
- false
], - "pricescale": [
- 100,
- 100,
- 100000,
- 100
], - "root": [
- "VIX",
- null,
- null,
- null
], - "root-description": [
- "Volatility Index",
- null,
- null,
- null
], - "has-intraday": [
- true,
- true,
- true,
- true
], - "has-no-volume": [
- false,
- false,
- true,
- false
], - "type": [
- "futures",
- "stock",
- "forex",
- "spot"
], - "typespecs": [
- "cfd",
- "cfd",
- null,
- "crypto,cfd"
], - "volume-type": [
- "base",
- "quote",
- "tick",
- null
], - "is-cfd": [
- true,
- true,
- false,
- true
], - "ticker": [
- "VIXG2019",
- "AAPLE",
- "EURUSD",
- "BTCUSD"
], - "timezone": [
- "America/New_York",
- "America/New_York",
- "America/New_York",
- "Etc/UTC"
], - "session-regular": [
- "0000-2359:23456",
- "0930-1600",
- "1700-1700",
- "24x7"
], - "session-extended": [
- "0000-2359:23456",
- "0400-2000",
- "1700-1700",
- "24x7"
], - "session-premarket": [
- null,
- "0400-0930",
- null,
- null
], - "session-postmarket": [
- null,
- "1600-2000",
- null,
- null
], - "has-daily": [
- true,
- true,
- true,
- false
], - "has-weekly-and-monthly": [
- false,
- false,
- false,
- false
], - "pointvalue": [
- 10,
- 1,
- 0.00001,
- 1
], - "expiration": [
- 20190213,
- null,
- null,
- null
], - "bar-source": [
- "trade",
- "bid",
- "ask",
- "trade"
], - "bar-transform": [
- "openprev",
- "openprev",
- "none",
- "none"
], - "bar-fillgaps": [
- "true",
- "true",
- "false",
- "false"
], - "isin": [
- "ZAE000190252",
- "ZAE0001201977",
- "ZAE000567432",
- null
], - "wkn": [
- "A12ABB",
- "A66RTT",
- "A13DDE",
- null
]
}
History
Request for history bars. Each property of the response object is treated as a table column.
Data should meet the following requirements:
- real-time data obtained from the API streaming endpoint must match the historical data, obtained from the /history API. The allowed count of mismatched bars (candles) must not exceed 5% for frequently traded symbols, otherwise the integration to TradingView is not possible;
- the data must not include unreasonable price gaps, historical data gaps on 1-minute and Daily-resolutions (temporal gaps), obviously incorrect prices (adhesions).
Bar time for daily bars should be 00:00 UTC and is expected to be a trading day (not a day when the session starts).
Bar time for monthly bars should be 00:00 UTC and is the first trading day of the month.
If there is no data in the requested time period, you should return an empty response:
{"s":"ok","t":[],"o":[],"h":[],"l":[],"c":[],"v":[]}
Authorizations:
query Parameters
symbol required | string Symbol name or ticker. |
resolution required | string Symbol resolution. Possible resolutions are daily ( |
from required | number Unix timestamp (UTC) of the leftmost required bar, including |
to required | number Unix timestamp (UTC) of the rightmost required bar, including |
countback | number Deprecated Number of bars (higher priority than |
Responses
Response samples
- 200
{- "s": "ok",
- "t": [
- 1547942400,
- 1547942460,
- 1547942520
], - "o": [
- 3667,
- 3662.25,
- 3664.29
], - "h": [
- 3667.24,
- 3664.47,
- 3664.3
], - "l": [
- 3661.55,
- 3661.9,
- 3662.43
], - "c": [
- 3662.25,
- 3663.13,
- 3664.01
], - "v": [
- 34.7336,
- 2.4413,
- 11.7075
]
}
Stream of prices
Stream of prices. Server constantly keeps the connection alive. If the
connection is broken - the server constantly tries to restore it.
TradingView establishes up to 4 simultaneous connections to this endpoint and
expects to get the same data to all of them.
Transfer mode is chunked encoding
. The data feed should set 'Transfer-Encoding: chunked'
and make sure that all intermediate proxies are set to use this
mode. All messages are to be ended with \n
. Data stream should contain
real-time data only. It shouldn't contain snapshots of data.
Data feed should provide trades and quotes:
- If trades are not provided, then data feed should set trades with bid price and bid size (mid price with 0 size in case of Forex).
- Size is always greater than
0
, except for the correction. In that case size can be0
. - Quote must contain prices of the best ask and the best bid.
- Daily bars are required if they cannot be built from trades (has-daily should be set to true in the symbol information in that case).
The broker must remove unnecessary restrictions (firewall, rate limits, etc.) for the set of IP addresses of our servers.
StreamingHeartbeatResponse
is a technical message that prevents the feed from unsubscribing from streaming.
It doesn't affect the price data and should be sent to /streaming every 5 seconds by default. The message
can be used, for example, when the trading session is closed on weekends or in case of low liquidity
on the exchange when TradingView does not receive price updates for a long time.
Please note, that StreamingAskResponse
and StreamingBidResponse
are deprecated.
The StreamingQuoteResponse
should be used to provide ask / bid data.
Authorizations:
Responses
Response samples
- 200
{- "f": "q",
- "id": "EURUSD",
- "t": 1547942400,
- "ap": 1.47245,
- "as": 100,
- "bp": 1.47245,
- "bs": 100
}