MQuant Developers v1
Open MQuant

Rate limits

Limits protect the desk and keep every key within the exchange's order-rate rules. Read your current limits from GET /api/v1/me, watch the headers on every response, and back off when told to.

Limits#

A request must pass every limit it touches. These are the defaults; the desk can change your key's limits within fixed bounds, and limits in GET /api/v1/me always shows the values in force.

LimitPer secondPer minutePer dayApplies to
Key, writes104005,000POST /signals, /signals/batch, /signals/{id}/cancel
Key, reads10300NoneEvery signed GET, and POST /signals/test
Trader, writes, all keys together101,00020,000Writes from all of one trader's keys
Desk-wide, writes503,000NoneWrites from all traders together
Client IP, before authentication30900NoneEvery request to /api/v1, including /time and failed ones
Why 10 per second

SEBI's framework for algorithmic trading by retail investors treats order flow above 10 orders per second as requiring a registered algorithm. MQuant enforces 10 signals per second as a hard ceiling on every key and every trader; no key can be set above it.

  • Per-second limits use a sliding one-second window. Per-minute limits reset at the start of each clock minute. Per-day limits reset at midnight IST.
  • A batch costs one write per item. An invalid request still costs one unit, because limits are checked before the body is validated.
  • GET /api/v1/time counts only against the per-IP limit. IPv6 clients are limited per /64.

What the desk can change#

Key limitDefaultHighest the desk can set
signals_per_second1010
signals_per_minute4001,000
signals_per_day5,00020,000
reads_per_second1020
reads_per_minute3001,200

Rate limit headers#

Responses to requests that pass authentication carry these headers, including validation errors. Responses rejected before that point, such as 401 and 403, do not.

HeaderMeaning
X-RateLimit-LimitYour key's per-minute limit for this class: reads_per_minute on reads, signals_per_minute on writes.
X-RateLimit-RemainingRequests left in the current minute for this class.
X-RateLimit-ResetUnix epoch seconds when the current minute window ends.
X-RateLimit-Day-RemainingWrite responses only: signals left today on this key.
Retry-AfterOn every 429: whole seconds to wait before trying again.
Response headers on a write
HTTP/1.1 202 Accepted
X-Request-Id: req_6b1f0c9a2e7d4b3a8c5f1e0d
X-MQ-API-Version: 1
X-RateLimit-Limit: 400
X-RateLimit-Remaining: 361
X-RateLimit-Reset: 1796184060
X-RateLimit-Day-Remaining: 4962

When you are limited#

Four codes come with 429 Too Many Requests. All of them carry Retry-After.

CodeCauseRetry-After is
rate_limitedA per-second, per-minute or per-day limit on your key, your trader, the desk or your address.Time until the limit frees up
key_temporarily_blockedYour key was rate limited repeatedly.Time left on the block
ip_temporarily_blockedYour address was rate limited repeatedly.Time left on the block
auth_lockedToo many failed signatures from your address.Time left on the lock

Temporary blocks#

Hammering a limit makes things worse. If one key collects 20 rate_limited responses within 60 seconds, it earns a strike and is blocked (429 key_temporarily_blocked). Each further strike on the same IST day blocks for longer:

Strike in the same IST dayBlock
1st2 minutes
2nd10 minutes
3rd1 hour
4th and later24 hours
  • A client address that collects 60 rate_limited responses within 60 seconds is blocked the same way (429 ip_temporarily_blocked).
  • Failed authentication: 20 auth_failed responses from one address within 15 minutes lock that address for 15 minutes (429 auth_locked). Your key is never locked by failures, so nobody can lock you out by guessing.
  • Blocks expire on their own. Only the desk can lift one early.

Retries and backoff#

  1. On 429, wait the number of seconds in Retry-After. Never retry sooner, and never retry in a tight loop: that is how a key gets blocked.
  2. On a timeout, a dropped connection, a 500 or a 503, retry with exponential backoff and jitter: about 0.5 s, 1 s, 2 s, 4 s, capped at 30 s.
  3. Every retry of a send uses the same body and client_signal_id, with a fresh timestamp, nonce and signature. If the first attempt was stored, you get it back with replayed: true instead of a duplicate. See Idempotency.
  4. Do not retry other 4xx responses without changing the request.
  5. Give up after a few attempts and alert a person. Do not retry a key_temporarily_blocked that asks you to wait hours.
  6. Pace yourself before the limit: if X-RateLimit-Remaining is low, slow down, and spread a burst of signals over a few seconds rather than firing them in one.
Shell, using mq.sh (fixed waits, as mq.sh does not print headers)
BODY='{"client_signal_id":"reliance-0001","exchange":"NSE","symbol":"RELIANCE","instrument_type":"EQ","side":"BUY","quantity":10,"order_type":"LIMIT","price":"1250.50","product":"CNC"}'

for attempt in 1 2 3 4; do
  REPLY=$(./mq.sh POST /api/v1/signals "$BODY") || REPLY="HTTP 000"
  STATUS=$(printf '%s' "$REPLY" | tail -n 1 | awk '{print $2}')
  case "$STATUS" in
    200|202) printf '%s\n' "$REPLY"; break ;;
    429|5*|000) sleep $(( attempt * 2 )) ;;
    *) printf '%s\n' "$REPLY" >&2; exit 1 ;;
  esac
done

The Python and Node clients on Code examples already include this logic as send_signal() and sendSignal().

MQuant is the platform of Sykes & Ray Equities. Questions go to your MQuant desk contact.