Developers

Migrating from grvt-pysdk

How calls in the old Python SDK (GrvtRaw*, GrvtCcxt*) map to the new SDK, with a short note for the old JS client.

On this page

The old SDKs (grvt-pysdk, @grvt/client, @grvt/sdk) are replaced, not wrapped. The new SDK is generated from the same contract as these docs, so every method name matches a reference page.

What changes

OldNew
ClientGrvtRawSync(config), GrvtRawAsync, GrvtCcxt, GrvtCcxtProGrvt(env) (blocking) or AsyncGrvt(env)
Method namesget_all_instruments_v1(ApiGetAllInstrumentsRequest(...)), ccxt fetch_ticker("BTC_USDT_Perp")client.get_all_instruments(...): client.<method>, request fields as keyword args
EnvironmentGrvtEnv.TESTNET + endpoint configenv="testnet" (or your own Environment)
Signinggrvt_raw_signing / ccxt utils, called by youautomatic for signed calls when you pass signer=PrivateKeySigner(key)
Field namesfull names, plus a lite variantfull names in your code; lite on the wire by default (encoding)
Numbersfloats in places (ccxt)decimal strings and quoted 64-bit ints, as on the wire
ErrorsGrvtError dataclass returned in place of a resultexceptions: ApiError, RateLimitError, TransportError, OrderStateUnknown
Retriesvariedreads retried, writes never (why)
StreamsGrvtCcxtWS.subscribe(stream, callback)async with client.<stream>_stream(...) as sub: async for frame in sub
Sequence gapshandled by youdetected and re-synced by the SDK

Side by side

Old (raw, sync):

api = GrvtRawSync(GrvtApiConfig(env=GrvtEnv.TESTNET, trading_account_id=..., private_key=..., api_key=...))
resp = api.get_all_instruments_v1(types.ApiGetAllInstrumentsRequest(is_active=True))

New:

from grvt import Grvt

with Grvt(env="testnet") as client:
    resp = client.get_all_instruments(is_active=True)
    print(len(resp.result or []))

Old (ccxt-style order):

api = GrvtCcxt(env=GrvtEnv.TESTNET, parameters={"api_key": ..., "trading_account_id": ..., "private_key": ...})
api.create_order(symbol="BTC_USDT_Perp", order_type="limit", side="buy", amount=0.01, price=64000)

New: build the order with the wire fields (time_in_force, legs[].size, legs[].limit_price, legs[].is_buying_asset) as in create_order. There is no ccxt layer; use CCXT itself if you want one.

Method name lookup

The old raw method foo_v1 usually becomes client.foo. When it does not, search llms.txt or the API reference for the HTTP path you used (e.g. /full/v1/all_instruments); each page shows its SDK method.

From the old JS client

@grvt/client and @grvt/sdk had two clients: new GRVT.MDG({host}) for market data and new GRVT.TDG(...) for trading. The TypeScript SDK replaces both with one client, new Grvt({ env: "testnet" }). Its methods follow the same reference pages as the Python names above, in camelCase.

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