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):
| Field | Type | Description |
|---|---|---|
markets | Market[] | Array of available markets (BTC, ETH, etc). |
tokens | Token[] | 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):
| Field | Type | Description |
|---|---|---|
indexPrice | number | Current index price from oracle. |
perpStats.mark_price | number | Current mark price of the perpetual. |
perpStats.funding_rate | number | Current funding rate. |
perpStats.open_interest | number | Total open interest in base units. |
volumeQuote24h | number | 24-hour trading volume in USDC. |
getOrderbook
Retrieves the current orderbook for a market.
Signature:
getOrderbook({ symbol?: string, marketId?: number }): Promise<OrderbookResponse>Response (OrderbookResponse):
| Field | Type | Description |
|---|---|---|
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:
| Name | Type | Description |
|---|---|---|
marketId | number | (Optional) Filter by market. |
makerId | number | (Optional) Filter by maker account ID. |
takerId | number | (Optional) Filter by taker account ID. |
pageSize | number | (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