Developers

Overview

What the Grvt API is, how it is laid out, and where to start.

On this page

Grvt is a crypto derivatives exchange. Its API lets you read market data, trade and move funds, with an SDK (Python, TypeScript, Go or Rust) or with plain HTTP and WebSocket calls.

Preview. The SDKs are in preview: any 0.x release can change them. The HTTP and WebSocket API is not affected.

Start here

To place your first order on testnet (the test exchange, with free funds):

  1. Install the SDK from your SDK's page (Python, TypeScript, Go, Rust), then run the Quickstart: one example reads market data, then one places and cancels an order.
  2. Back on your SDK's page: create a client, then place, track and cancel an order.
  3. Errors and retries: what to do when a call fails, above all when you don't know whether an order was placed.

Read these when you need them: Environments (testnet or production), Authentication, Accounts and permissions and Rate limits.

Advanced: WebSocket protocol details, Recovery recipes, Signing by hand, and the C++ signing core and reference: C++ has no client, so your app handles networking, sessions, streams and recovery itself.

Topics: Strategies, Stable funding perps (SFP), Builders, Deposits and withdrawals and Referrals.

Other ways in:

Glossary

TermWhat it is
Main accountYour account on Grvt, identified by a 0x address (main_account_id). Deposits arrive here and withdrawals leave from here; it does not trade. The Grvt web app calls it the Funding Account, and some calls say "funding account".
Sub-accountA trading account under your main account, identified by a number, the sub-account ID (sub_account_id). Orders, positions and margin live here. The Grvt web app calls it a Trading Account. Move funds between the main account and its sub-accounts with transfer.
API keyLogs you in: exchanged for a session (Authentication).
Signing keySigns orders, transfers and withdrawals and never leaves your machine (Two keys, two jobs).
SessionThe gravity cookie and X-Grvt-Account-Id header a login returns. Every call to the trading host sends them.

How the API is laid out

PartHostWhat it does
Market datamarket-data.<domain>Instruments, tickers, order books, trades, candles. Public, no login.
Tradingtrades.<domain>Orders, positions, fills, accounts, transfers. Needs a session.
Edgeedge.<domain>Login (API key or wallet signature).

<domain> is testnet.grvt.io or grvt.io (Environments).

The market data and trading hosts speak the same two protocols:

  • HTTP: POST /full/v1/<route> with a JSON body. The response body is the result object.
  • WebSocket: JSON-RPC 2.0 on /ws/full. Every RPC works here too (method: "v1/<route>"), and streams are subscribed with method: "subscribe".

Writes that move money or create orders carry an EIP-712 signature made with your signing key. The SDKs sign for you; Signing explains the bytes if you sign yourself.

Contract and signing test cases

The reference pages and the SDKs are generated from the same API contract (contract.json), so they agree on names and types. signing.json holds signing test cases to check your own signing code against.

esc

↑ ↓ move↵ open⇧↵ open .mdTry an error code like 2002

Keyboard shortcuts

⌘ K
Search the docs
/
Search
l
Next code language (Python → TypeScript → Go → Rust → curl → WebSocket)
j / k
Next / previous page
t
Light / dark theme
?
This help
Esc
Close dialogs and drawers