Comprehensive Documentation for Crypto Market Data Access
This guide provides detailed instructions for integrating with cryptocurrency market data APIs, including trading pairs, real-time quotes, candlestick charts, and recent trades. All endpoints return JSON-formatted data for easy parsing and integration into your applications.
1. Trading Pairs List Retrieval
Endpoint: https://api.stocktv.top/crypto/getCoinMarket
Method: GET
Parameters:
key(required): Your unique API access keystart(optional): Pagination starting index (default: 1)limit(optional): Number of records per request (max: 100)
Example Request:
curl "https://api.stocktv.top/crypto/getCoinMarket?key=YOUR_API_KEY&start=1&limit=50"2. Real-Time Market Quotes
Endpoint: https://api.stocktv.top/crypto/tickerPrice
Method: GET
Parameters:
key(required): API authentication keysymbols(required): Comma-separated trading pairs (e.g., "BTCUSDT,ETHUSDT")
Response Example:
{
"code": 200,
"message": "Success",
"data": [
{
"symbol": "BTCUSDT",
"lastPrice": "66912.01000000",
"priceChangePercent": "4.304"
},
{
"symbol": "ETHUSDT",
"lastPrice": "3251.58000000",
"priceChangePercent": "2.470"
}
]
}๐ Explore real-time crypto prices
3. Latest Price Endpoint
Endpoint: https://api.stocktv.top/crypto/lastPrice
Method: GET
Parameters:
key(required): Valid API keysymbols(required): Trading pairs to monitor
curl "https://api.stocktv.top/crypto/lastPrice?key=YOUR_API_KEY&symbols=BTCUSDT,ETHUSDT"4. Candlestick Chart Data
Endpoint: https://api.stocktv.top/crypto/kline
Method: GET
Parameters:
key(required): API access credentialsymbol(required): Specific trading pairinterval(required): Timeframe ("1", "5", "15", "30", "60", "1d")
curl "https://api.stocktv.top/crypto/kline?key=YOUR_API_KEY&symbol=BTCUSDT&interval=1"5. Recent Trade History
Endpoint: https://api.stocktv.top/crypto/getTrades
Method: GET
Parameters:
key(required): Valid API keysymbol(required): Trading pair identifier
Response Structure:
{
"code": 200,
"message": "Success",
"data": [
{
"id": 3702674679,
"price": "67033.05000000",
"qty": "0.00100000",
"time": 1721981582129
}
]
}๐ Advanced trading API documentation
Implementation Best Practices
- Authentication: Always secure your API keys and never expose them in client-side code
- Rate Limiting: Implement proper request throttling to avoid hitting API limits
- Error Handling: Build robust error handling for network issues and API errors
- Data Caching: Consider caching frequently accessed data to reduce API calls
- WebSocket Alternative: For real-time data, evaluate WebSocket connections
Frequently Asked Questions
Q: How often should I poll the API for price updates?
A: For most applications, polling every 15-30 seconds provides adequate freshness without hitting rate limits.
Q: What's the maximum number of trading pairs I can request at once?
A: The system allows up to 100 trading pairs per request for most endpoints.
Q: How do I handle API key rotation?
A: Implement a key management system that can seamlessly switch between active keys during updates.
Q: Are there regional restrictions for API access?
A: Currently the API is globally accessible, but check our terms of service for updates.
Q: What happens if I exceed my rate limit?
A: You'll receive a 429 status code and should implement exponential backoff in your retry logic.
Q: Can I access historical data beyond recent trades?
A: Historical data endpoints are available in our premium API tiers.
Final Recommendations
For developers building trading platforms or market analysis tools, proper API integration is crucial. Always test your implementation thoroughly in a staging environment before going live. Consider using the ๐ OKX developer portal as an additional resource for market data and trading functionality.
Remember to:
- Secure your API credentials
- Monitor your usage metrics