Open Interest / Funding Rate -> get infos

Hi guys ! Hope you are all weel !

I would like to retrieve the following information:

Open Interest:

Share of volumes in short positions in USD
Share of volumes in long positions in USD

Funding Rate:

Funding rate on short positions for each asset
Funding rate on long positions for each asset

Do you know how to obtain these via the Binance API? I have already obtain the open interest and the funding rate,

Thx !

To get the total open interest, use the endpoint GET /futures/data/openInterestHist

for share of volumes in short and long positions, you can use GET /futures/data/topLongShortAccountRatio and GET /futures/data/topLongShortPositionRatio

funding rates for short and long positions for each asset using GET /dapi/v1/fundingInfo

For a detailed exploration of Binance Futures API, refer to (Binance API Documentation)

I have got some additional informtion, so sharing with you and it may help:

----script fetches data and outputs results to a Google Sheet—
A repository by seanhung07 provides a Python script for analyzing open interest data and funding rates from Binance futures markets GitHub - seanhung07/Binance-Open-Interest-Analyzer

----can help you fetch and process funding rates data—
QuantConnect/Lean.DataSource.BinanceFundingRate repository could be beneficial for integrating Binance futures funding rates into your trading algorithms GitHub - QuantConnect/Lean.DataSource.BinanceFundingRate: Binance futures funding rate

----a simplified Python example that demonstrates how you might start fetching this data using the Binance API-----

from binance.client import Client
from binance.enums import *

client = Client(api_key=‘your_api_key’, api_secret=‘your_api_secret’)

Fetch open interest

open_interest = client.futures_coin_open_interest(symbol=‘BTCUSD_200925’, contractType=‘CURRENT_QUARTER’)

Fetch funding rates

funding_rates = client.futures_funding_rate(symbol=‘BTCUSDT’, limit=5)

print(“Open Interest:”, open_interest)
print(“Recent Funding Rates:”, funding_rates)

—let me know if it helps—

1 Like