Rate Limits
Understanding and working within TradeStaq's API rate limits.
Overview
Rate limits protect the platform and ensure fair access for all users. Different endpoints have different limits based on their resource requirements.
Webhook Rate Limits
Per-Webhook Limits
| Limit Type | Value | Window |
|---|---|---|
| Requests | 60 | Per minute |
| Burst | 10 | Per second |
What This Means
| Scenario | Allowed? |
|---|---|
| 1 signal per second | Yes |
| 10 signals in 1 second, then pause | Yes |
| 60 signals in 1 minute | Yes |
| 61 signals in 1 minute | No (61st rejected) |
| 15 signals in 1 second | No (11-15 rejected) |
Rate Limit Headers
Responses include rate limit information:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1704067260
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests per window |
X-RateLimit-Remaining | Requests remaining |
X-RateLimit-Reset | Unix timestamp when limit resets |
Rate Limit Response
When exceeded:
{
"success": false,
"error": "Rate limit exceeded",
"code": "RATE_LIMITED",
"retryAfter": 15
}
HTTP Status: 429 Too Many Requests
Exchange API Limits
Each exchange has its own rate limits that TradeStaq respects:
Binance
| Endpoint Type | Limit | Window |
|---|---|---|
| Order operations | 10 | Per second |
| Account queries | 1200 | Per minute |
| Weight limit | 1200 | Per minute |
ByBit
| Endpoint Type | Limit | Window |
|---|---|---|
| Order operations | 10 | Per second |
| Account queries | 120 | Per minute |
OKX
| Endpoint Type | Limit | Window |
|---|---|---|
| Order operations | 60 | Per 2 seconds |
| Account queries | 10 | Per second |
Subscription Tier Limits
Feature Limits by Tier
| Feature | Free | Pro | Trader | Whale |
|---|---|---|---|---|
| Webhooks/minute | 30 | 60 | 120 | 300 |
| Bot spins/minute | 1 | 10 | 60 | 120 |
| API calls/day | 1,000 | 10,000 | 100,000 | Unlimited |
Concurrent Limits
| Resource | Free | Pro | Trader | Whale |
|---|---|---|---|---|
| Active bots | 1 | 5 | 15 | 50 |
| Open positions | 3 | 10 | 50 | 200 |
| Pending orders | 5 | 20 | 100 | Unlimited |
Handling Rate Limits
Retry Strategy
When you receive a 429 response:
import time
import requests
def send_signal_with_retry(url, payload, max_retries=3):
for attempt in range(max_retries):
response = requests.post(url, json=payload)
if response.status_code == 429:
retry_after = response.json().get('retryAfter', 5)
time.sleep(retry_after)
continue
return response
raise Exception("Max retries exceeded")
Exponential Backoff
For better retry handling:
import time
import random
def exponential_backoff(attempt, base_delay=1, max_delay=60):
delay = min(base_delay * (2 ** attempt), max_delay)
jitter = random.uniform(0, delay * 0.1)
return delay + jitter
# Usage
for attempt in range(5):
response = requests.post(url, json=payload)
if response.status_code != 429:
break
time.sleep(exponential_backoff(attempt))
Rate Limit Best Practices
| Practice | Implementation |
|---|---|
| Check headers | Monitor remaining quota |
| Implement backoff | Don't hammer on 429 |
| Spread requests | Don't burst unnecessarily |
| Queue signals | Process sequentially |
| Cache responses | Reduce redundant calls |
TradingView Considerations
TradingView Alert Limits
TradingView has its own limits:
| Plan | Alerts | Webhook Calls |
|---|---|---|
| Basic | 1 | Limited |
| Pro | 10 | Standard |
| Pro+ | 30 | Standard |
| Premium | 400 | Standard |
Avoiding TradingView Issues
| Issue | Solution |
|---|---|
| Alert not firing | Check alert conditions |
| Webhook timeout | TradeStaq responds < 1s |
| Duplicate alerts | Use alert "Once Per Bar Close" |
Monitoring Your Usage
Dashboard Metrics
In your TradeStaq dashboard, monitor:
| Metric | Location |
|---|---|
| Webhook calls today | Bot details page |
| Rate limit warnings | Notification center |
| API usage | Settings → Usage |
Webhook Health Indicators
| Color | Meaning |
|---|---|
| 🟢 Green | Healthy, recent activity |
| 🟡 Yellow | Stale (no signals in 24h) |
| 🔴 Red | Errors occurring |
| ⚫ Gray | Never received signals |
Common Issues
"Rate Limit Exceeded" Errors
Causes:
- Too many signals in short period
- Strategy generating excessive signals
- Multiple sources sending to same webhook
Solutions:
- Add delays between signals
- Review strategy logic
- Use separate bots for different sources
Signals Being Dropped
Causes:
- Hitting burst limit
- Exchange rate limits
- Network issues
Solutions:
- Implement queuing
- Add retry logic
- Check exchange status
Slow Execution
Causes:
- Near rate limits
- Exchange congestion
- High system load
Solutions:
- Reduce signal frequency
- Upgrade tier for higher limits
- Try different times
Optimization Tips
For High-Frequency Strategies
| Tip | Implementation |
|---|---|
| Use larger timeframes | Reduce signal count |
| Add confirmation | Filter weak signals |
| Batch operations | Combine where possible |
| Consider tier upgrade | Higher limits available |
For Multiple Bots
| Tip | Implementation |
|---|---|
| Stagger signals | Don't trigger all at once |
| Separate webhooks | Each bot has own limit |
| Prioritize | Critical bots first |
Limits by Endpoint
Quick Reference
| Endpoint | Limit | Window | Notes |
|---|---|---|---|
/api/webhooks/trade/* | 60 | 1 min | Per webhook |
/api/exchanges/sync | 10 | 1 min | Per exchange |
/api/positions | 30 | 1 min | Read operations |
/api/orders | 20 | 1 min | Order operations |
Getting Higher Limits
Upgrade Options
| Current | Upgrade To | Webhook Limit |
|---|---|---|
| Free | Pro | 60/min |
| Pro | Trader | 120/min |
| Trader | Whale | 300/min |
Enterprise Options
For limits beyond Whale tier:
- Contact hello@tradestaq.com
- Describe your use case
- Custom limits may be available
Next Steps
- Webhook API - Webhook reference
- Authentication - Security guide
- Troubleshooting - Error resolution