pip install python_crypto_dot_com_sdk
import json
from crypto_dot_com.client import CryptoAPI
client = CryptoAPI(
api_key=API_KEY,
api_secret=SECRET_KEY,
log_json_response_to_file=True,
)
kline_data = client.get_candlesticks("MTD_USD", count=100, timeframe='1M')
with open("x.json", "w") as f:
json.dump([obj.model_dump() for obj in kline_data], f, indent=4, default=str)