Skip to main content

Trading Pairs

(params?) => Promise<GetTradingPairsResponse>
Fetch paginated list of trading pairs.Returns: { tradingPairs: TradingPair[], page, pageSize, total, totalPages }
(symbol: string) => Promise<TradingPair | undefined>
Get a specific trading pair by symbol. Resolves undefined on a miss (never throws), so guard the result before dereferencing. The hook forwards only symbol; to disambiguate a symbol listed in both SPOT and MARGIN, call sdk.market.getTradingPairBySymbol(symbol, marketType) on the core SDK directly.

Market Data

(tradingPairId: string, interval: Interval, params?: GetCandlesticksParams) => Promise<Candlestick[]>
Fetch OHLCV candlestick data for a trading pair.Parameters:
  • tradingPairId: string - Trading pair UUID (use getTradingPairBySymbol to get this)
  • interval: "1m" | "5m" | "15m" | "1h" | "4h" | "1d"
  • params?: Optional query parameters
    • startTime?: number - Unix timestamp in ms
    • endTime?: number - Unix timestamp in ms
    • limit?: number - Max candlesticks (default: 350, max: 500)
    • priceType?: "trade" | "mark" - price series to chart. "trade" (default) is the trade-derived OHLCV series; "mark" is the close-only mark-price series for margin pairs (each candle’s open/high/low/close are the minute’s closing mark, volume 0). "mark" on a spot pair returns a 400
Example:
(pairId: string) => Promise<MarketMetadata>
Fetch market metadata for a trading pair including current price, volume, and statistics.Parameters:
  • pairId: string - Trading pair UUID
Returns: MarketMetadata object with market statistics
Important: All market metadata fields are nullable. Markets without trade history will return null for price and volume fields.
Fields (all nullable):
  • lastPrice: string | null - Most recent trade price (null if no trades)
  • lastPriceTimestamp: number | null - Timestamp of last trade
  • high24h: string | null - 24-hour high price (null if insufficient data)
  • low24h: string | null - 24-hour low price (null if insufficient data)
  • volume24h: string | null - 24-hour trading volume in base-asset units (null if insufficient data)
  • quoteVolume24h?: string | null - 24-hour trading volume in quote-token (USDC) units
  • priceChange24h: string | null - 24-hour price change
  • priceChangePercent24h: string | null - 24-hour price change percentage
  • marketInitializationTimestamp: number | null - When market was initialized
Example with null checks:

Perp Market Data

For margin concepts, see Margin. For full type shapes, see the TypeScript Market reference.
(tradingPairId: string) => Promise<PerpMarketConfig>
Static perp config: minLeverage, maxLeverage, base initial/maintenance margin ratios, fundingIntervalSeconds, riskTiers, liquidationFeeBps.
(tradingPairId: string) => Promise<PerpMarketSummary>
Aggregate snapshot: markPrice, indexPrice, 24h stats (base-asset volume24h and quote-token quoteVolume24h), openInterest (base-asset, alias of openInterestBase), openInterestBase, openInterestNotional (base × mark, in quote units), currentFundingRate, nextFundingTime.
(tradingPairId: string) => Promise<MarkPrice>
Live mark price (oracle reference). Returns { markPrice, oracleProvider, regime, updatedAt, ... }.
(tradingPairId: string) => Promise<IndexPrice>
Live index price with provider components. Returns { indexPrice, components: IndexComponent[], updatedAt }.
(tradingPairId: string) => Promise<FundingState>
Current and estimated next funding rate plus settlement time.
(tradingPairId: string, params?: ListFundingHistoryParams) => Promise<ListFundingHistoryResponse>
Historical funding payments. Pagination via page/pageSize, optional startTime/endTime.
(tradingPairId: string) => Promise<OpenInterest>
Current open interest in base-asset units and notional.
Example — funding countdown: