Please note that this documentation is currently a work in progress and may contain errors, missing information, or inaccuracies. We are continuously working to improve and update the content, but we recommend double-checking any critical information learned from this documentation against official sources or consulting with experts in the field.
We appreciate your patience and understanding as we strive to provide you with the most comprehensive and accurate documentation possible.
Welcome to the TradingAPI.rest documentation. Here you'll find comprehensive information on how to integrate TradingAPI into your services and leverage our powerful features to enhance your trading experience.
The Exchange Symbols API endpoint allows you to retrieve the list of supported trading symbols for a given exchange. By integrating this endpoint into your application, you can dynamically fetch the available symbols, enabling your users to select and trade with the desired trading pairs.
To retrieve the exchange symbols, make a GET request to the following endpoint:
GET https://tradingapi.rest/v1/info/symbols/{exchange}
Replace {exchange}
with the name of the exchange you want to retrieve symbols for.
The response will contain an array of symbols supported by the specified exchange.
Example Python code:
import requests
url = "https://tradingapi.rest/v1/info/symbols/bybit"
headers = {
"X-API-KEY": "YOUR-API-KEY",
"User-Agent": "YOUR-USER-AGENT"
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)
Replace YOUR-API-KEY
with your actual API key.
Replace (optional) YOUR-USER-AGENT
with your actual User Agent (to track your own requests).
Please note that all sensitive data, such as API keys or authentication tokens, are protected and will not be logged or stored by the TradingAPI.rest service.
The API Info endpoint provides general information about the TradingAPI.rest service, including the list of supported exchanges, intervals, and indicators.
To retrieve the API info, make a GET request to the following endpoint:
GET https://tradingapi.rest/v1/info
The response will contain a JSON object with the following properties:
exchanges
: An array of supported exchanges.intervals
: An array of supported time intervals.indicators
: An object containing supported technical indicators grouped by category.Example Python code:
import requests
url = "https://tradingapi.rest/v1/info"
headers = {
"X-API-KEY": "YOUR-API-KEY",
"User-Agent": "YOUR-USER-AGENT"
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)
Replace YOUR-API-KEY
with your actual API key.
Replace (optional) YOUR-USER-AGENT
with your actual User Agent (to track your own requests).
The API Info endpoint allows you to dynamically retrieve the supported exchanges, intervals, and indicators, enabling you to build flexible and adaptable trading applications.
Please note that your API key is securely transmitted and will not be logged or stored by the TradingAPI.rest service.
The Technical Analysis API endpoints provide powerful tools for analyzing financial data and generating valuable insights. By integrating these endpoints into your application, you can offer advanced technical analysis capabilities to your users, enabling them to make informed trading decisions.
To retrieve technical analysis data for a specific indicator, make a POST request to the following endpoint:
POST https://tradingapi.rest/v1/indicator/{indicator}
Replace {indicator}
with the desired technical indicator (e.g., "rsi", "macd", "bbands", ...).
The request body should contain an array of price data points, including the open, high, low, close, volume, and timestamp for each data point.
Example Python code:
import requests
url = "https://tradingapi.rest/v1/indicator/rsi"
params = {
"timestamp": 1,
"timeperiod": 14,
"backtrack": 50,
"backtracks": 50,
"reverse": 0
}
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"User-Agent": "YOUR-USER-AGENT"
}
data = [
{
"open": "34557.67",
"high": "34612.33",
"low": "34535.68",
"close": "34606.34",
"volume": "39.206917",
"timestamp": "1698939120000"
},
{
"open": "34658.34",
"high": "34658.34",
"low": "34548.35",
"close": "34557.67",
"volume": "48.949532",
"timestamp": "1698939060000"
}
]
response = requests.post(url, params=params, headers=headers, json=data)
result = response.json()
print(result)
The response will contain the calculated technical indicator values based on the provided price data.
Rest assured that your sensitive data, such as API keys or authentication tokens, will be handled securely and will not be logged or stored by the TradingAPI.rest service.
The Bulk Indicators endpoint also supports retrieving technical analysis data for multiple indicators using a single POST request, allowing you to provide more detailed parameters and data.
To retrieve bulk indicators data using POST, make a request to the following endpoint:
POST https://tradingapi.rest/v1/indicators
You should send a JSON payload in the request body with the following structure:
{
"indicators": [
{
"rsi": {
"timeperiod": 14,
"timestamp": 1,
"reverse": 0
}
},
"macd",
"2crows",
"{indicator}"
],
"data": {
"exchange": "bybit",
"limit": 50,
"interval": "1m",
"base": "BTC",
"quote": "USDT",
"reverse": 1,
"timestamp": 0,
"backtracks": 50,
"backtrack": 50
}
}
The indicators
array specifies the indicators you want to retrieve, and the data
object provides the common parameters for the indicators.
Example Python code:
import requests
url = "https://tradingapi.rest/v1/indicators"
params = {
"timestamp": 1
}
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"X-API-KEY": "YOUR-API-KEY",
"User-Agent": "YOUR-USER-AGENT"
}
data = {
"indicators": [
{
"rsi": {
"timeperiod": 14,
"timestamp": 1,
"reverse": 0
}
},
"macd",
"2crows",
"{indicator}"
],
"data": {
"exchange": "bybit",
"limit": 50,
"interval": "1m",
"base": "BTC",
"quote": "USDT",
"reverse": 1,
"timestamp": 0,
"backtracks": 50,
"backtrack": 50
}
}
response = requests.post(url, params=params, headers=headers, json=data)
result = response.json()
print(result)
Replace YOUR-API-KEY
with your actual API key.
Replace (optional) YOUR-USER-AGENT
with your actual User Agent (to track your own requests).
Replace {indicator}
with the Technical Analysis Indicator you want to use.
The response will contain the calculated technical indicator values based on the provided parameters and data.
Rest assured that your API requests and data are handled securely, and no sensitive information is logged or stored by the TradingAPI.rest service.
The Technical Analysis - Single Indicator endpoint allows you to retrieve indicator data for a specific trading pair and exchange.
To retrieve indicator data, make a GET request to the following endpoint:
GET https://tradingapi.rest/v1/indicator/{indicator}
Replace {indicator}
with the desired technical indicator (e.g., "rsi", "macd", "bbands", ...).
Include the following query parameters in your request:
exchange
: The exchange to retrieve data from (e.g., "bybit").limit
: The maximum number of data points to retrieve.interval
: The time interval for the data (e.g., "1h").base
: The base currency of the trading pair (e.g., "BTC").quote
: The quote currency of the trading pair (e.g., "USDT").backtrack
: The number of periods to go back in time.backtracks
: The number of periods to calculate the indicator.timestamp
: Set to 1 to include timestamps in the response.reverse
: Set to 1 to reverse the order of the returned data.Example Python code:
import requests
url = "https://tradingapi.rest/v1/indicator/{indicator}"
params = {
"exchange": "bybit",
"limit": 50,
"interval": "1h",
"base": "BTC",
"quote": "USDT",
"backtrack": 50,
"backtracks": 50,
"timestamp": 1,
"reverse": 0
}
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)
Replace YOUR-API-KEY
with your actual API key.
Replace (optional) YOUR-USER-AGENT
with your actual User Agent (to track your own requests).
Replace {indicator}
with the Technical Analysis Indicator you want to use.
The response will contain the RSI indicator values based on the provided parameters.
By integrating the RSI indicator data into your trading application, you can provide your users with valuable insights and help them make informed trading decisions.
Please note that your API key is securely transmitted and will not be logged or stored by the TradingAPI.rest service.
The Tickers endpoint allows you to retrieve real-time ticker data for a specific trading pair on a given exchange.
To retrieve ticker data, make a GET request to the following endpoint:
GET https://tradingapi.rest/v1/ticker/{exchange}
Replace {exchange}
with the name of the exchange you want to retrieve ticker data from (e.g., "gate").
Include the following query parameters in your request:
base
: The base currency of the trading pair (e.g., "BTC").quote
: The quote currency of the trading pair (e.g., "USDT").Example Python code:
import requests
url = "https://tradingapi.rest/v1/ticker/gate"
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)
Replace YOUR-API-KEY
with your actual API key.
Replace (optional) YOUR-USER-AGENT
with your actual User Agent (to track your own requests).
The response will contain the latest ticker data for the specified trading pair on the given exchange.
By integrating the Tickers endpoint into your trading application, you can provide your users with up-to-date price information and enable them to make timely trading decisions.
Please note that the TradingAPI.rest service does not log or store any sensitive data from your API requests.