速率限制

  • 更新

小心

全交易所合规性(OTV 和 API 使用政策)

所有 API 流量(无论是经过身份验证的还是公开的)必须遵守 Deribit 更广泛的交易诚信规则,包括 订单总量 (OTV) 限制 以及其他反滥用保护措施。违规行为可能会导致会话立即断开、额外限制或采取更强

如需完整指南,请查看我们的 API 使用政策 (其中还包括 OTV 阈值和其他交易所滥用规则)。

为了保持对我们API的公平和稳定访问,Deribit 使用了基于积分的费率限制系统。该系统可确保平台资源的有效利用,同时适应不同的交易量

基于积分的系统

每个 API 请求都会消耗一定数量的积分。账户的充值率和最大信用池取决于您的交易活动和等级 如果在没有剩余积分的情况下收到请求,我们会立即发送 too_many_requests code 10028) 或类似错误并终止会话。 断开连接后,您必须等待积分充值,然后重新建立新的连接,然后才能发送其他请求。

该系统的关键要素包括:

信用额度充值

积分是 以固定速率持续补充,取决于您账户的等级。这个笔芯的作用就像 漏水的水桶: 每秒,一定数量的积分 “滴入” 到您账户的信用池中。你可以将其视为 “每秒积分”(CPS)充值

注意

[en] Rate limits are applied per sub-account. Each sub-account has its own independent rate limit.

  • 示例:如果您的充值率为 20 个积分/秒,并且每个请求需要 1 个积分,则可以在不耗尽积分的情况下可持续地每秒发送 20 个请求。

  • 补货仍在继续 即使你没有提出请求,允许您累积积积分以备不时之需 最高信用额度

  • 如果您的最大信用额度为 200,充值率为 20 点/秒,则从 0 充值到 200 将需要 10 秒钟才能完全充值。

这种补充机制有助于:

  • 允许 爆发活动 (例如,一次提交多个订单),只要不超过最大信用额度即可。

  • 鼓励 一致且可预测的使用情况,最大限度地减少可能使系统紧张的突然浪涌。

最大积分

这是 上界 您的可用信用额度。无论等待多长时间,您累积的积分都不能超过此上限。它决定了您可以发出的请求突发的大小

每次请求的费用

每个 API 终端节点消耗的积分数量不同。资源密集型终端节点的成本可能高于轻量级

提示

使用 WebSocket 订阅获取实时数据可减少 REST 积分消耗。

重要

这个 public/get_instruments 端点有独特的速率限制:每 10 秒 1 个请求,突发限额为 5。该限额与标准信用体系分开执行。

[en] The following methods have custom rate limits that differ from the standard non-matching engine defaults:

[en] Method

[en] Cost

[en] Credits

[en] Sustained Rate

[en] Burst Capacity

[en] public/get_instruments 

10,000

500,000

[en] 1 request/second

[en] 50 requests

[en] public/subscribe private/subscribe 

3,000

30,000

[en] ~3.3 requests/second

[en] 10 requests

[en] private/position_move 

100,000

600,000

[en] 6 requests/minute

[en] 6 requests

[en] private/get_transaction_log 

10,000

80,000

[en] 1 request/second

[en] 8 requests

[en] These limits are enforced using the same credit-based system as other methods, but with different cost and credit pool configurations.

注意

[en] Rate limits described in this article do not apply to Mass Quotes. Mass Quotes follow their own dedicated rate-limiting rules, which are documented separately in the Mass Quotes Specifications article.

警告

网页使用还会消耗 API 积分

请注意,使用 Deribit 网络平台 还会在幕后生成 API 请求。这意味着 浏览某些页面(例如,订单簿、头寸、账户信息) 能够 消耗您的 API 速率限制中的积分,就像编程 API 调用一样。

如果您在开放的 Deribit 网络会话的同时运行自动脚本或交易机器人,则达到信用额度的速度可能比预期的要快。发生这种情况时,你可能会收到 too_many_requests 错误(代码 10028),即使您的脚本似乎在预期的请求量之内。

要优化性能,请执行以下操作:

  • 避免保持多个浏览器标签页处于打开状态 在数据密集型页面上。

  • 在运行高频策略时,可以考虑退出 Web 界面。

  • [en]  Note: If you customize a trading page by adding more components, that may affect the rate limit.

匹配与不匹配的引擎请求

API 请求主要分为两类:

  • 匹配引擎请求:它们与订单簿相互作用,例如下单或取消订单。

  • 不匹配的引擎请求:这些涉及一般查询,例如检索账户信息或市场数据。

每种类型的请求以不同的费率消耗积分。

不匹配的引擎请求的默认设置

  • 每次请求的费用: 500 个积分。

  • 最大积分: 50,000 个积分。

  • 充值率:充值费率为每秒最多允许 20 个请求(每秒 10,000 个积分)。

  • 突发容量:考虑到最大信用池,一次最多允许 100 个请求。

[en] Burst and Refill Example (non-matching defaults)

警告

[en] All rate-limit values in this example are illustrative only. They describe how the mechanism works and do not represent your actual limits.

  • [en] The burst counter starts with 50,000 credits(the maximum pool).

  • [en] Each request costs 500 credits; 100 back-to-back requests would fully drain the pool if you ignore refills.

  • [en] Credits refill continuously at 10 credits per millisecond (10,000 per second) even while you are bursting.

  • [en] If credits reach zero, new requests fail with too_many_requests (code 10028).

  • [en] Sustained traffic at 20 req/s(20 × 500 = 10,000) matches the refill rate, so the pool stays stable. A rapid 100+ request burst can still trigger 10028 if it outpaces the current credits.

  • [en] If you hit 10028 and need to cancel orders, waiting ~50 ms restores ~500 credits (10 credits/ms), enough to send a mass-cancel.

匹配引擎请求

每个子账户都有每小时更新的速率限制,适用于所有图书。用户可以通过以下方式查看他们当前的速率限制 /private/获取账户摘要 方法。

等级等级

7 天交易量

持续速率限制(请求数/秒)

突发速率限制

描述

第 1 级

超过 2,500 万美元

30 个请求/秒

100 个请求(突发)

适用于大批量交易者,允许快速发起多达 100 个请求或每秒 30 个请求的稳定速率。

第 2 级

超过 500 万美元

20 个请求/秒

50 个请求(突发)

专为中等交易量交易者设计,一次最多允许 50 个请求或每秒 20 个请求。

第 3 级

超过一百万美元

10 个请求/秒

30 个请求(突发)

适用于活跃的交易者,支持多达 30 个请求或每秒 10 个请求。

第 4 级

高达 1 百万美元

5 个请求/秒

20 个请求(突发)

对于普通交易者来说,一次最多允许 20 个请求或每秒 5 个请求的稳定速率。

[en] Automatic Rate Limit Updates

  • [en] We recalculate limits every hour. There is no “volume/7 per day” delay—the most recent 7-day trading volume is evaluated each hour for every sub-account that has trading stats.

  • [en] Volume window: the trailing 7-day trading volume determines your tier. Each hourly recalculation uses the latest 7-day sum.

  • [en] Upgrades: if your 7-day volume crosses a higher-tier threshold during an hourly check, we immediately move you to that tier (we can skip intermediate tiers; e.g., jumping from Tier 1 straight to Tier 4 is possible).

  • [en] Downgrades: during an hourly check, if your 7-day volume falls below your current tier’s threshold after being above it in the prior hour, the limits are lowered accordingly. This can also skip tiers if the 7-day volume drops multiple thresholds.

重要

公共访问限制

公众, 未经授权 API 请求受速率限制 每个 IP 的基础—他们不从账户级别的信用池中提款。如果 IP 超出其公共请求限额,则后续呼叫可能是 暂时被拒绝 或者连接 断开连接 保护平台稳定性。

只要有可能,使用 与您的 API 密钥关联的授权请求。经过身份验证的流量有以下好处:

  • 更高、更透明的限额 该等级与您账户的等级相关。

  • 客户端 ID 可见性,让我们区分大量合法使用和滥用流量——因此,如果超过您的限制,我们可以采取渐进的保障措施,而不是立即封锁。

简而言之,授权请求始终是持续或高频访问的更安全、更可靠的选择。

重要

制作和 测试网环境 操作 在单独的、独立跟踪的速率限制池中限额不可共享 在不同环境之间——超过测试网限制不会影响你的生产积分,反之亦然。

检查当前速率限制

用户可以通过拨打以下电话来访问当前的速率限制 /private/获取账户摘要 方法和接收 limits 字段作为响应。速率限制的配置可以基于每种货币,也可以是适用于所有货币的全球默认设置。每币种限制不是默认设置,仅应要求为特定客户启用

注意

目前使用每种货币的汇率限制 完全是为了减少 需要时对特定货币进行访问限制。它们不适用于提高速率限制。

限制字段

non_matching_engine:描述适用于不涉及匹配引擎的请求的速率限制。定义为:

  • burst:短时间内允许的最大请求数。

  • rate:一段时间内允许的持续请求数。

matching_engine:概述了与使用匹配引擎的操作相关的速率限制,结构如下:

所有配置的通用限制

现货和取消限额

  • spot: 适用于两种不同货币之间的现货交易。

  • cancel_all:在不指定货币的情况下取消全球所有订单或按标签取消所有订单时使用。

全球限额与每种货币限额

  • 什么时候 limits_per_currency = false,限制适用于全球:

    • trading: 整体交易业务

    • maximum_quotes: 报价总数

    • maximum_mass_quotes: 批量报价操作

    • guaranteed_mass_quotes: 保证批量报价

  • 什么时候 limits_per_currency = true,限制已设定 每种结算货币matching_engine 对象:

    • 每个货币密钥包括:

      • trading: 每种货币的交易限额

      • maximum_quotes: 每种货币的报价限制

      • maximum_mass_quotes: 每种货币的批量报价限制

      • guaranteed_mass_quotes: 每种货币的保证批量报价

取消端点逻辑

没有每种货币配置的用户示例(默认):

{
      "non_matching_engine": {
        "burst": 1500,
        "rate": 1000
      },
      "limits_per_currency": false,
      "matching_engine": {
        "trading": {
          "total": {
            "burst": 20,
            "rate": 5
          }
        },
        "spot": {
          "burst": 250,
          "rate": 200
        },
        "maximum_quotes": {
          "burst": 500,
          "rate": 500
        },
        "maximum_mass_quotes": {
          "burst": 10,
          "rate": 10
        },
        "guaranteed_mass_quotes": {
          "burst": 2,
          "rate": 2
        },
        "cancel_all": {
          "burst": 250,
          "rate": 200
        }
      }
    }

使用每种货币配置的用户示例:

{
      "non_matching_engine": {
        "burst": 1500,
        "rate": 1000
      },
      "limits_per_currency": true,
      "matching_engine": {
        "cancel_all": {
          "burst": 250,
          "rate": 200
        },
        "spot": {
          "burst": 250,
          "rate": 200
        },
        "usdt": {
          "maximum_quotes": {
            "burst": 500,
            "rate": 500
          },
          "maximum_mass_quotes": {
            "burst": 10,
            "rate": 10
          },
          "guaranteed_mass_quotes": {
            "burst": 2,
            "rate": 2
          },
          "trading": {
            "total": {
              "burst": 250,
              "rate": 200
            }
          }
        },
        "usdc": {
          "maximum_quotes": {
            "burst": 500,
            "rate": 500
          },
          "maximum_mass_quotes": {
            "burst": 10,
            "rate": 10
          },
          "guaranteed_mass_quotes": {
            "burst": 2,
            "rate": 2
          },
          "trading": {
            "total": {
              "burst": 250,
              "rate": 200
            }
          }
        },
        "eth": {
          "maximum_quotes": {
            "burst": 500,
            "rate": 500
          },
          "maximum_mass_quotes": {
            "burst": 10,
            "rate": 10
          },
          "guaranteed_mass_quotes": {
            "burst": 2,
            "rate": 2
          },
          "trading": {
            "total": {
              "burst": 250,
              "rate": 200
            }
          }
        },
        "btc": {
          "maximum_quotes": {
            "burst": 500,
            "rate": 500
          },
          "maximum_mass_quotes": {
            "burst": 10,
            "rate": 10
          },
          "guaranteed_mass_quotes": {
            "burst": 2,
            "rate": 2
          },
          "trading": {
            "perpetuals": {
              "burst": 20,
              "rate": 10
            },
            "total": {
              "burst": 150,
              "rate": 100
            }
          }
        }
      }
    }

匹配引擎请求概述

所有请求 未在下面列出 被视为 不匹配的引擎 请求。

  • private/buy

  • private/sell

  • private/edit

  • private/edit_by_label

  • private/cancel

  • private/cancel_by_label

  • private/cancel_all

  • private/cancel_all_by_instrument

  • private/cancel_all_by_currency

  • private/cancel_all_by_kind_or_type

  • private/close_position

  • private/verify_block_trade

  • private/execute_block_trade

  • private/move_positions

  • private/mass_quote

  • private/cancel_quotes

  • private/add_block_rfq_quote

  • private/edit_block_rfq_quote

  • private/cancel_block_rfq_quote

  • private/cancel_all_block_rfq_quotes

修复消息类型

  • new_order_single

  • order_cancel_request

  • order_mass_cancel_request

  • order_cancel_replace_request

  • mass_quote

  • quote_cancel