i want to create an API. where do Crypto Currency exchanges get their data from, Like the exchange rate, difficulty of coins, blocks and rewards.

I want to create a website which displays all the data related to the coins and i dont want to use any existing API.

Can Anyone suggest how to create an API.


1 Answer 1


Let's start with the exchange rate. Any exchange, be it for stocks, real currencies or decentralized peer-to-peer virtual crypto currencies, naturally generates an exchange rate simply from its normal operation. After all, it allows customers to trade, and the price at which trades were last executed is then called the exchange rate on that exchange. So they don't get that data from anywhere, they generate it (not arbitrarily, of course, but according to how their customers place orders and how trades result from matching orders).

All the other quantities you mentioned (which, if I may, I'd like to explain and correct to difficulty of mining blocks, total number of already mined blocks, reward for mining a new block) are specific to each crypto currency. You have to extract them from a client for the specific crypto currency, and the typical approach is to run such a client and use its (local) API.

Your question is how to write your own API. I suppose that means you want to run a website that offers a public API for querying the kind of data you mentioned. A natural approach would be to simply translate the calls for the data inherent to each currency (difficulty, blocks, rewards in your list) to a client you run for that currency. You may want to cache the results for some brief time if you anticipate high usage of your public API.

The exchange rates on different exchanges are more tricky, because the only authoritative source for an exchange's exchange rate is the exchange itself. You will have to find their API and use that. Also, here it would be a bad idea to just forward queries made to your public API. Instead, you should record the exchange rates and answer queries to your public API from this stored data.

There is a chance that many exchanges can still be accessed using only one kind of API convention. Have a look at what API the site bitcoincharts.com requires exchanges to provide. Presumably at least all the exchanges listed there provide it, and probably accept queries from anybody, not just from bitcoincharts.com.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.