Skip to main content

Installation

# yarn
yarn add @lifi/perps-sdk

# pnpm
pnpm add @lifi/perps-sdk

# npm
npm install @lifi/perps-sdk

# bun
bun add @lifi/perps-sdk

Configuration

Initialize the Perps SDK client:
import { createPerpsClient, DEFAULT_API_URL } from '@lifi/perps-sdk';

// Initialize the perps client
const client = createPerpsClient({
  integrator: 'your-app-name',
  apiKey: 'your-api-key',
});
The SDK targets DEFAULT_API_URL (https://develop.li.quest/v1/perps) by default. Override with apiUrl if needed:
const client = createPerpsClient({
  integrator: 'your-app-name',
  apiKey: 'your-api-key',
  apiUrl: 'https://develop.li.quest/v1/perps',
});
Get your integrator name and API key from the LI.FI Partner Portal. Both are required for API access.

Quick Start

Fetch available DEXes and markets:
import { createPerpsClient, getDexes, getMarkets, getPrices } from '@lifi/perps-sdk';

const client = createPerpsClient({
  integrator: 'your-app-name',
  apiKey: 'your-api-key',
});

// List available DEXes
const { dexes } = await getDexes(client);
console.log(dexes.map((d) => d.name)); // ['Hyperliquid', ...]

// List markets on a DEX
const { markets } = await getMarkets(client, { dex: 'hyperliquid' });
console.log(markets.map((m) => m.symbol)); // ['BTC', 'ETH', 'SOL', ...]

// Get current prices
const { prices } = await getPrices(client, { dex: 'hyperliquid' });
console.log(prices); // { BTC: '95000.50', ETH: '3200.25', ... }
For a complete end-to-end example including wallet setup, authorization, and placing an order, see SDK / Trading.

Next steps