Open Interests
Retrieves historical open interests for derivatives markets.
Supported Exchanges:
Binance
OKX
Bitget
HTX
BingX
Gate
Bybit
Supported timeframes:
"5m", "15m", "1h", "4h", "1d" -> Will return one entry per interval of given timeframe
Historical OHLC Open Interests across major CEXes
GET
https://api.coinact.gg/v1/open-interest-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 default: ALL (every exchanges)
convertToUsd
Boolean
Get open interests in USD value
default : True
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
[
{
"interval_start": "2024-01-18T13:00:00+00:00",
"open": 10258786031.43,
"high": 10262649927.14,
"low": 10237594129.89,
"close": 10237594129.89
},
{
"interval_start": "2024-01-18T12:45:00+00:00",
"open": 10222660612.47,
"high": 10234471427.61,
"low": 10221179202.03,
"close": 10233934886.83
},
...
]
Last Open Interest data related to a given cryptocurrency
GET
https://api.coinact.gg/v1/open-interest
Query Parameters
symbol*
String
Get open interests for a specific cryptocurrency eg: BTC
exchange
String
Get open interests for a specific exchange (see endpoint /exchanges) default: ALL (every exchanges)
pair
String
Get open interests for a specific pair (base/quote:settle)
eg: BTC/USDT:USDT
```json
{
"MATIC": [
{
"symbol": "MATIC",
"pair": "ALL",
"exchangeLabel": "ALL",
"exchangeId": -1,
"openInterestUsd": 209243030.27,
"openInterestAmount": 265154503.54,
"ts": "2024-01-19T09:36:56.346648"
},
{
"symbol": "MATIC",
"pair": "MATIC/USDT:USDT",
"exchangeLabel": "BINANCE FUTURES",
"exchangeId": 1,
"openInterestUsd": 88002943.8384,
"openInterestAmount": 111509052.0,
"ts": "2024-01-19T09:36:26.985441"
},
{
"symbol": "MATIC",
"pair": "MATIC/USDT:USDT",
"exchangeLabel": "BYBIT",
"exchangeId": 16,
"openInterestUsd": 54452098.012,
"openInterestAmount": 69005320.0,
"ts": "2024-01-19T09:36:22.275026"
},
{
"symbol": "MATIC",
"pair": "MATIC/USDT:USDT",
"exchangeLabel": "BINGX FUTURES",
"exchangeId": 65536,
"openInterestUsd": 24925740.45,
"openInterestAmount": 31599569.53600406,
"ts": "2024-01-19T09:36:11.336421"
},
{
"symbol": "MATIC",
"pair": "MATIC/USDT:USDT",
"exchangeLabel": "BITGET FUTURES",
"exchangeId": 4,
"openInterestUsd": 21052779.698400002,
"openInterestAmount": 26676102.0,
"ts": "2024-01-19T09:36:37.936117"
},
{
"symbol": "MATIC",
"pair": "MATIC/USDT:USDT",
"exchangeLabel": "OKX FUTURES",
"exchangeId": 4096,
"openInterestUsd": 18899038.665,
"openInterestAmount": 23944050.0,
"ts": "2024-01-19T09:36:04.926434"
},
{
"symbol": "MATIC",
"pair": "MATIC/USDT:USDT",
"exchangeLabel": "GATE FUTURES",
"exchangeId": 128,
"openInterestUsd": 1910429.613,
"openInterestAmount": 2420410.0,
"ts": "2024-01-19T09:36:40.624895"
}
]
}
```
Usage Example:
Query BTC open interests 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 = "open-interest-history"
HEADERS = {"x-api-key": "YOUR API KEY"}
def get_open_interests(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_open_interests(start, end):
open_interests = []
page = 1
with requests.Session() as session:
while True:
results = get_open_interests(session, start, end, page)
if not results:
break
open_interests.extend(results)
page += 1
return open_interests
if __name__ == "__main__":
start_timestamp = '1704123127'
end_timestamp = '1705937416'
all_open_interests = fetch_all_open_interests(start_timestamp, end_timestamp)
print(all_open_interests)
print(len(all_open_interests))
Last updated