TradingView 的 REST API 為經紀商量身定制
支援數據和訂單 vs 僅訂單
當TradingView已經有客戶需要的數據(即某些股票、外匯)時，您可以執行 “僅訂單” 選項。這樣你就避免了提供你自己的數據和大約一半的工作。對於交易終端方案，您將始終需要提供數據和訂單支援，因為它是您託管的獨立產品。
Trading Panel Bridge
1. Types of Requests
All requests can be divided into two groups — client and server.
Client requests are executed from the browser, server requests are initiated from the TradingView servers. There will be no server requests if the integration does not imply the addition of brokerage data to the TradingView website.
2. Client Requests
TradingView website sends out requests to the broker’s server from the browser to get a list of orders and positions, information about the balance, etc. The requests are sent out periodically and the intervals can be set using “/config”. 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, then the user will see a notification and the changes made will display in the Account Manager on the website.
Requests for placing / modifying orders, cancellation of positions, etc. occur only after the user's actions.
Also, from the browser there is a request called “/quotes” which displays the current bid / ask from the broker and the request called “/depth” which retrieves the data from DOM Level 2.
3. Server requests (in the case of data integration)
Typically, a broker needs to connect its data to TradingView, if there are Forex or CFD among the symbols. In this case, you need to implement three additional endpoints: “/symbol_info”, “/history” and “/streaming”.
TradingView will send requests for data from its servers. Usually, at least 4 servers are used. The history is cached on TradingView servers and given to the client browser from our servers. The connection to “/streaming” is carried out continuously and resumes in case of a disconnection. The broker must remove unnecessary restrictions (firewall, rate limits, etc.) for the set of IP addresses of our servers.
4. Restricting access to data (in the case of data integration)
By default, broker symbols are visible to all TradingView users without any restrictions - you can view the ideas on them and they are available in the search for symbols. If there is a need to restrict access to them, then you need to further divide the entire set of symbols into groups. A group is a set of symbols that share a common access level. Any user can have access to any number of such groups. To do this, you need to implement “/groups” and “/permissions” requests. The “/groups” query allows you to specify a list of groups, and “/permissions” specifies which groups are available for a specific user. The same symbol cannot be in 2 different groups. At the request “/symbol_info” TradingView will add the GET argument “group“ with the name of the group, the list of which is provided by the request “/groups”. Thus, TradingView will receive information about which group each symbol belongs to. Each TradingView user logging into his broker account will gain access to one or more groups, depending on “/permissions”. It is important to note that groups cannot be deleted, you can only remove all the symbols from there, so grouping should be carefully planned. The number of groups for a specific integration is limited to 10. Maximum amount of symbols in a group is 10K.
您可以向我們的demo server發送請求並會看到回應，以此做為範例。單擊 'Try' 按鈕，填寫必要欄位，然後單擊 'Execute'。您應該能夠看到我們的伺服器對您的請求的回應。
請使用 'test' 作為登錄名稱和密碼，以發送授權請求。請在請求中使用 '0' 作為accountId參數的數值。