TradingView 的 REST API 為經紀商量身定制

這個API規範允許經紀商建立一個橋樑並把他們的後端系統連接到作為前端的TradingView。使用此API規範建構的橋樑可用於2種產品 — TradingView Web平台 & 交易終端。查看訊息頁面了解更多資訊,如有任何問題請email至founders@tradingview.com

技術訊息

Swagger

此規範已使用優秀的Swagger技術生成。Swagger會為你做大部分的工作。下載TradingView Swagger 規範,複製粘貼到在線Swagger編輯器並使用26個框架中的1個生成伺服器。

支援數據和訂單 vs 僅訂單

當TradingView已經有客戶需要的數據(即某些股票、外匯)時,您可以執行 “僅訂單” 選項。這樣你就避免了提供你自己的數據和大約一半的工作。對於交易終端方案,您將始終需要提供數據和訂單支援,因為它是您託管的獨立產品。

交易面板橋接

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)

通常而言,經紀商在商品代碼中有外匯或者CFD的情況下,需要將數據連接到TradingView上。在這種情況下,您需要實施三個額外的末端:“/symbol_info”, “/history” 和“/streaming”。

TradingView將會從它的服務器發送數據請求。一般而言,至少使用4個服務器。歷史記錄緩存在TradingView服務器上,並從我們的服務器提供到客戶的瀏覽器上。到“/streaming”的連接是被持續執行的,在連接斷開的情況下會重連。經紀商必須移除IP地址設置的不必要的限制(防火牆、速率限制等等)。

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參數的數值。

ZH 繁體中文
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
AR العربية
HE עברית
首頁 股票篩選器 外匯篩選器 加密貨幣篩選器 全球財經日曆 如何運作 圖表功能 網站規則 版主 網站 & 經紀商解決方案 小工具 圖表庫 功能請求 部落格 & 新聞 常見問題 幫助 & 維基 推特
概述 個人檔案設定 帳戶和帳單 我的支援工單 聯絡客服 發表的想法 粉絲 正在關注 私人訊息 在線聊天 登出