単なる備忘録なので詳細は省きます。
python openInterest/sample.py
import requests
api_key = 'my api'
symbols = 'BTCUSDT_PERP.A,BTCUSD_PERP.0'
url = 'actual endpoint'
params = {
'symbols': symbols,
'api_key': api_key
}
response = requests.get(url, params=params)
if response.status_code == 200:
data = response.json()
print("Open Interest Data:", data)
else:
print(f"Failed to retrieve data. Status code: {response.status_code}, Message: {response.text}")
結果
Open Interest Data: [{'symbol': 'BTCUSD_PERP.0', 'value': 236370700, 'update': 1707826545124}, {'symbol': 'BTCUSDT_PERP.A', 'value': 92707.774, 'update': 1707826547840}]