Introduction
The TradeRealtime AI API provides developers with access to real-time and historical market data for stocks, cryptocurrencies, forex, and commodities. Powered by SMB AI servers, our API enables you to build sophisticated trading algorithms, monitor portfolios, and execute trades programmatically. All endpoints follow REST principles and return JSON responses.
Base URL: https://api.traderealtime.ai/v1
Supported markets include NYSE, NASDAQ, Binance, and more, with comprehensive data on total volume, profitable trades, loss trades, and profit metrics.
Authentication
The API uses OAuth 2.0 for secure access. To authenticate, obtain an API key and access token by registering at traderealtime.ai.
Obtaining an Access Token
POST /auth/token HTTP/1.1
Host: api.traderealtime.ai
Content-Type: application/json
{
"api_key": "your_api_key",
"api_secret": "your_api_secret"
}
Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_in": 3600
}
Include the token in the Authorization header for all requests:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
API Endpoints
Market Data
- GET /markets/stocks/quotes: Retrieve real-time stock quotes.
- GET /markets/crypto/quotes: Fetch real-time cryptocurrency prices.
- GET /markets/forex/quotes: Get real-time forex pair rates.
- GET /markets/historical: Access historical data for any market.
Trading
- POST /trades/place: Place a market or limit order.
- GET /trades/status: Check the status of an order.
- POST /trades/cancel: Cancel an existing order.
Portfolio
- GET /portfolio/balances: Retrieve account balances.
- GET /portfolio/performance: Get total profit, volume, and trade metrics.
Example: Get Stock Quotes
GET /markets/stocks/quotes?symbols=AAPL,TSLA HTTP/1.1
Host: api.traderealtime.ai
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Response:
{
"quotes": [
{
"symbol": "AAPL",
"price": 145.32,
"volume": 75000000,
"timestamp": "2025-05-15T15:00:00Z"
},
{
"symbol": "TSLA",
"price": 650.45,
"volume": 32000000,
"timestamp": "2025-05-15T15:00:00Z"
}
]
}
Rate Limits
To ensure fair usage, the API enforces the following rate limits:
- Free Tier: 100 requests per minute, 10,000 per day.
- Pro Tier: 500 requests per minute, 50,000 per day.
- Enterprise Tier: Custom limits, contact support@traderealtime.ai.
Exceeding limits returns a 429 Too Many Requests error.
Code Examples
Python: Fetch Crypto Quotes
import requests
url = "https://api.traderealtime.ai/v1/markets/crypto/quotes?symbols=BTC-USD,ETH-USD"
headers = {"Authorization": "Bearer your_access_token"}
response = requests.get(url, headers=headers)
print(response.json())
Node.js: Place a Trade
const axios = require('axios');
axios.post('https://api.traderealtime.ai/v1/trades/place', {
symbol: 'BTC-USD',
side: 'buy',
quantity: 0.1,
type: 'market'
}, {
headers: { 'Authorization': 'Bearer your_access_token' }
}).then(response => console.log(response.data));
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters. |
| 401 | Unauthorized - Invalid or missing token. |
| 429 | Too Many Requests - Rate limit exceeded. |
| 500 | Internal Server Error - Contact support. |