Binance Futures Data
import ccxt
print('CCXT Version:', ccxt.__version__)
from pprint import pprint
exchange = ccxt.binance({
'enableRateLimit': True,
'options': {
'defaultType': 'future',
},
})
markets = exchange.load_markets()
# exchange.verbose = True # uncomment for debugging
symbol = 'BTC/USDT'
market = exchange.market(symbol)
# Current Funding Rate
response = exchange.fapiPublic_get_fundingrate({
'symbol': market['id'],
# 'startTime': exchange.parse8601('2020-11-25T00:00:00Z'), # ms to get funding rate from INCLUSIVE.
# 'endTime': exchange.parse8601('2020-11-26T00:00:00Z'), # ms to get funding rate until INCLUSIVE.
# 'limit': 100, # default 100, max 1000
})
pprint(response)
# Current Long / Short Account Ratio of TOP traders (last 500 hours)
# Only have acccess to the last 30 days :(
response = exchange.fapiDataGetTopLongShortAccountRatio({
'symbol':market['id'],
'period':'1h',
'limit':500
})
pprint(response)
# Current Long / Short Position Ratio of TOP traders (last 500 hours)
# Only have acccess to the last 30 days :(
response = exchange.fapiDataGetTopLongShortPositionRatio({
'symbol':market['id'],
'period':'1h',
'limit':500
})
pprint(response)
# Current Long / Short Account Ratio of ALL traders (last 500 hours)
# Only have acccess to the last 30 days :(
response = exchange.fapiDataGetGlobalLongShortAccountRatio({
'symbol':market['id'],
'period':'1h',
'limit':500
})
pprint(response)
# Historical Open Interest (last 500 hours)
response = exchange.fapiDataGetOpenInterestHist({
'symbol':market['id'],
'period':'1h',
'limit': 500
})
pprint(response)