Я пытаюсь использовать библиотеку Python ccxt для получения общедоступных данных (например, доступных рынков) с криптобиржи OneTrading.
Я создал ключ API с разрешениями на чтение.
Каким-то образом ccxt получает пустой словарь. Почему это?
Это мой пример кода:
from pprint import pprint
import ccxt
api_key = ""
creds = {
'apiKey': api_key,
'verbose': True, # for debug output
}
exchange = ccxt.onetrading(creds)
pprint(exchange.requiredCredentials) # prints required credentials
exchange.check_required_credentials() # raises AuthenticationError
pprint(exchange.load_markets())
Выход:
{'accountId': False,
'apiKey': True,
'login': False,
'password': False,
'privateKey': False,
'secret': False,
'token': False,
'twofa': False,
'uid': False,
'walletAddress': False}
fetch Request: onetrading GET https://api.onetrading.com/public/v1/currencies RequestHeaders: {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'} RequestBody: None
fetch Response: onetrading GET https://api.onetrading.com/public/v1/currencies 200 ResponseHeaders: {'Date': 'Sat, 11 May 2024 07:34:44 GMT', 'Content-Type': 'application/json', 'Content-Length': '2', 'Connection': 'keep-alive', 'apigw-requestid': 'XmHfOicWDoEEPOg=', 'strict-transport-security': 'max-age=31536000; includeSubDomains', 'x-frame-options': 'sameorigin', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'referrer-policy': 'no-referrer', 'Cache-Control': 'no-store', 'pragma': 'no-cache', 'bp-request-id': '6e914827-43be-4fb8-9b52-cd9d93caadaa', 'CF-Cache-Status': 'DYNAMIC', 'Server': 'cloudflare', 'CF-RAY': '88207cfe9cb49722-AMS'} ResponseBody: []
fetch Request: onetrading GET https://api.onetrading.com/public/v1/instruments RequestHeaders: {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'} RequestBody: None
fetch Response: onetrading GET https://api.onetrading.com/public/v1/instruments 200 ResponseHeaders: {'Date': 'Sat, 11 May 2024 07:34:44 GMT', 'Content-Type': 'application/json', 'Content-Length': '2', 'Connection': 'keep-alive', 'apigw-requestid': 'XmHfQjFgjoEEPFA=', 'strict-transport-security': 'max-age=31536000; includeSubDomains', 'x-frame-options': 'sameorigin', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'referrer-policy': 'no-referrer', 'Cache-Control': 'no-store', 'pragma': 'no-cache', 'bp-request-id': '7aee16cb-fc32-47bc-b8c5-60f2d8fa54e1', 'CF-Cache-Status': 'DYNAMIC', 'Server': 'cloudflare', 'CF-RAY': '88207d002e889722-AMS'} ResponseBody: []
{}
Подробнее здесь: https://stackoverflow.com/questions/784 ... onetrading