Quick Start

This guide walks through the basic operations: reading market data, placing orders, and subscribing to real-time updates.

Environment Setup

GRVT provides multiple environments for testing and production:

Environment
Value
Chain ID
Description

Production

GrvtEnv.PROD

325

Live trading

Testnet

GrvtEnv.TESTNET

326

Testing with testnet funds

Staging

GrvtEnv.STG

328

Internal staging

Development

GrvtEnv.DEV

327

Internal development

circle-info

Use `GrvtEnv.TESTNET` for development and testing. Switch to `GrvtEnv.PROD` only for production trading.

Reading Market Data

Market data is publicly available without authentication:

import { GrvtEnv, GrvtRawClient } from "@wezzcoetzee/grvt";

const client = new GrvtRawClient({
  env: GrvtEnv.TESTNET,
});

// Get all active instruments
const instruments = await client.getAllInstruments({ is_active: true });
console.log("Instruments:", instruments.result.map((i) => i.instrument));

// Get ticker for a specific instrument
const ticker = await client.getTicker({ instrument: "BTC_USDT_Perp" });
console.log("Last price:", ticker.result.last_price);
console.log("Mark price:", ticker.result.mark_price);

// Get orderbook
const orderbook = await client.getOrderbookLevels({
  instrument: "BTC_USDT_Perp",
  depth: 10,
});
console.log("Best bid:", orderbook.result.bids[0]);
console.log("Best ask:", orderbook.result.asks[0]);

Placing Orders

Order placement requires authentication via API key and order signing via private key:

1

Get API Key

Generate an API key from your GRVT account dashboard.

2

Initialize Client

3

Load Markets

Markets must be loaded before placing orders (required for order signing):

4

Place Order

WebSocket Subscriptions

For real-time data, use the WebSocket transport (available on production):

circle-exclamation

Complete Example

Here's a complete example combining market data, order placement, and position monitoring:

Next Steps

Last updated