GDAX – orderbook gegevens API level1, Two, Three, datafireball
journey of a gegevens stud
GDAX is a cryptocurrency trading toneelpodium and it is a subsidy wielded by Coinbase. They suggest a excellent toneelpodium along with a suite of API services for effortless access to the trading gegevens – rear mirror historical view or real-time gegevens.
I have used API before but GDAX suggests to use websocket instead of API for real-time gegevens access.
API – LEVEL1
“Only the best bid and ask”
Spil you can see, on the trading verhoging, the best selling price (ask to sell) is 10077.92 USD/BTC and at the same time, the best buying price (bid to buy) is 10077.91 USD/BTC. There are 53 different orders bidding at the best bid price and the total bids size is 35.26 BTCs. Same for the asks.
API – LEVEL2
“Top 50 bids and asks (aggregated)”
At level2, instead of the top 1 (best) bid and ask orders, the API will come back the top 50 bids and the top 50 asks. The gegevens is te the same format [price, ordersize, numberOfOrders]. Given this information, you will have enough information to plot the depth chart (investopedia explanation).
However, the price range is so petite (10112.14 – 10076.77) / 10076.77
0.3% only a petite petite price range, which is not sufficient enough to draw a meaning depth chart.
API – LEVEL3
“Full order book (non aggregated)”
This is a BIG request, however, the information is quiebro rich and it a accomplish snapshot of the orderbook. Hence, the response format is slightly different where they do not have order size anymore because record is at order level without any aggregation, instead, they provided the order ID.
Spil shown ter a snippet of the response, they even listed the bids out there at the price of 0.01 USD/BTC. Those bids are very likely the ones either added to the orderbook years ago or those were the disbelievers. On the other size of the spectrum, you can lightly see people even ask to sell BTC at the price of 9,999,999,999 USD/BTC, good luck to them ??
This is a plot of the histogram of how orders are distributed on different prices. Spil you can see, there are a few peak values out there. The largest peak is certainly on the lowest point, maybe under a dollar. Then they have a few big peaks around $800, $5000, $8000 and $10000.
This is interesting but not necessary the depth chart that you usually see.
For example, this is the market depth from GDAX. And clearly, the X axis is still exchange rate of BTC and USD but the y axis is the number of Bitcoins at that price. I am not exactly sure of the resolution te this graph but let’s take a quick look and see if wij can reproduce this graph te Matplotlib.
The code might not be the most efficient but it does but you want it to do.
If you are on GDAX webstek, you can realize that your laptop’s fan might be spinning a bit swifter, behind the toneel of numbers hopping up and down, you can the browser actually subscribed to the GDAX websocket to stream NRT trading information from their server to update the information on your webstek. And this actually the precies websocket that the developer manual suggest users to use to receive information feed.
Of course, te this case, you will need to take the responsibility of parsing the information calculate the latest state and overeenkomst with everything yourself.
So far, you should have a rough understanding of what zuigeling information are provided various levels of orderbook API from GDAX. Wij also shortly touched the GDAX websocket. Ter the next article, I am going to have a deep dive into the websocket gegevens types and message format, hopefully, wij can voorkant Mongodb ter more detail regarding how to query the transaction information and build up analytics.