Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.vectrade.io/llms.txt

Use this file to discover all available pages before exploring further.

Rate Limits

Overview

VecTrade uses a token bucket rate limiting algorithm per API key. Limits vary by plan tier and endpoint category.

Plan Limits

PlanRequests/minRequests/dayBurstConcurrent
Free3050052
Developer12010,000205
Pro600100,0005020
EnterpriseCustomCustomCustomCustom

Rate Limit Headers

Every response includes rate limit information:
HeaderDescriptionExample
X-VQ-RateLimit-LimitMax requests per window1000
X-VQ-RateLimit-RemainingRequests remaining in window987
X-VQ-RateLimit-ResetWindow reset time (Unix timestamp)1715800060
Retry-AfterSeconds to wait (only on 429)2

Handling Rate Limits

SDK Auto-Retry

Both official SDKs automatically handle rate limiting with exponential backoff:
# Python — retries are automatic
client = VecTrade(max_retries=3)  # Default: 2

try:
    quote = client.quotes.get("AAPL")
except RateLimitError as e:
    # Only raised after all retries exhausted
    print(f"Rate limited. Wait {e.retry_after}s")
// TypeScript — retries are automatic
const client = new VecTrade({ maxRetries: 3 });

try {
  const quote = await client.quotes.get('AAPL');
} catch (e) {
  if (e instanceof RateLimitError) {
    console.log(`Wait ${e.retryAfter}s`);
  }
}

Manual Rate Limit Monitoring

# Access rate limit info from response metadata
quote = client.quotes.get("AAPL")
print(f"Remaining: {client.last_response.rate_limit.remaining}")
print(f"Resets at: {client.last_response.rate_limit.reset_timestamp}")

Optimization Strategies

1. Use Batch Endpoints

Instead of individual requests per symbol, use batch endpoints:
# ❌ 5 requests (5 rate limit tokens)
for symbol in ["AAPL", "GOOGL", "MSFT", "AMZN", "NVDA"]:
    client.quotes.get(symbol)

# ✅ 1 request (1 rate limit token)
quotes = client.quotes.batch(["AAPL", "GOOGL", "MSFT", "AMZN", "NVDA"])

2. Use Webhooks for Real-Time Updates

Instead of polling for changes, subscribe to webhooks:
# ❌ Polling every 5 seconds (720 requests/hour)
while True:
    quote = client.quotes.get("AAPL")
    time.sleep(5)

# ✅ Webhook (0 requests — server pushes to you)
client.webhooks.create(
    url="https://your-app.com/webhooks",
    events=["quote.update"],
    symbols=["AAPL"],
)

3. Cache Responses Client-Side

from functools import lru_cache

@lru_cache(maxsize=100, ttl=60)  # Cache 60 seconds
def get_fundamentals(symbol: str):
    return client.fundamentals.get(symbol)

4. Use Field Filtering

Request only the fields you need to reduce payload size:
quote = client.quotes.get("AAPL", fields=["price", "volume"])

Quota Exceeded vs Rate Limited

ScenarioHTTP StatusError TypeSDK ExceptionRetryable
Too many requests/minute429rate_limit_errorRateLimitErrorYes (auto)
Monthly quota exhausted429quota_exceededQuotaExceededErrorNo
QuotaExceededError is NOT retryable — you’ve exhausted your monthly allocation. Upgrade your plan at app.vectrade.io/billing.