API Reference
📋 Table of Contents
❌ Error Codes
Error Code Summary
| Error Code | Description | Solution |
|---|---|---|
| 100011 | Parameter error | Check if request parameters are correct |
| 410002 | Signature verification failed | Check if signature algorithm and secret key are correct |
| 410001 | Invalid API Key | Check if API Key is correct |
| 410006 | Insufficient permissions | Check API Key permission settings |
Common Error Handling
1. Signature Verification Failed (410002)
Possible Causes:
- Incorrect API Secret
- Incorrect signature algorithm implementation
- Incorrect parameter sorting
- Incorrect timestamp or nonce format
Solutions:
- Check if API Secret is correct
- Verify signature algorithm implementation
- Ensure parameters are sorted in dictionary order
- Check timestamp and nonce format
📚 References
Official Resources
Third-party Resources
- CoinGecko - Cryptocurrency data
- CoinMarketCap - Market data
- TradingView - Chart analysis tools
Development Tools
Programming Language Resources
JavaScript/Node.js
Java
Python
🔧 Technical Specifications
HTTP Status Codes
| Status Code | Description |
|---|---|
| 200 | Request successful |
| 400 | Request parameter error |
| 401 | Authentication failed |
| 403 | Insufficient permissions |
| 404 | Resource not found |
| 429 | Request rate limit exceeded |
| 500 | Internal server error |
| 502 | Gateway error |
| 503 | Service unavailable |
| 504 | Gateway timeout |
Data Format
Request Format
- Content-Type:
application/json - Character encoding:
UTF-8 - Time format: Unix timestamp (milliseconds)
Response Format
{
"code": "0",
"data": {},
"msg": "Request successful",
"success": true,
"timestamp": 1640995200000
}Time Format
- Timestamp: Unix timestamp, millisecond precision
- Time String: ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ)
- Time Zone: UTC time
Numeric Precision
- Price: According to trading pair configuration precision
- Quantity: According to trading pair configuration precision
- Amount: According to coin configuration precision
- Fee: According to coin configuration precision
🚀 Best Practices
1. Error Handling
try {
const response = await apiRequest(endpoint, params);
if (response.code === '0') {
// Handle successful response
handleSuccess(response.data);
} else {
// Handle business error
handleBusinessError(response.code, response.msg);
}
} catch (error) {
// Handle network error
handleNetworkError(error);
}2. Retry Mechanism
async function makeRequestWithRetry(endpoint, params, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await apiRequest(endpoint, params);
} catch (error) {
if (i === maxRetries - 1) throw error;
// Exponential backoff
const delay = Math.pow(2, i) * 1000;
await new Promise(resolve => setTimeout(resolve, delay));
}
}
}3. Request Rate Limiting
class RateLimiter {
constructor(maxRequests, timeWindow) {
this.maxRequests = maxRequests;
this.timeWindow = timeWindow;
this.requests = [];
}
async throttle() {
const now = Date.now();
this.requests = this.requests.filter(time => now - time < this.timeWindow);
if (this.requests.length >= this.maxRequests) {
const oldestRequest = this.requests[0];
const waitTime = this.timeWindow - (now - oldestRequest);
await new Promise(resolve => setTimeout(resolve, waitTime));
}
this.requests.push(now);
}
}4. Logging
class ApiLogger {
static log(level, message, data = {}) {
const logEntry = {
timestamp: new Date().toISOString(),
level,
message,
data
};
console.log(JSON.stringify(logEntry));
// Can send to log service
if (level === 'ERROR') {
this.sendToLogService(logEntry);
}
}
}📞 Technical Support
Contact Information
- Technical Support Email: [email protected]
- Developer Community: https://community.bittap.com
- GitHub: https://github.com/bittap
- Discord: https://discord.gg/bittap
Support Hours
- Weekdays: 9:00 - 18:00 (UTC+8)
- Weekends: 10:00 - 16:00 (UTC+8)
- Holidays: 10:00 - 16:00 (UTC+8)
Issue Reporting
If you encounter problems during use, please provide the following information:
- Error Description: Detailed description of the issue encountered
- Error Code: If there is an error code, please provide it
- Request Information: API endpoint, parameters, etc.
- Environment Information: Programming language used, version, etc.
- Log Information: Relevant error logs
📄 License
This documentation and related code examples are licensed under the MIT License.
MIT License
Copyright (c) 2024 BitTap
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.