To use the TradingAPI REST API to obtain data for a specific ticker, follow these steps:
- Endpoint: Use the Tickers endpoint: https://tradingapi.rest/v1/ticker/{exchange}
- Replace {exchange} with the name of the exchange you want to get data from (e.g., "gate").
- Required Parameters:
- base: The base currency of the trading pair (e.g., "BTC")
- quote: The quote currency of the trading pair (e.g., "USDT")
- Required Headers:
- X-API-KEY: Your API key
- User-Agent: (optional) Your custom User Agent
import requests url = "https://tradingapi.rest/v1/ticker/gate" # Example using Gate.io exchange params = { "base": "BTC", "quote": "USDT" } headers = { "X-API-KEY": "YOUR-API-KEY", "User-Agent": "YOUR-USER-AGENT" } response = requests.get(url, params=params, headers=headers) data = response.json() print(data)
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article