# Grvt API > Grvt is a crypto derivatives exchange. Its API has two JSON gateways (market data, trading) reachable over HTTP POST and WebSocket JSON-RPC, an edge service for login, and EIP-712 signed writes (orders, transfers, withdrawals). Official SDKs for Python (`pip install grvt`), TypeScript (`npm install github:gravity-technologies/grvt-sdk-typescript`; from its public GitHub repository, not npm: pin a commit, `npm install github:gravity-technologies/grvt-sdk-typescript#`), Go (`go get github.com/gravity-technologies/grvt-sdk-go`) and Rust (`cargo add grvt`) wrap every call as a flat client method, `client.` (streams end in `_stream`); C++ offers a signing core and tested reference examples. C++ applications own networking, sessions, stream state and recovery. Every page below is plain Markdown; fetch only the pages you need. Start with AGENTS.md if you are writing code against Grvt. contract.json is the machine-readable contract the docs and SDKs are generated from: it is for tools, not for reading. ## Start here - [AGENTS.md](/AGENTS.md): how a coding agent should integrate with Grvt (rules that prevent the common mistakes) - [Overview](/index.md): What the Grvt API is, how it is laid out, and where to start. - [Quickstart](/guides/quickstart.md): Run a public data example, then explicitly opt into one testnet order and its cancellation. - [Environments](/guides/environments.md): Testnet and production hosts, chain IDs, and the one variable that switches between them. - [Accounts and permissions](/guides/accounts.md): Main accounts, sub-accounts, users, wallets and API keys, and what each permission allows. - [Authentication and sessions](/guides/authentication.md): Log in with an API key or wallet signature, send the session on HTTP and WebSocket, and renew it. - [Signing](/guides/signing.md): How orders, transfers and withdrawals are signed (EIP-712), step by step with a real server signing test case. - [WebSocket](/guides/websocket.md): Connect, subscribe, read snapshots and deltas, detect gaps with sequence numbers, send orders over WebSocket, reconnect. - [Errors and retries](/guides/errors-and-retries.md): Error shapes, which errors are worth retrying, and why writes are never retried automatically. - [Recovery recipes](/guides/recovery.md): Handle unknown order results, disconnected books and incomplete history without hiding uncertainty. - [Rate limits](/guides/rate-limits.md): How Grvt limits request rates, how to read your limit from each response, and how the SDKs handle it. - [Migrating from grvt-pysdk](/guides/migrating.md): How calls in the old Python SDK (GrvtRaw*, GrvtCcxt*) map to the new SDK, with a short note for the old JS client. - [Strategies](/guides/strategies.md): How strategies take investment, queue and pay redemptions, and get delisted, for managers who run one through the API. - [Stable funding perps (SFP)](/guides/stable-perps.md): How stable funding perps (_SFP instruments) differ from perpetuals: trading hours, index pricing, daily funding at fixed long and short rates, order rules, RFQs, and what qualified makers do. - [Builders](/guides/builders.md): Earn a fee on the orders your app places for its users: authorize a builder and get an API key for the user's account, place builder orders and read builder fees. - [Deposits and withdrawals](/guides/deposits-and-withdrawals.md): Deposit from other chains through your deposit addresses, and withdraw USDT to other chains through the bridge: quote, sign a transfer, track the payout. - [Referrals](/guides/referrals.md): Read your referral data from code: epochs, points, per-referral volume, fees and earnings, daily breakdowns, and referrals of your referrals. - [Changelog](/changelog.md): What changed in each contract and SDK version, newest first, breaking changes marked. ## SDKs - [Python SDK](/sdks/python.md): Install the grvt package, create a client, call any RPC, stream data, place signed orders and handle errors. - [TypeScript SDK](/sdks/typescript.md): Install the grvt package, create a client, call any RPC, stream data, place signed orders and handle errors, in Node and the browser. - [Go SDK](/sdks/go.md): Install the Go module, create a client, call any RPC, stream data, place signed orders and handle errors. - [Rust SDK](/sdks/rust.md): Add the grvt crate, build a client, call any RPC with builders, stream data, place signed orders and handle errors. - [C++ signing core and reference](/sdks/cpp.md): Use tested C++ signing code and executable reference examples with your own networking and application state. ## Full text by area Large files: load one only when you need a whole area. - [llms-full-trading.txt](/llms-full-trading.txt) (~430 KB): trading: orders, algo orders, fills, positions, leverage, RFQ and their private streams - [llms-full-account.txt](/llms-full-account.txt) (~330 KB): account: login, accounts and sub-accounts, transfers, withdrawals, vaults, the error code table - [llms-full-market-data.txt](/llms-full-market-data.txt) (~280 KB): market data: instruments, tickers, order books, trades, candles, public streams - [llms-full-signing.txt](/llms-full-signing.txt) (~81 KB): signing: EIP-712 types, field mappings, the signing walkthrough and signing test cases ## Downloads - [contract.json](/downloads/contract.json) (~1140 KB): the full API contract, source of these docs and the SDKs; for tools, not for reading - [signing.json](/downloads/signing.json) (~120 KB): signing and order-check signing test cases produced by the server's own code - [openapi.yaml](/downloads/openapi.yaml) (~430 KB): REST view (OpenAPI 3.1) - [asyncapi.yaml](/downloads/asyncapi.yaml) (~330 KB): WebSocket streams view (AsyncAPI 3.0) ## RPCs - [login_api_key](/reference/rpc/login_api_key.md): Log in with an API key and get a session for the trading gateway. - [login_wallet](/reference/rpc/login_wallet.md): Log in with a wallet signature (EIP-712 `WalletLogin`) instead of an API key. - [create_order](/reference/rpc/create_order.md): Place an order. - [bulk_orders](/reference/rpc/bulk_orders.md): Create, cancel or cancel-replace several orders of one sub-account in one call. - [get_order](/reference/rpc/get_order.md): Get one order, open or not, by `order_id` or `client_order_id`. - [open_orders](/reference/rpc/open_orders.md): List a sub-account's open orders. - [cancel_order](/reference/rpc/cancel_order.md): Cancel one open order, by `order_id` or `client_order_id`. - [cancel_all_orders](/reference/rpc/cancel_all_orders.md): Cancel all open orders of a sub-account, optionally only those of one kind, base or quote currency. - [cancel_on_disconnect](/reference/rpc/cancel_on_disconnect.md): Arm, refresh or stop a countdown that cancels all of a sub-account's open orders when you stop calling. - [order_history](/reference/rpc/order_history.md): List a sub-account's order history, newest first. - [fill_history](/reference/rpc/fill_history.md): List a sub-account's past fills (your own trades), newest first. - [create_algo_order](/reference/rpc/create_algo_order.md): Place an algo order, a parent order the exchange works for you by placing sub-orders. - [get_algo_order](/reference/rpc/get_algo_order.md): Get one algo order by `algo_order_id` or `client_order_id`. - [open_algo_orders](/reference/rpc/open_algo_orders.md): List a sub-account's open algo orders, including ones still waiting for their trigger. - [cancel_algo_order](/reference/rpc/cancel_algo_order.md): Cancel an algo order and the sub-order it has resting on the book. - [algo_order_history](/reference/rpc/algo_order_history.md): List a sub-account's finished algo orders, one row per algo order, newest first. - [algo_sub_order_history](/reference/rpc/algo_sub_order_history.md): List the finished sub-orders of one algo order. - [create_rfq](/reference/rpc/create_rfq.md): Ask makers for private quotes on a stable funding perp (an RFQ), giving a size and optionally a side. - [cancel_rfq](/reference/rpc/cancel_rfq.md): Cancel your open RFQ before it is accepted or expires. - [positions](/reference/rpc/positions.md): List a sub-account's open positions. - [position_history](/reference/rpc/position_history.md): List a sub-account's closed and partly closed positions. - [get_collateral_preference](/reference/rpc/get_collateral_preference.md): Get which currencies count as collateral for a multi-asset-mode sub-account. - [set_position_config](/reference/rpc/set_position_config.md): Set the margin type (cross or isolated) and leverage of one position. - [get_all_initial_leverage](/reference/rpc/get_all_initial_leverage.md): Get a sub-account's initial leverage for every instrument. - [get_position_margin_limits](/reference/rpc/get_position_margin_limits.md): Get how much margin you can add to or remove from an isolated position. - [add_position_margin](/reference/rpc/add_position_margin.md): Add margin to an isolated position, or remove some with a negative amount. - [set_derisk_mm_ratio](/reference/rpc/set_derisk_mm_ratio.md): Set a sub-account's derisk margin to maintenance margin ratio. - [set_initial_leverage](/reference/rpc/set_initial_leverage.md): Set a sub-account's initial leverage for one instrument (deprecated; use set_position_config). - [get_sub_accounts](/reference/rpc/get_sub_accounts.md): List the ids of the sub-accounts this session can use. - [aggregated_account_summary](/reference/rpc/aggregated_account_summary.md): Get the total equity and balances of your main account and all its sub-accounts together. - [funding_account_summary](/reference/rpc/funding_account_summary.md): Get the total equity and balances of your main (funding) account. - [sub_account_summary](/reference/rpc/sub_account_summary.md): Get one sub-account's balances, positions, margin and P&L. - [spot_account_summary](/reference/rpc/spot_account_summary.md): Get the total equity and spot balances of one spot sub-account. - [funding_payment_history](/reference/rpc/funding_payment_history.md): List the funding payments a sub-account paid or received, newest first. - [interest_payment_history](/reference/rpc/interest_payment_history.md): List the hourly interest charged to a multi-asset-mode sub-account, newest first. - [deposit_history](/reference/rpc/deposit_history.md): List past deposits into your main account, newest first; pending ones have no `confirmed_time` yet. - [transfer](/reference/rpc/transfer.md): Move funds between your main account and its sub-accounts, or to an allowlisted main account. - [transfer_history](/reference/rpc/transfer_history.md): List past transfers, newest first, optionally by currency, transfer type or time. - [get_withdrawal_fee](/reference/rpc/get_withdrawal_fee.md): Get the flat fee for withdrawing to Ethereum, in the currency you ask for. - [withdrawal](/reference/rpc/withdrawal.md): Withdraw funds from Grvt to an Ethereum address. - [withdrawal_history](/reference/rpc/withdrawal_history.md): List past withdrawals from your main account, newest first; pending ones have no `l_1_hash` yet. - [vault_investor_summary](/reference/rpc/vault_investor_summary.md): Get your investment summary for one vault. - [vault_conversion_rate](/reference/rpc/vault_conversion_rate.md): Get the best exchange rate the gateway accepts now for a vault investment or redemption that converts currency. - [vault_invest](/reference/rpc/vault_invest.md): Invest in a vault from your main account or a sub-account, converting currency if needed. - [vault_redeem](/reference/rpc/vault_redeem.md): Redeem vault shares, paid in the vault's currency or converted into another one. - [vault_redeem_cancel](/reference/rpc/vault_redeem_cancel.md): Cancel your pending redemption from a vault. - [vault_manager_investment_history](/reference/rpc/vault_manager_investment_history.md): List the investor history of a vault you manage. Only for vault managers. Other accounts get error 1001. - [vault_redemption_queue](/reference/rpc/vault_redemption_queue.md): View the redemption queue of a vault you manage, highest priority first. Only for vault managers. Other accounts get error 1001. - [vault_burn_tokens](/reference/rpc/vault_burn_tokens.md): Burn a number of a vault's tokens. Only for vault managers. Other accounts get error 1001. - [get_authorized_builders](/reference/rpc/get_authorized_builders.md): List the builders you have authorized and the highest fee rate each may charge. - [builder_fill_history](/reference/rpc/builder_fill_history.md): List the fills you earned builder fees on, as a builder, newest first. Only for builders. Other accounts get an empty list. - [get_all_instruments](/reference/rpc/get_all_instruments.md): List all instruments, optionally only active ones or only some kinds. - [get_filtered_instruments](/reference/rpc/get_filtered_instruments.md): List instruments filtered by kind, base or quote currency. - [get_instrument](/reference/rpc/get_instrument.md): Get one instrument's details (tick size, minimum size, decimals, instrument hash) by name. - [get_currency](/reference/rpc/get_currency.md): List every currency with its id and decimals. - [get_supported_assets](/reference/rpc/get_supported_assets.md): List the currencies each wallet type (funding, spot, futures) supports. - [mini_ticker](/reference/rpc/mini_ticker.md): Get a mini ticker for one instrument (mark, index, last and mid price, best bid and ask). - [ticker](/reference/rpc/ticker.md): Get a full ticker for one instrument (prices, 24-hour statistics, funding, open interest). - [orderbook_levels](/reference/rpc/orderbook_levels.md): Get one instrument's order book, up to 10 price levels a side. - [trade](/reference/rpc/trade.md): Get the most recent public trades of one instrument (up to 1000). - [trade_history](/reference/rpc/trade_history.md): List an instrument's public trades over a time range (last three months), newest first. - [candlestick](/reference/rpc/candlestick.md): List candles (klines) for one instrument and interval, newest first. - [funding_rate](/reference/rpc/funding_rate.md): List a perpetual's past funding rates, newest first. - [get_sfp_trading_schedule](/reference/rpc/get_sfp_trading_schedule.md): Get the trading hours of stable funding perps (`_SFP` instruments). - [get_margin_rules](/reference/rpc/get_margin_rules.md): Get one instrument's margin rules (maximum position size and risk brackets). - [get_all_collateral_asset_info](/reference/rpc/get_all_collateral_asset_info.md): List the collateral settings of every currency that can be used as collateral. - [All calls](/reference/index.md): Every call and stream on one page, by server and category: what it does, its HTTP path and whether it needs a session. ## Streams - [order_stream](/reference/streams/order.md) (stream `v1.order`): Stream your orders in full, one frame each time one is created or changes. - [order_state_stream](/reference/streams/order_state.md) (stream `v1.state`): Stream only the state of your orders (status, filled size, average price), lighter than the order stream. - [fill_stream](/reference/streams/fill.md) (stream `v1.fill`): Stream your own fills (private trades), one frame per fill. - [cancel_status_stream](/reference/streams/cancel_status.md) (stream `v1.cancel`): Stream the outcome of your cancel requests. - [algo_order_stream](/reference/streams/algo_order.md) (stream `v1.algo.order`): Stream your algo orders, one frame each time one is created or updated. - [rfq_quote_stream](/reference/streams/rfq_quote.md) (stream `v1.quote`): Stream the average fill price for your open RFQ's size on each side of the book, as the taker. - [positions_stream](/reference/streams/positions.md) (stream `v1.position`): Stream your positions, one frame each time a position is opened or changes. - [deposit_stream](/reference/streams/deposit.md) (stream `v1.deposit`): Stream deposits into your main account. - [transfer_stream](/reference/streams/transfer.md) (stream `v1.transfer`): Stream transfers into or out of your main account, or of one of its sub-accounts. - [withdrawal_stream](/reference/streams/withdrawal.md) (stream `v1.withdrawal`): Stream withdrawals from your main account. - [mini_ticker_snap_stream](/reference/streams/mini_ticker_snap.md) (stream `v1.mini.s`): Stream full mini tickers for one instrument at a fixed rate; every frame has every field. - [mini_ticker_delta_stream](/reference/streams/mini_ticker_delta.md) (stream `v1.mini.d`): Stream mini ticker changes for one instrument; a full mini ticker first, then only changed fields. - [ticker_snap_stream](/reference/streams/ticker_snap.md) (stream `v1.ticker.s`): Stream full tickers for one instrument at a fixed rate; every frame has every field. - [ticker_delta_stream](/reference/streams/ticker_delta.md) (stream `v1.ticker.d`): Stream ticker changes for one instrument; a full ticker first, then only the fields that changed. - [orderbook_snap_stream](/reference/streams/orderbook_snap.md) (stream `v1.book.s`): Stream full order book snapshots for one instrument at a fixed depth (10 to 500 levels a side). - [orderbook_delta_stream](/reference/streams/orderbook_delta.md) (stream `v1.book.d`): Stream order book changes for one instrument; a full book first, then only the levels that changed. - [trade_stream](/reference/streams/trade.md) (stream `v1.trade`): Stream every public trade of one instrument as it happens. - [candlestick_stream](/reference/streams/candlestick.md) (stream `v1.candle`): Stream candles for one instrument and interval as they update. ## Signing and reference - [AddIsolatedPositionMargin (signed message)](/reference/signing/AddIsolatedPositionMargin.md): EIP-712 type AddIsolatedPositionMargin: fields, type hash and how each field is built from the request JSON. - [Order (signed message)](/reference/signing/Order.md): EIP-712 type Order: fields, type hash and how each field is built from the request JSON. - [OrderWithBuilderFee (signed message)](/reference/signing/OrderWithBuilderFee.md): EIP-712 type OrderWithBuilderFee: fields, type hash and how each field is built from the request JSON. - [SetDeriskToMaintenanceMarginRatio (signed message)](/reference/signing/SetDeriskToMaintenanceMarginRatio.md): EIP-712 type SetDeriskToMaintenanceMarginRatio: fields, type hash and how each field is built from the request JSON. - [SetSubAccountPositionMarginConfig (signed message)](/reference/signing/SetSubAccountPositionMarginConfig.md): EIP-712 type SetSubAccountPositionMarginConfig: fields, type hash and how each field is built from the request JSON. - [Transfer (signed message)](/reference/signing/Transfer.md): EIP-712 type Transfer: fields, type hash and how each field is built from the request JSON. - [TransferV2 (signed message)](/reference/signing/TransferV2.md): EIP-712 type TransferV2: fields, type hash and how each field is built from the request JSON. - [TransferV3 (signed message)](/reference/signing/TransferV3.md): EIP-712 type TransferV3: fields, type hash and how each field is built from the request JSON. - [VaultBurnLpToken (signed message)](/reference/signing/VaultBurnLpToken.md): EIP-712 type VaultBurnLpToken: fields, type hash and how each field is built from the request JSON. - [VaultInvestV3 (signed message)](/reference/signing/VaultInvestV3.md): EIP-712 type VaultInvestV3: fields, type hash and how each field is built from the request JSON. - [VaultRedeemV3 (signed message)](/reference/signing/VaultRedeemV3.md): EIP-712 type VaultRedeemV3: fields, type hash and how each field is built from the request JSON. - [WalletLogin (signed message)](/reference/signing/WalletLogin.md): EIP-712 type WalletLogin: fields, type hash and how each field is built from the request JSON. - [Withdrawal (signed message)](/reference/signing/Withdrawal.md): EIP-712 type Withdrawal: fields, type hash and how each field is built from the request JSON. - [WithdrawalV2 (signed message)](/reference/signing/WithdrawalV2.md): EIP-712 type WithdrawalV2: fields, type hash and how each field is built from the request JSON. - [Error codes](/reference/errors.md): Every gateway error code with its HTTP status, message and whether a retry can help. - [Types](/reference/types.md): Every request, response, frame and nested object type with its fields. RPC and stream pages expand these inline. - [Enums](/reference/enums.md): Every enum: the value names sent on the wire and the integer codes used when signing. - [Signed messages](/reference/signing/index.md): Which EIP-712 message each signed call uses, and when to use each version.