Variational Docs
HomeDiscordTwitterBlog
  • Variational Protocol
    • About Variational
    • Peer-to-peer vs DEX
    • Roadmap
    • Key Concepts
      • Trading via RFQ
      • Settlement Pools
      • Margin
      • Slippage
      • Leverage
      • Liquidation
      • Mark price vs index price vs quote price
      • Open Interest & Funding Rates
      • Fully Diluted Valuation (FDV)
      • Fees
      • Market vs. Limit Orders
      • Take Profit & Stop Loss
    • $VAR Token
    • Media Kit
    • Official Links
    • FAQ
    • Getting Help (Support)
  • Variational Omni
    • About Omni
    • Getting Started with Omni
    • Getting Started With Omni (Testnet)
    • Omni Liquidity Provider (OLP)
    • Listings
    • Risk Limits
  • Automatic Deleveraging | Counterparty Liquidation
  • Variational Pro
    • About Pro
  • Technical Documentation
    • Technical Overview
      • Authentication
      • Deposits
      • Withdrawals
      • Trades
    • Derivative Specifications
      • Perpetual Futures
      • Settlement
    • API
      • SDKs
      • Quickstart and Tutorials
        • API Trading Prerequisites and Setup
        • Settlement Pool Deposit Tutorial
        • Taker (RFQ Submitter) Tutorial
        • Maker (RFQ Responder) Tutorial
      • Endpoints
      • Data Models
      • Headers
      • Pagination
      • Rate Limits
      • Authentication
    • Contracts and ABIs
    • Security and Audits
    • Partners
  • Legal
    • Terms of Service
    • Privacy Policy
    • Restricted Persons
  • ARCHIVE
    • Testnet Trading Competition #1 Leaderboard
    • Testnet Trading Competition #2 Leaderboard
    • Testnet Trading Competition #3 Leaderboard
Powered by GitBook
On this page
  • Allowance
  • Python SDK
  1. Technical Documentation
  2. API

Rate Limits

PreviousPaginationNextAuthentication

Last updated 1 year ago

The Variational API uses weighted rate limiting for incoming requests. This means that rate limits are defined in terms of max incurred cost per unit of time, not simply the number of requests. This cost is measured in request tokens.

Most read requests cost 1 token; some more complicated read and write requests have higher costs. The exact cost for each endpoint is specified in the .

Allowance

Each user company is allowed to spend 100 request tokens within a sliding 10-second window.

Therefore, simple reads are allowed at an average rate of 10 requests/second with bursts up to 100 requests/second followed by a cooldown period. Making more costly requests will reduce that rate.

The allowance is measured per company, regardless of how many different IPs or API keys are used.

A call exceeding the allowance during the current window will receive a HTTP 429 Too Many Requests response, which will include a header called X-Rate-Limit-Resets-In-Ms indicating the minimal delay in milliseconds after which the next request will be allowed.

Note that the recommended delay returned in the header is calculated with an assumption that there's only one client making requests to Variational API for the account. Multiple clients running in parallel must coordinate request throttling among themselves.

Python SDK

Client from the provided Python SDK retries rate limiting errors automatically by default.

When a rate limiting error is detected, Client will retry the request after sleeping for the duration indicated in X-Rate-Limit-Resets-In-Ms, plus for a small additional amount of buffer time increasing with each attempt.

This behavior can be turned off by setting the retry_rate_limits option to False explicitly:

from variational import Client, TESTNET

client = Client(API_KEY, API_SECRET, base_url=TESTNET, retry_rate_limits=False)
Endpoint Reference