Hatchfi API Market Data Endpoints
Please note that this initial version of our market data endpoint does not pull historical data. Historical data will be implemented in a later version. Thank you for your patience!
Hatchfi market data endpoint overview
Hatchfi's Market Exchange Rate endpoint allows developers to query a single cryptocurrency's current and historical price, name, ticker, and logo. We also support global fiat currencies to USD conversions. Please note that you need to be authenticated
with our API to access these endpoints.
Retrieve current market exchange rates for crypto assets
This method retrieves the current market exchange rates for crypto assets in USD. For the ticker, please use CAPS
.
curl --request GET \
--url https://api.hatchfi.co/v1/market/exchange/TICKER \
--header 'X-Hatchfi-Api: API_KEY_FROM_DASHBOARD' \
--header 'X-Hatchfi-Secret: SECRET_KEY_FROM_DASHBOARD'
var axios = require("axios").default;
var options = {
method: 'GET',
url: 'https://api.hatchfi.co/v1/market/exchange/TICKER',
headers: {
"X-Hatchfi-Api": '<API-KEY>',
"X-Hatchfi-Secret": "<SECRET-KEY>"
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
import requests;
url = 'https://api.hatchfi.co/v1/market/exchange/TICKER'
payload = ""
headers = {
"X-Hatchfi-Api": '<API-KEY>',
"X-Hatchfi-Secret": "<SECRET-KEY>"
}
response = requests.request("GET", url, data=payload, headers=headers)
print(response.text);
import axios from "axios";
var options = {
method: 'GET',
url: 'https://api.hatchfi.co/v1/market/exchange/TICKER',
headers: {
"X-Hatchfi-Api": '<API-KEY>',
"X-Hatchfi-Secret": "<SECRET-KEY>"
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Current market exchange rate example for ticker ETH
{
"name": "Ethereum",
"ticker": "ETH",
"price": "1739.49631033",
"timestamp": "2022-09-10T20:19:00Z",
"logo": "https://s3.us-east-2.amazonaws.com/static/images/currencies/eth.svg"
}
Retrieve historical market exchange rates for crypto assets
This method retrieves historical market exchange rates for crypto assets up to 2 years in USD. For the ticker, please use CAPS.
curl --request GET \
--url https://api.hatchfi.co/v1/market/exchange/TICKER/history \
--header 'X-Hatchfi-Api: API_KEY_FROM_DASHBOARD' \
--header 'X-Hatchfi-Secret: SECRET_KEY_FROM_DASHBOARD'
var axios = require("axios").default;
var options = {
method: 'GET',
url: 'https://api.hatchfi.co/v1/market/exchange/TICKER/history',
headers: {
"X-Hatchfi-Api": '<API-KEY>',
"X-Hatchfi-Secret": "<SECRET-KEY>"
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
import requests;
url = 'https://api.hatchfi.co/v1/market/exchange/TICKER/history'
payload = ""
headers = {
"X-Hatchfi-Api": '<API-KEY>',
"X-Hatchfi-Secret": "<SECRET-KEY>"
}
response = requests.request("GET", url, data=payload, headers=headers)
print(response.text);
import axios from "axios";
var options = {
method: 'GET',
url: 'https://api.hatchfi.co/v1/market/exchange/TICKER/history',
headers: {
"X-Hatchfi-Api": '<API-KEY>',
"X-Hatchfi-Secret": "<SECRET-KEY>"
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Here is an example of the historical data for ETH
[
{
"open": "130.74137456",
"high": "130.74137456",
"low": "126.43704849",
"close": "127.40549335",
"timestamp": "2020-01-02T00:00:00Z"
},
{
"open": "127.35531790",
"high": "134.99151944",
"low": "127.11307189",
"close": "134.15057889",
"timestamp": "2020-01-03T00:00:00Z"
},
{
"open": "134.10373576",
"high": "135.54384749",
"low": "132.66032409",
"close": "134.06772141",
"timestamp": "2020-01-04T00:00:00Z"
}
]
Retrieve current fiat exchange rates for fiat-to-fiat conversions
Hatchfi's market exchange rate endpoint allows developers to query our API and return over 160 global fiat currencies with current USD conversion rates. For the ticker, please use CAPS
.
curl --request GET \
--url https://api.hatchfi.co/v1/market/fiat/exchange \
--header 'X-Hatchfi-Api: API_KEY_FROM_DASHBOARD' \
--header 'X-Hatchfi-Secret: SECRET_KEY_FROM_DASHBOARD'
var axios = require("axios").default;
const options = {
method: 'GET',
url: 'https://api.hatchfi.co/v1/market/fiat/exchange',
headers: {
"X-Hatchfi-Api": '<API-KEY>',
"X-Hatchfi-Secret": "<SECRET-KEY>"
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
import requests;
url = 'https://api.hatchfi.co/v1/market/fiat/exchange'
payload = ""
headers = {
"X-Hatchfi-Api": '<API-KEY>',
"X-Hatchfi-Secret": "<SECRET-KEY>"
}
response = requests.request("GET", url, data=payload, headers=headers)
print(response.text);
import axios from "axios";
const options = {
method: 'GET',
url: 'https://api.hatchfi.co/v1/market/fiat/exchange',
headers: {
"X-Hatchfi-Api": '<API-KEY>',
"X-Hatchfi-Secret": "<SECRET-KEY>"
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Fiat Exchange Rates returns an Array
of objects that contain data about the fiat symbol and rate. Here's an example response:
[
{
"currency": "AED",
"rate": "0.27224960",
"timestamp": "2022-09-11T00:00:00Z"
},
{
"currency": "AFN",
"rate": "0.011426566",
"timestamp": "2022-09-11T00:00:00Z"
},
...
]
How our market data provider calculates the data
Please note that the following is directly from our market data provider.
Crypto market cap is calculated the same way as stock market cap, multiplying an asset's circulating supply by its price in fiat currency (e.g., USD, EUR, JPY). The calculation gets trickier when an asset is traded against another asset. In a crypto pair โ let's say Ethereum/Bitcoin or ETH/BTC
โ to get the price of ETH, we would first denominate BTC in fiat.
To understand market cap, it's important to consider its constituent parts โ price and circulating supply. The price depends on who makes the calculation. The general price is calculated as a composite of spot prices used on crypto exchanges. The calculation is adjusted to include variations in trading pair prices for index funds, which have recently become popular. The price you see on online news aggregators (Google, for example) is usually the average price at which an asset trades on leading exchanges.
In the crypto space, the problem of inadequate pricing is well-known. Most pricing index issuers fail to detail how they price instruments or where they get their data. We strive to set this right. Our provider's methodology takes the price at which an instrument last traded on each exchange, weighted by the general trading volume over the past 24 hours.
Regarding supply, it is worth noting that the calculation depends entirely on the token and the mechanics of its protocol. Although Bitcoin has a finite supply (21 million), most tokens are designed with a dynamic supply that increases over time. When calculating the market cap of a particular crypto asset, it is the circulating supply that should be taken into account. Circulating supply is the number of tokens that are currently available on the market. Circulating supply is a better metric than total supply because it excludes reserved or locked coins.
Updated 3 months ago