Information for Bitcoin Exchanges.

So, you’d like TradingView to show your Bitcoin data - great! Meet a few requirements, send us the details, and we’ll add it. To make it easier, we decided to use the same format as Bitcoincharts.

Submitting

Contact our support team with the API details and we'll add your data.

Data Requirements

The data must:

  • Have complete trade history (example URL - https://exchange.bitcoin/api/trades)
  • Have the full orderbook (example URL - https://exchange.bitcoin/api/orderbook)
  • Both URLs must respond to HEAD and GET requests.
  • Сonform to the format below.
  • Be available using HTTP(S).
  • Must be JSON encoded.
  • Responses may be GZip'ed if the Accept-Encoding: gzip header is received.
  • The orderbook URL may return an ETag header. In this case, a HEAD request will be sent to fetch the ETag and a GET will only be issued if it has changed. This reduces bandwidth demands considerably.

For multiple currencies it’s best to send data through separate URLs, i.e.:
/api/USD/trades
/api/EUR/trades

Error handling

Unparsable JSON responses and the following HTTP error codes will disable the crawler: 401, 403, 404, 410. If the crawler is disabled, it will require manual intervention to restart. Don’t let that happen, otherwise data may be down for a while.

Trade History Details

Trade history must be a JSON array containing successive trades. Each trade must be represented by a JSON object with at least these properties:

  • date - the unixtimestamp of the trade
  • tid - a positive unique integer for referencing the trade
  • price - the price in currency
  • amount - the amount of bitcoins traded

Each new ‘tid’ must be greater than the previous one. Gaps are allowed, but you cannot fill them in the future. If there are no trades to report, the response must be an empty array: []

Incremental updates

The URL must accept a parameter named ‘since’. ‘since’ will be set to the last ‘tid’ received, or 0 for bootstrapping. Your server must return trades newer than that ‘tid’. It may return older trades, but they will be ignored. This is mainly to help reduce bandwidth, as you'll often be returning empty arrays this way.

Timing

The crawler will hit this URL every 2 seconds. When an error (timeout, HTTP 5xx, ...) occurs, it'll eventually slow down to 60 seconds.

Example

GET https://exchange.bitcoin/api/trades?since=5

Response:

[
	{
		"tid" : 6,
		"price" : 3190.00,
		"amount" : 0.24843000,
		"date" : 1399210160
	},
	{
		"price" : 3195.00,
		"tid" : 7,
		"amount" : 0.08800000,
		"date" : 1399210708
	},
	{
		"price" : 3050.01,
		"tid" : 9,
		"amount" : 0.80000000,
		"date" : 1399213161
	},
	{
		"price" : 3195.00,
		"tid" : 10,
		"date" : 1399214944,
		"amount" : "0.05000000"
	},
	{
		"date" : 1399214983,
		"amount" : 0.00800000,
		"tid" : 17,
		"price" : "3195.00"
	}
]

Orderbook Data Details

The orderbook URL must return the full orderbook. It's a JSON object containing two properties: bids and asks. Both properties consist of an array of arrays where the first element is the price and the second element is the amount.

Timing

The orderbook will be queried every 2 seconds (120 seconds with ETag). It must respond to a HEAD request. The HEAD response may contain an ETag, which may be any string. If two successive HEAD requests yield the same ETag, no GET request to fetch the actual orderbook will be issued. This provides both low latency and low bandwidth consumption.

Example

{
	"bids" : [
		[ 3050.02, 0.06215041 ],
		[ 3050.01, 0.06215061 ],
		[ 3050.00, 0.07577000 ],
		[ 3010.47, 0.03280710 ],
		[ 3010.46, 1.50000000 ]
	],
	"asks" : [
		[ 3195.00, 0.10400000 ],
		[ 3199.99, 0.25000000 ],
		[ 3200.00, 0.01879926 ],
		[ 3210.00, 0.25000000 ],
		[ 3279.98, 0.26560800 ]
	]
}
United States
United Kingdom
India
Deutschland
España
France
Việt Nam
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
简体
繁體
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Support Priority Support Report Issue Ideas Published Followers Following Private Messages Chat Sign Out