Crypto API Tutorials:
Huobi.com is the world-leading Bitcoin and Ethereum trading platform, providing secure and convenient trading services for hundreds of digital assets. We can use the Huobi API to import crypto data from Huobi into Google Sheets. In this tutorial, we’ll show you how to connect the Huobi REST API to Google Sheets in 4 steps:
Apipheny is a free API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to API data sources, easily.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser:
An endpoint is an API URL that returns the specific data you want from Huobi. In this section we’ll show you how to browse the Huobi API documentation to find the URL that returns the specific data you need. If you’d like to see specific examples of URLs you can use, just skip to the next section.
To browse endpoint URLs and query requirements, go the Huobi API documentation page here: https://docs.huobigroup.com/docs/spot/v1/en/#introduction
The top menu contains the APIs for Huobi: Spot, Coin-M Futures, Coin-M Swaps, and USDT-M. Just click on the API you want to use. In this tutorial, we will describe the Spot API.
All Huobi Spot API URLs are created by appending an endpoint-specific path to the root URL:
In this tutorial, we will discuss two types of endpoints available from the Huobi Spot API:
This tutorial covers how to use the public endpoints that do not require authentication. An example category from the Huobi Spot API documentation that has public endpoints which require no API key is Market Data: https://docs.huobigroup.com/docs/spot/v1/en/#market-data
Signed Huobi Spot API endpoints that require HMAC SHA256 will not currently work with Apipheny, but endpoints that do not require HMAC SHA256 will work. Some Huobi Spot API endpoints require HMAC SHA256 and others don’t. The reason signed endpoints don’t currently work with our app is because they require an additional parameter called signature, a keyed HMAC SHA256 signature with your secretKey as the key, and a concatenation of all the query’s parameters as the value passed to the HMAC operation. Signed endpoints also require a timeStamp parameter, populated with the request’s millisecond timestamp. You can tell if an endpoint is signed or not because when you look at the documentation for that endpoint, you will see a message that says All endpoints in this section require authentication next to the category name, as seen in the screenshot below:
Once you’ve looked through the Huobi Spot API documentation and chosen a public endpoint you want to use, you can go ahead and enter the URL into Apipheny and run your request. In the next section, we’ll cover making a request in more detail, along with some example requests.
Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the Import tab. With the Import tab open, enter these details into the add-on:
API URL: In Step 2, we explained how you can find the Huobi REST API endpoint that you need. Now copy and paste your complete Huobi API URL into the Apipheny add-on, where it says API URL Path, followed by any parameters required for your query (if applicable).
For this example, we are using the Get Market Depth endpoint, which retrieves the current order book of a specific pair. This is what the whole URL looks like:
Here’s what our request looks like in Apipheny:
The Get Klines(Candles) endpoint which retrieves all klines in a specific range. The URL for this endpoint is:
The Get the Last Trade endpoint which retrieves the latest trade with its price, volume, and direction. The URL for this endpoint is:
Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the Huobi API data to be imported into your Google Sheet. Here’s what our request looked like when completed:
After making a successful request to the Huobi API, try querying a different Huobi API endpoint, or try using one of the more advanced features in the Apipheny add-on.
Crypto API Tutorials:
Crypto API Tutorials: