OKCoin API Overview
OKCoin provides a robust suite of developer tools to integrate trading functionalities seamlessly into applications. Users can create API keys with varying permissions to automate trading, withdrawals, and market data retrieval.
Key features accessible via API:
- Fetch real-time market prices
- Retrieve order book depth
- Check available/frozen balances
- Monitor open orders
- Execute buy/sell orders
- Batch order cancellations
- Fast withdrawals to verified addresses
API Integration Methods
Choose the optimal approach based on your technical requirements:
1. REST API
Ideal for spot trading and withdrawals, REST offers:
- URL-based resource access
- Standard HTTP methods (GET/POST)
- Clear request-response structure
👉 Best practices for REST API integration
2. WebSocket API
Recommended for real-time market data due to:
- Persistent bidirectional connections
- Low-latency push updates
- Efficient bandwidth usage
Market Data Endpoints (REST API)
Ticker Endpoint
GET /api/v1/ticker.do
Supported Symbols:
| Parameter | Currency Pair |
|---|---|
| btc_usd | Bitcoin/USD |
| eth_usd | Ethereum/USD |
| ltc_usd | Litecoin/USD |
| etc_usd | Ethereum Classic/USD |
| bch_usd | Bitcoin Cash/USD |
Example Request:
GET https://www.okcoin.com/api/v1/ticker.do?symbol=eth_usdSample Response:
{
"date": "1657824000",
"ticker": {
"buy": "1780.42",
"high": "1825.60",
"last": "1782.15",
"low": "1750.30",
"sell": "1781.97",
"vol": "45218.39199642"
}
}Field Descriptions:
buy: Best bid pricesell: Best ask pricelast: Last executed tradehigh/low: 24-hour price rangevol: 24-hour trading volume
WebSocket Streaming
For continuous market updates:
- Establish WebSocket connection
Subscribe to ETH channels:
eth_usd.tickereth_usd.depth
- Receive push notifications
👉 WebSocket implementation guide
FAQ Section
Q1: How frequently can I call the REST API?
A: OKCoin allows up to 60 requests per second. Implement caching for high-frequency needs.
Q2: Is historical ETH price data available?
A: Use the /api/v1/kline.do endpoint with timeframe parameters (1min/1hour/1day etc.)
Q3: How secure are API transactions?
A: All requests require HMAC-SHA256 signatures. Enable IP whitelisting for added security.
Q4: Can I test trades without real funds?
A: Yes - use the sandbox environment at https://www.okcoin.com/sandbox/
Q5: What's the minimum ETH order size?
A: 0.001 ETH for spot trading via API.
Best Practices
- Rate Management: Implement request throttling
- Error Handling: Check for
error_codein responses - Data Verification: Cross-validate with WebSocket streams
- Security: Rotate API keys quarterly
For advanced trading strategies, explore OKCoin's Futures API documentation.