T-Invest Node SDK Node.js
On this page

Choose documentation for your task

Service properties, connection settings, and per-call options for the SDK.

Get started with the SDK

The services of an SDK instance share one gRPC channel. Call close() when you are done.

SDK services

Call service methods through the corresponding property on a TInvestNodeSDK instance. Use the examples to get started with each service. Public service interfaces

SDK property Task Example or reference
sdk.users Accounts, user details, and tariff quotas List accounts
sdk.instruments Instrument lookup and reference data Find an instrument by ticker
sdk.marketData Candles, prices, order books, and trading statuses Get minute candles
sdk.marketdataStream Market data subscriptions Read and close a stream
sdk.operations Portfolio, positions, and operation history Page through operations
sdk.operationsStream Portfolio, positions, and operation streams Choose an account stream
sdk.orders Placing, reading, replacing, and cancelling orders Order commands
sdk.ordersStream Order and trade events Watch order state
sdk.stopOrders Listing, placing, and cancelling stop orders Stop order commands
sdk.sandbox Test accounts, orders, and operations Run an order lifecycle in the sandbox
sdk.signals Strategies and signals Get active signals

The SDK uses the official T-Invest API 1.51 contracts and provides 100 unary and 7 streaming gRPC methods across 11 services. T-Bank documents each method and its parameters. Latest T-Invest API release · Service catalog · Sandbox methods

Run a CLI command

Use the built-in CLI to call the API from your terminal. Start by listing accounts. First CLI request

Configure the connection and quotas

Set up the channel and local quotas when you create the SDK. Calls through the channel can use their own timeouts and metadata.

SDK instance options

Pass TInvestOptions to the TInvestNodeSDK constructor. The token and endpoint are required. Type declaration

Property Description Type Default
token Token for gRPC authorization metadata. Use printable ASCII characters string Required
endpoint gRPC endpoint. For T-Invest, pass the host and port string Required
appName Application name for x-app-name metadata. Use printable ASCII characters string —
useSsl Enable TLS for the channel boolean true
tls PEM data in rootCertificates (Buffer) replaces the bundled CA when TLS is enabled TInvestTlsOptions —
unaryLimiter Application-provided limiter that waits for quota before a unary call TInvestUnaryLimiter —
unaryLimits Per-instance quota overrides by service and method TInvestUnaryLimits —

With TLS enabled, the SDK uses the bundled root certificate when tls.rootCertificates is unset. It merges defaultConfig.unaryLimits with instance overrides to build the quota table. Pass unaryLimiter to wait for quotas locally.

Per-call options

Pass TInvestCallOptions as the method's second argument. These settings apply to one unary call or stream.

Property Description Type Default
metadata Additional request metadata. The SDK sets authorization and x-app-name TInvestMetadata —
signal Cancel quota waits and the gRPC call AbortSignal —
onHeader Receive initial response metadata (header: TInvestMetadata) => void —
onTrailer Receive trailing response metadata (trailer: TInvestMetadata) => void —

The SDK invokes both callbacks synchronously. If a callback throws, the unary call or stream iteration fails with that error. Example with metadata and cancellation

  • API limits — provider quotas and the SDK limiter.
  • TLS trust — connect with your own root certificates.
  • Bundled CA — origin and fingerprint of the bundled certificate.
  • Public exports — types and functions available to import.

Develop the SDK

Find the release process, package quota updates, and verification of bundled certificate changes in one guide. SDK development