T-Invest Node SDK Node.js
On this page

T-Invest API limits

Use this reference to choose a rate for unary requests or a number of streaming connections. It compares T-Invest quotas with settings in the SDK and built-in CLI. Use the applicable user tariff when configuring a limiter.

The limits recorded for this SDK release came from the T-Bank Dev Portal. Consult the official limits for current values.

Account for provider-wide limits

  • The provider's service limit counts requests to all methods in a service.
  • The limits policy applies across a user's accounts.
  • A separate aggregate policy applies to requests from one IP address. The official recommendation is at most 50 requests per second across accounts and tokens.
  • The streaming connections section of the same documentation says up to 1000 requests per minute per IP stays within the limit. Consider that guidance together with the 50 requests per second recommendation and individual service quotas.
  • Get actual user limits through users.getUserTariff() and the x-ratelimit-limit, x-ratelimit-remaining, and x-ratelimit-reset response metadata.

account tariff shows unary quotas in limit/min and limit/sec and stream limits in connections. JSON includes unaryLimits[].limitPerSecond only when the provider supplies a per-second quota. An empty limit/sec cell means the value was omitted. An explicit 0 is kept.

Check limits for unary gRPC methods

The SDK uses gRPC. The table lists its static unary quota policy.

Service or method gRPC limit
Instruments service 200 per minute
Bonds, Shares, Options, Futures, Etfs, GetAssets 15 per minute
Accounts service 100 per minute
Operations service 200 per minute
Report generation in Operations 5 per minute
Market data service 600 per minute
Signals service 100 per minute
Stop orders service 50 per minute
GetStopOrders 60 per minute
Sandbox 200 per minute
Orders service 100 per minute
GetOrders 200 per minute
PostOrder 15 per second
CancelOrder 300 per minute
ReplaceOrder 300 per minute
PostOrderAsync 600 per minute

Rows with multiple methods specify shared quotas. Bonds, Shares, Options, Futures, Etfs, and GetAssets share one bucket of 15 requests per minute. The two report generation RPCs share a bucket of 5 requests per minute. The order methods listed individually use their own buckets.

UnaryLimits stores each rule as maxRequests and windowMs. To preserve its burst behavior, PostOrder keeps its one-second window, { maxRequests: 15, windowMs: 1_000 }.

GetBrokerReport and GetDividendsForeignIssuer can both start a report and retrieve a completed report through the same RPC. The transport resolver uses one rule for all request payloads and modes of both RPCs, 5 requests per 60_000 ms.

Check streaming connection limits

The official policy listed these active connection limits.

Stream service Connection limit
MarketData 32
Orders 16 per stream connection type
Operations 11 per stream connection type

Other limits

  • One MarketData stream allows up to 300 simultaneous subscriptions across candles, order books, and public trades.
  • Trading status Info subscriptions are excluded from the 300 limit.
  • The subscription request limit is 100 per minute.
  • users.getUserTariff() can report 1 extra connection slot for safe reconnection. Reserve it for reconnecting.
  • The streaming connection count updates every 2 minutes.
  • For OrderBook and Candles, the server sends at most one message per subscription every 100 ms. Trades, LastPrice, and Info have no such interval.

Configure an SDK limiter

The SDK offers the optional TInvestUnaryLimiter interface. If the application supplies TInvestOptions.unaryLimiter, the SDK performs these steps before each unary transport call.

  • Use the service fallback or a more specific rule matching the full gRPC method path.
  • Resolve the shared quota bucket.
  • Pass path, bucket, maxRequests, windowMs, and a combined AbortSignal to the limiter.
  • Continue the call after acquire() succeeds.

Without unaryLimiter, calls proceed immediately without local quota counters. Streams bypass this interface. The built-in CLI runs without a limiter. The SDK builds a separate quota table for each instance by merging unaryLimits with defaultConfig.unaryLimits. The table uses configuration values, independent of users.getUserTariff() and response metadata.

Once a permit is issued and the unary call is passed to the transport, the slot stays spent even if the call is later canceled. The provider may already have counted it against its quota.

For each gRPC call, UnaryLimitResolver picks the most specific matching rule. A method rule takes precedence over the service rule, so the selected quota covers one rule per call. Account for provider-wide service and IP limits separately. The SDK also groups some method rules into shared quotas. Overriding one method's quota moves it out of the default group. Applying the same override to all methods in the group preserves their shared bucket.

See the request rate-limiting guide for the built-in limiter and quota settings. See the custom limiter guide for different algorithms or coordination scopes.

See the quota configuration guide for per-instance quotas and an example using defineUnaryLimits().

When configuring the limiter, decide which calls share a quota. Account for the user's actual tariff and the provider's quota metadata. The package table supplies the default quotas. The application defines retry and deployment rules.

Change the package quota declaration

To change the SDK's own defaults, follow the maintainer guide. Change the package quota declaration