Crypto API tutorials and more:
Bitmex is a cryptocurrency exchange. We can use the Bitmex API to pull data from Bitmex into Google Sheets. In this tutorial, you will learn how to connect the Bitmex REST API to Google Sheets in 5 steps:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
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:
After logging into your Bitmex account, click the API tab and then click the API Key Management option from the menu on the left:
The API Keys page will then be displayed. Complete the Name field, choose Key Permissions from the drop-down list, and then click the Create API Key button:
The API key (ID and Secret) will be displayed on the screen:
Copy and paste your ID and the Secret to safe place because you’ll need them in the next steps.
If you already know your API URL and endpoint, or you want to use the same example URL and endpoint as us, just skip to Step 4.
First, open the Bitmex API documentation page: https://www.bitmex.com/api/explorer/
On this page you’ll find a short description, the base URL, the return types, and all the API endpoints, organized into sections:
All API calls to Bitmex should be made to this base URL:
All endpoints should be appended to this base URL.
An example API section in the Bitmex API documentation is Announcement, which includes two endpoints: /announcement and /announcement/urgent:
The /announcement endpoint uses the following API URL:
Each endpoint’s documentation contains a description of the endpoint’s purpose, the response class, the content type, the available API URL parameters, and the possible response messages:
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 3, we explained how you can find the Bitmex REST API endpoint that you need. Now copy and paste your complete Bitmex 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 /user endpoint, which retrieves your user’s details. This is what the whole URL looks like:
If you’re following the same example as us, you can copy and paste this URL into the “API URL” field in the add-on.
Headers: In the Headers section of Apipheny, add 4 rows with the following keys and values:
Header 1 Key: Api-signature Value: your_api_signature_value Header 2 Key: Api-key Value: your_api_key_value Header 3 Key: Accept Value: application/json Header 4 Key: api-expires Value: your_api_expires_value
The api-signature is a signature of the request you are making. It is calculated as hex(HMAC_SHA256(apiSecret, verb + path + expires + data)), where:
To calculate the expires value, we use the https://www.unixtimestamp.com/index.php website. You input the date you want to convert and then click the Convert button. Copy the value in milliseconds to a safe place.
To calculate the signature, we used this site: https://www.freeformatter.com/hmac-generator.html#ad-output.
In the Copy-paste the string here field, we will type the verb, path and expires values, concatenated without any spaces.
In the Secret Key field, we will input the api-secret we previously obtained in Step 2.
Click the COMPUTE HMAC button to display the result. This is the value for your_api_signature_value. Copy the result in a safe place, because you’ll need it shortly.
your_api_key_value is the value of the api key you previously obtained in Step 2.
your_api_expires_value is the value of the expires variable (in milliseconds) that you obtained earlier in this step.
Now that we have all the necessary details, we could write them into the Apipheny add-on like so:
Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the Bitmex 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 Bitmex API, try querying a different Bitmex API endpoint, or try using one of the more advanced features in the Apipheny add-on.
Make a GET request
Make a POST request
PUT, PATCH, & DELETE Requests
Save requests for later
Schedule requests for automatic updates
Reference cell values in requests
=APIPHENY custom function
Stack multiple URLs in a single request
Run all saved requests at once
Modify your request settings
Import & export saved API settings
Crypto API tutorials and more:
Alpha Vantage API
Constant Contact API
Facebook Graph API
Facebook Ads API
Google SERP API
Linkedin Ads API
Product Hunt API
Reddit Ads API
Riot Games API