Skip to Content
API ReferenceMarket Data & Info

Market Data & Info (Nord Client)

The Nord class (Client) is used to interact with public endpoints of the Nord protocol. It does not require a user session for most operations.

Initialization

import { Nord } from "@n1xyz/nord-ts"; const nord = await Nord.new({ webServerUrl: "https://zo-mainnet.n1.xyz", solanaConnection: connection, // @solana/web3.js Connection app: APP_PUBLIC_KEY, });

REST Endpoints

getInfo

Returns comprehensive information about all available markets and tokens.

Signature:

getInfo(): Promise<MarketsInfo>

Response (MarketsInfo):

FieldTypeDescription
marketsMarket[]Array of available markets (BTC, ETH, etc).
tokensToken[]Array of available tokens and their metadata.

getMarketStats

Fetches detailed statistics for a specific market, including funding rates and price info.

Signature:

getMarketStats({ marketId: number }): Promise<MarketStats>

Response (MarketStats):

FieldTypeDescription
indexPricenumberCurrent index price from oracle.
perpStats.mark_pricenumberCurrent mark price of the perpetual.
perpStats.funding_ratenumberCurrent funding rate.
perpStats.open_interestnumberTotal open interest in base units.
volumeQuote24hnumber24-hour trading volume in USDC.

getOrderbook

Retrieves the current orderbook for a market.

Signature:

getOrderbook({ symbol?: string, marketId?: number }): Promise<OrderbookResponse>

Response (OrderbookResponse):

FieldTypeDescription
bids[price, size][]Array of bids (buy orders).
asks[price, size][]Array of asks (sell orders).

getTrades

Retrieves recent trade history for a market or account.

Arguments:

NameTypeDescription
marketIdnumber(Optional) Filter by market.
makerIdnumber(Optional) Filter by maker account ID.
takerIdnumber(Optional) Filter by taker account ID.
pageSizenumber(Optional) Max trades to return.

WebSockets (Real-time)

subscribeOrderbook

Subscribes to live orderbook updates.

const sub = nord.subscribeOrderbook("BTCUSDC"); sub.on("update", (data) => { console.log("Orderbook Update:", data); });

subscribeTrades

Subscribes to live trade events.

const sub = nord.subscribeTrades("BTCUSDC"); sub.on("trade", (trade) => { console.log("New Trade:", trade); });
Last updated on