Funding Rates
Retrieves historical open interests for derivatives markets.
Supported Exchanges:
Binance
OKX
Bitget
HTX
BingX
Gate
Bybit
Supported timeframes:
"1h", "4h", "1d" -> Will return one entry per interval of given timeframe
Historical OHLC Funding Rates across major CEXes
GET
https://api.coinact.gg/v1/funding-rate-history
Query Parameters
symbol*
String
Get open interests for a specific cryptocurrency eg: BTC
timeframe
String
The resolution at which you want to receive the open interests. valid timeframes : ["5m", "15m", "1h", "4h", "1d"]
default: 5m
exchange
String
Get open interests for a specific exchange (see endpoint /exchanges) default: ALL (every exchanges)
start
UNIX Timestamp (s)
Get open interests on a given period
end
UNIX Timestamp (s)
Get open interests on a given period
page
Integer
id of the page you want to query (default=1)
limit
Integer
Number of liquidations to return (default:200 ; max: 200)
pair
String
Get open interests for a specific pair (base/quote:settle)
eg: BTC/USDT:USDT
Headers
x-api-key
String
Your API Key
```json
[
{
"interval_start": "2024-01-22T16:15:00+00:00",
"open": 0.001523169237291274,
"high": 0.001523169237291274,
"low": 0.001523169237291274,
"close": 0.001523169237291274
},
{
"interval_start": "2024-01-22T16:10:00+00:00",
"open": 0.001523169237291274,
"high": 0.001523169237291274,
"low": 0.001523169237291274,
"close": 0.001523169237291274
}
]
Last Funding Rate data related to a given cryptocurrency
GET
https://api.coinact.gg/v1/funding-rate
Query Parameters
symbol*
String
Get open interests for a specific cryptocurrency eg: BTC
exchangeLabel
String
Get open interests for a specific exchange (see endpoint /exchanges) default: ALL (every exchanges)
pair
String
Get open interests for a specific pair. eg : BTC/USDT
```json
{
"LDO": [
{
"symbol": "LDO",
"pair": "LDO/USDT:USDT",
"exchangeLabel": "OKX FUTURES",
"exchangeId": 4096,
"fundingRateHourly": 0.0022825,
"fundingRate": 0.01826,
"ts": "2024-01-22T15:16:41"
},
{
"symbol": "LDO",
"pair": "LDO/USDT:USDT",
"exchangeLabel": "BINGX FUTURES",
"exchangeId": 65536,
"fundingRateHourly": 0.0022125,
"fundingRate": 0.0177,
"ts": "2024-01-22T15:17:09"
},
{
"symbol": "LDO",
"pair": "LDO/USDT:USDT",
"exchangeLabel": "BITGET FUTURES",
"exchangeId": 4,
"fundingRateHourly": 0.001325,
"fundingRate": 0.0106,
"ts": "2024-01-22T15:17:02"
},
{
"symbol": "LDO",
"pair": "LDO/USDT:USDT",
"exchangeLabel": "BINANCE FUTURES",
"exchangeId": 1,
"fundingRateHourly": 0.00125,
"fundingRate": 0.01,
"ts": "2024-01-22T15:16:43"
},
{
"symbol": "LDO",
"pair": "LDO/USDT:USDT",
"exchangeLabel": "Bybit",
"exchangeId": 16,
"fundingRateHourly": 0.00125,
"fundingRate": 0.01,
"ts": "2024-01-22T15:16:49"
},
{
"symbol": "LDO",
"pair": "LDO/USDT:USDT",
"exchangeLabel": "GATE FUTURES",
"exchangeId": 128,
"fundingRateHourly": 0.00125,
"fundingRate": 0.01,
"ts": "2024-01-22T15:17:17"
},
{
"symbol": "LDO",
"pair": "ALL",
"exchangeLabel": "ALL",
"exchangeId": -1,
"fundingRateHourly": 0.0002468185049433896,
"fundingRate": 0.001974548039547117,
"ts": "2024-01-22T15:18:05.991427"
}
]
}
```
Usage Example:
Query BTC funding rates OHLC that happened on a given period no matter the exchange / pair
import json
from urllib.parse import urljoin
import requests
COINACT_API_URL = "https://api.coinact.gg/v1/"
ENDPOINT = "funding-rate-history"
HEADERS = {"x-api-key": "YOUR API KEY"}
def get_funding_rates(session, start, end, page):
params = {
'symbol': 'BTC',
'timeframe': '15m',
'start': start,
'end': end,
'page': page
}
response = session.get(urljoin(COINACT_API_URL, ENDPOINT), headers=HEADERS, params=params)
return json.loads(response.content)
def fetch_all_funding_rates(start, end):
funding_rates = []
page = 1
with requests.Session() as session:
while True:
results = get_funding_rates(session, start, end, page)
if not results:
break
funding_rates.extend(results)
page += 1
return funding_rates
if __name__ == "__main__":
start_timestamp = '1704123127'
end_timestamp = '1705937416'
all_funding_rates = fetch_all_funding_rates(start_timestamp, end_timestamp)
print(all_funding_rates)
print(len(all_funding_rates))
Last updated