Quick Start Guide
Overview
This guide provides a comprehensive overview of how to use the SynFutures API endpoints. It covers the essential steps from authentication to making your first API call.
Important: All API endpoints require authentication.
Prerequisites
Before you begin, ensure you have:
A SynFutures account
API credentials (API Key and Secret Key)
Basic understanding of REST APIs
Your preferred programming language environment set up
Authentication
All API endpoints require authentication using API keys. Here's how to authenticate your requests:
Required Headers
X-BAPI-API-KEY: [your_api_key]
X-BAPI-SIGN: [signature]
X-BAPI-TIMESTAMP: [timestamp]
X-BAPI-RECV-WINDOW: 5000Signature Generation
The signature is generated using HMAC SHA256:
Base URL
All API requests should be made to:
Common Request Patterns
All API endpoints require authentication. Here are examples of authenticated requests:
Example 1: Get Server Time
Example 2: Get Account Balance
Step-by-Step Examples
Step 1: Get Server Time
First, synchronize with the server time:
Step 2: Get Market Data
Retrieve current market information:
Step 3: Get Account Balance
Retrieve your account balance:
Error Handling
Always implement proper error handling:
Rate Limits
Be aware of rate limits:
All Endpoints: 120 requests per minute
Implement rate limiting in your application to avoid hitting these limits.
Best Practices
1. Use HTTPS
Always use HTTPS for API requests to ensure data security.
2. Handle Timestamps
Use server time for synchronization
Include proper timestamp in requests
Account for network latency
3. Implement Retry Logic
4. Validate Responses
Always validate API responses before processing:
5. Use Pagination
For endpoints that return large datasets, use pagination:
Testing Your Setup
Test your API setup with this simple script:
Next Steps
Set Up Authentication: Ensure your API credentials are properly configured
Test Basic Endpoints: Start with simple endpoints like server time
Explore Market Data: Access market data endpoints to understand available instruments
Check Account Status: Verify your account balance and permissions
Monitor Positions: Use position endpoints to track your current positions
Review Order History: Analyze your trading history and performance
Implement Trading Logic: Build your trading strategies using the API
Support
For additional help:
Check the individual API documentation files
Review error codes and messages
Ensure your API keys have the correct permissions
Verify your request format matches the documentation
Security Notes
Never expose your API secret key in client-side code
Use environment variables for API credentials
Implement proper access controls
Monitor your API usage regularly
Rotate your API keys periodically
Last updated