Perp DEX All-In-One SDK - Unified TypeScript SDK for Decentralized Perpetual Exchanges
νκ΅μ΄ λ¬Έμ | English
npm install pd-aio-sdkimport { createExchange } from 'pd-aio-sdk';
// 1. Fetch market data (no auth needed)
const hl = await createExchange('hyperliquid', { testnet: true });
await hl.initialize();
const ticker = await hl.fetchTicker('ETH/USDT:USDT');
console.log(`ETH Price: $${ticker.last}`);
// 2. Place a trade (with auth)
const exchange = await createExchange('hyperliquid', {
privateKey: process.env.PRIVATE_KEY,
testnet: true,
});
await exchange.initialize();
const order = await exchange.createOrder({
symbol: 'ETH/USDT:USDT',
side: 'buy',
type: 'limit',
amount: 0.1,
price: 3000,
});20 exchanges, one interface. Swap
'hyperliquid'for any supported exchange β the API stays the same.
PD AIO SDK (Perp DEX All-In-One SDK) is a production-ready, unified TypeScript SDK that lets you trade on 20 decentralized perpetual exchanges through a single, consistent interface. No more learning different APIs for each exchange - write once, trade anywhere.
- One Interface β 20 Exchanges (Hyperliquid, GRVT, Paradex, EdgeX, Backpack, Lighter, Nado, Extended, Variational, dYdX, Jupiter, Drift, GMX, Aster, Pacifica, Ostium, Reya, Ethereal, Avantis, Katana)
- One Codebase β All Trading Operations (market data, orders, positions, WebSocket)
- One Installation β Full-Stack Solution (authentication, rate limiting, error handling)
- CCXT-style API - Familiar interface for developers
- Fully Async/Await - All methods return Promises, no callbacks
- Consistent method names across all exchanges
- Python aliases available (snake_case for Python developers)
| Exchange | Status | Markets | Auth | Notes |
|---|---|---|---|---|
| Hyperliquid | β Verified | 229 perp | EIP-712 | Full API + WebSocket |
| EdgeX | β Verified | 292 perp | StarkNet ECDSA | No REST tradesΒΉ |
| Paradex | β Verified | 95 perp | StarkNet + JWT | OB requires auth |
| GRVT | β Verified | 95 perp | API Key + EIP-712 | Sub-ms latency |
| Backpack | β Verified | 159 perp+spot | ED25519 | Solana-based |
| Lighter | β Verified | 156 perp | WASM Signing | Cross-platform |
| Nado | β Verified | 44 perp+spot | EIP-712 (Ink L2) | No REST tradesΒΉ |
| Extended | β Verified | 114 perp | API Key | StarkNet DEX |
| Variational | β Verified | 470 RFQ | API Key | No WebSocket |
| dYdX v4 | β Verified | 293 perp | Cosmos SDK | Full trading + WebSocket |
| Jupiter Perps | β Verified | 3 perp | Solana Wallet | Oracle-based, no OBβ΄ |
| Drift Protocol | β Verified | 41 perp | Solana Wallet | DLOB + WebSocket |
| GMX v2 | β Verified | 129 markets | On-chain | Oracle-based, no OBβ΄ |
| Aster | β Verified | 304 perp | HMAC-SHA256 | Full API + OHLCV |
| Pacifica | β Verified | 59 perp | ED25519 | Solana-based |
| Ostium | β Verified | 11 RWA perp | ethers.js | Oracle-based, no OBβ΄ |
| Reya | β Verified | 69 perp | EIP-712 | Oracle/pool-based, no OBβ΄ |
| Ethereal | β Verified | 15 perp | EIP-712 | USDe collateral |
| Avantis | π‘ Partial | On-chain | Wallet Signing | Needs contract addressesβ΅ |
| Katana | β Verified | Cross | HMAC + EIP-712 | Katana L2, vbUSDC collateral |
ΒΉ Use
watchTrades()for real-time trade data Β² GMX trading requires on-chain transactions via ExchangeRouter contract Β³ Ostium specializes in RWA (Real World Assets) perpetuals: stocks, forex, commodities, indices β΄ Oracle/AMM-based DEX β no traditional orderbook β΅ Avantis requires real Base mainnet contract addresses (on-chain protocol)
- β Fully implemented
β οΈ Partial (has limitations)- β Not implemented
| Method | Backpack | EdgeX | Extended | GRVT | Hyperliquid | Lighter | Nado | Paradex | Variational | dYdX | Jupiter | Drift | GMX | Aster | Pacifica | Ostium |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| fetchMarkets | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| fetchTicker | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| fetchOrderBook | β | β | β | β | β | β | β | β | β | β | β | β | ββ΅ | β | β | β |
| fetchTrades | β | βΒΉ | β | β | β | β | β | β | β | β | β | β | β | β | ||
| fetchOHLCV | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| fetchFundingRate | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | |
| fetchFundingRateHistory | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| Method | Backpack | EdgeX | Extended | GRVT | Hyperliquid | Lighter | Nado | Paradex | Variational | dYdX | Jupiter | Drift | GMX | Aster | Pacifica | Ostium |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| createOrder | β | β | β | β | β | β | β | β | β | β | β | β | ββΆ | β | β | β |
| cancelOrder | β | β | β | β | β | β | β | β | β | β | β | β | ββΆ | β | β | β |
| cancelAllOrders | β | β | β | β | β | β | β | β | β | β | β | β | ββΆ | β | β | β |
| createBatchOrders | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | |
| cancelBatchOrders | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | |
| editOrder | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| Method | Backpack | EdgeX | Extended | GRVT | Hyperliquid | Lighter | Nado | Paradex | Variational | dYdX | Jupiter | Drift | GMX | Aster | Pacifica | Ostium |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| fetchPositions | β | β | β | β | β | β | β | β | β | β | β | β | ββ· | β | β | β |
| fetchBalance | β | β | β | β | β | β | β | β | β | β | β | β | ββ· | β | β | β |
| fetchOrderHistory | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| fetchMyTrades | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| fetchUserFees | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| fetchPortfolio | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| setLeverage | β | β | β | β | β | β | β | β | β | β | β | β | ββΈ | β | β | β |
| setMarginMode | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| Method | Backpack | EdgeX | Extended | GRVT | Hyperliquid | Lighter | Nado | Paradex | Variational | dYdX | Jupiter | Drift | GMX | Aster | Pacifica | Ostium |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| watchOrderBook | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| watchTrades | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| watchTicker | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| watchPositions | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| watchOrders | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| watchBalance | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| watchMyTrades | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| watchFundingRate | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β | β |
| Adapter | Public | Trading | Account | WebSocket | Total |
|---|---|---|---|---|---|
| Extended | 6/7 (86%) | 6/6 (100%) | 8/8 (100%) | 7/8 (88%) | 93% |
| dYdX v4 | 7/7 (100%) | 5/6 (83%) | 5/8 (63%) | 7/8 (88%) | 83% |
| Hyperliquid | 6/7 (86%) | 5/6 (83%) | 7/8 (88%) | 6/8 (75%) | 83% |
| Drift | 6/7 (86%) | 3/6 (50%) | 5/8 (63%) | 7/8 (88%) | 72% |
| GRVT | 6/7 (86%) | 4/6 (67%) | 5/8 (63%) | 6/8 (75%) | 72% |
| Paradex | 5/7 (71%) | 3/6 (50%) | 6/8 (75%) | 7/8 (88%) | 71% |
| Backpack | 5/7 (71%) | 3/6 (50%) | 5/8 (63%) | 6/8 (75%) | 65% |
| Lighter | 5/7 (71%) | 3/6 (50%) | 5/8 (63%) | 6/8 (75%) | 65% |
| Nado | 4/7 (57%) | 4/6 (67%) | 5/8 (63%) | 5/8 (63%) | 62% |
| EdgeX | 4/7 (57%) | 5/6 (83%) | 4/8 (50%) | 6/8 (75%) | 62% |
| Jupiter | 5/7 (71%) | 3/6 (50%) | 3/8 (38%) | 0/8 (0%) | 38% |
| Variational | 4/7 (57%) | 5/6 (83%) | 4/8 (50%) | 0/8 (0%) | 45% |
| GMX v2 | 5/7 (71%) | 0/6 (0%) | 0/8 (0%) | 0/8 (0%) | 17% |
| Aster | 7/7 (100%) | 3/6 (50%) | 4/8 (50%) | 0/8 (0%) | 48% |
| Pacifica | 5/7 (71%) | 3/6 (50%) | 4/8 (50%) | 0/8 (0%) | 41% |
| Ostium | 3/7 (43%) | 3/6 (50%) | 3/8 (38%) | 0/8 (0%) | 31% |
Notes:
- ΒΉ EdgeX: No REST endpoint for trades
- Β² Hyperliquid: REST returns empty, use WebSocket
- Β³ Nado: REST available but limited, prefer WebSocket
- β΄ Variational: Batch operations are emulated (sequential)
- β΅ GMX: AMM-based, no traditional orderbook
- βΆ GMX: Trading requires on-chain transactions via ExchangeRouter
- β· GMX: Requires subgraph or RPC integration
- βΈ dYdX/Jupiter/Drift/GMX: Leverage is per-position at order time
See docs/CAPABILITY_MATRIX.md β auto-generated from each adapter's has field.
Regenerate after adding or modifying adapters:
npm run gen:capability-matrix- WebSocket streaming - Real-time data with backpressure handling
- Auto-reconnection - Exponential backoff with subscription recovery
- Rate limiting - Exchange-specific limits respected automatically
- Retry logic - Automatic retry with exponential backoff
- Circuit breaker - Fault tolerance with automatic recovery
- Request tracing - Correlation IDs for distributed debugging
- Type safety - Runtime validation (Zod) + TypeScript strict mode
- Health checks - Prometheus metrics, structured JSON logging
- 6908 tests - 100% pass rate, 85% coverage enforced
npm install pd-aio-sdk
# or
yarn add pd-aio-sdk
# or
pnpm add pd-aio-sdkimport { createExchange } from 'pd-aio-sdk';
// Initialize adapter (no auth needed for public API)
const exchange = await createExchange('hyperliquid', { testnet: true });
await exchange.initialize();
// Fetch market data (Public API - no credentials needed)
const markets = await exchange.fetchMarkets();
const orderBook = await exchange.fetchOrderBook('BTC/USDT:USDT');
const ticker = await exchange.fetchTicker('BTC/USDT:USDT');
console.log(`Found ${markets.length} markets`);
console.log(`BTC price: ${ticker.last}`);import { createExchange } from 'pd-aio-sdk';
// Initialize with credentials for private API
const exchange = await createExchange('hyperliquid', {
privateKey: process.env.HYPERLIQUID_PRIVATE_KEY,
testnet: true
});
await exchange.initialize();
// Place an order (requires authentication)
const order = await exchange.createOrder({
symbol: 'BTC/USDT:USDT',
type: 'limit',
side: 'buy',
amount: 0.1,
price: 50000
});
// Check positions and balance
const positions = await exchange.fetchPositions();
const balances = await exchange.fetchBalance();
// Cancel order
await exchange.cancelOrder(order.id, 'BTC/USDT:USDT');
// Cleanup
await exchange.disconnect();// Hyperliquid (EIP-712)
const hl = await createExchange('hyperliquid', {
privateKey: process.env.HYPERLIQUID_PRIVATE_KEY,
testnet: true
});
// EdgeX (StarkNet ECDSA)
const edgex = await createExchange('edgex', {
starkPrivateKey: process.env.EDGEX_STARK_PRIVATE_KEY
});
// Paradex (StarkNet + JWT)
const paradex = await createExchange('paradex', {
starkPrivateKey: process.env.PARADEX_STARK_PRIVATE_KEY,
testnet: true
});
// GRVT (API Key + EIP-712)
const grvt = await createExchange('grvt', {
apiKey: process.env.GRVT_API_KEY,
testnet: false
});
// Backpack (ED25519)
const backpack = await createExchange('backpack', {
apiKey: process.env.BACKPACK_API_KEY,
apiSecret: process.env.BACKPACK_API_SECRET
});
// Lighter (WASM Signing) - cross-platform, no native dependencies
const lighter = await createExchange('lighter', {
apiPrivateKey: process.env.LIGHTER_PRIVATE_KEY,
testnet: true
});
// Nado (EIP-712 on Ink L2)
const nado = await createExchange('nado', {
privateKey: process.env.NADO_PRIVATE_KEY,
testnet: true
});
// Extended (API Key) - mainnet only
const extended = await createExchange('extended', {
apiKey: process.env.EXTENDED_API_KEY
});
// Variational (API Key) - no WebSocket
const variational = await createExchange('variational', {
apiKey: process.env.VARIATIONAL_API_KEY,
apiSecret: process.env.VARIATIONAL_API_SECRET,
testnet: true
});
// dYdX v4 (Cosmos SDK)
const dydx = await createExchange('dydx', {
mnemonic: process.env.DYDX_MNEMONIC, // 24-word seed phrase
testnet: true
});
// Jupiter Perps (Solana)
const jupiter = await createExchange('jupiter', {
walletAddress: process.env.JUPITER_WALLET_ADDRESS,
privateKey: process.env.JUPITER_PRIVATE_KEY, // Optional, for trading
});
// Drift Protocol (Solana)
const drift = await createExchange('drift', {
walletAddress: process.env.DRIFT_WALLET_ADDRESS,
privateKey: process.env.DRIFT_PRIVATE_KEY, // Optional, for trading
});
// GMX v2 (Arbitrum/Avalanche) - read-only via REST
const gmx = await createExchange('gmx', {
chain: 'arbitrum', // or 'avalanche'
walletAddress: process.env.GMX_WALLET_ADDRESS, // Optional, for positions
});
// Aster (BNB Chain) - Binance-style HMAC-SHA256
const aster = await createExchange('aster', {
apiKey: process.env.ASTER_API_KEY,
apiSecret: process.env.ASTER_API_SECRET,
});
// Pacifica (Solana) - ED25519 signing
const pacifica = await createExchange('pacifica', {
apiKey: process.env.PACIFICA_API_KEY,
apiSecret: process.env.PACIFICA_API_SECRET, // ED25519 private key (base64)
});
// Ostium (Arbitrum RWA) - ethers.js contract interaction
const ostium = await createExchange('ostium', {
privateKey: process.env.OSTIUM_PRIVATE_KEY, // EVM private key
});
// Reya (Reya Network L2) - EIP-712 signing
const reya = await createExchange('reya', {
privateKey: process.env.REYA_PRIVATE_KEY, // EVM private key
});
// Ethereal (EIP-712) - USDe collateral
const ethereal = await createExchange('ethereal', {
privateKey: process.env.ETHEREAL_PRIVATE_KEY, // EVM private key
});
// Avantis (Base chain) - on-chain via ethers.js
const avantis = await createExchange('avantis', {
privateKey: process.env.AVANTIS_PRIVATE_KEY, // EVM private key
});| Exchange | Special Requirements |
|---|---|
| Lighter | WASM-based signing, works cross-platform without native dependencies |
| Extended | API returning empty markets; mainnet only |
| Variational | RFQ-based, no WebSocket support |
| EdgeX/Nado | Use watchTrades() instead of fetchTrades() |
| dYdX v4 | Requires 24-word Cosmos mnemonic for trading |
| Jupiter | Pyth Hermes price API; Solana wallet for trading |
| Drift | Solana wallet required; private key for trading |
| GMX v2 | Read-only REST API; trading requires @gmx-io/sdk |
| Aster | BNB Chain, Binance-style HMAC-SHA256 auth, referral codes supported |
| Pacifica | Solana-based, ED25519 signing |
| Ostium | Arbitrum RWA perpetuals; oracle-based (no orderbook) |
| Reya | Reya Network L2; oracle/pool-based (no orderbook); continuous funding |
| Ethereal | EIP-712 auth; USDe collateral; UUID product IDs |
| Avantis | Base chain; on-chain execution; Pyth oracle; needs real contract addresses |
# Hyperliquid
HYPERLIQUID_PRIVATE_KEY=0x... # 64 hex chars (EVM private key)
# EdgeX
EDGEX_STARK_PRIVATE_KEY=0x... # StarkNet private key
# Paradex
PARADEX_STARK_PRIVATE_KEY=0x... # StarkNet private key
# GRVT
GRVT_API_KEY=your_api_key
# Backpack
BACKPACK_API_KEY=your_api_key
BACKPACK_API_SECRET=base64_key # ED25519 private key (base64)
# Lighter
LIGHTER_PRIVATE_KEY=0x... # 64 hex chars
# Nado
NADO_PRIVATE_KEY=0x... # EVM private key
# Extended (mainnet only)
EXTENDED_API_KEY=your_api_key
# Variational
VARIATIONAL_API_KEY=your_api_key
VARIATIONAL_API_SECRET=your_secret
# dYdX v4
DYDX_MNEMONIC="word1 word2 ... word24" # 24-word Cosmos seed phrase
# Jupiter Perps
JUPITER_WALLET_ADDRESS=your_solana_address
JUPITER_PRIVATE_KEY=base58_private_key # Optional, for trading
# Drift Protocol
DRIFT_WALLET_ADDRESS=your_solana_address
DRIFT_PRIVATE_KEY=base58_private_key # Optional, for trading
# GMX v2
GMX_CHAIN=arbitrum # or 'avalanche'
GMX_WALLET_ADDRESS=0x... # Optional, for position data
# Aster (BNB Chain)
ASTER_API_KEY=your_api_key
ASTER_API_SECRET=your_api_secret # HMAC-SHA256
# Pacifica (Solana)
PACIFICA_API_KEY=your_api_key
PACIFICA_API_SECRET=base64_key # ED25519 private key (base64)
# Ostium (Arbitrum RWA)
OSTIUM_PRIVATE_KEY=0x... # EVM private key
# Reya (Reya Network L2)
REYA_PRIVATE_KEY=0x... # EVM private key
# Ethereal
ETHEREAL_PRIVATE_KEY=0x... # EVM private key
# Avantis (Base chain)
AVANTIS_PRIVATE_KEY=0x... # EVM private keyimport { createExchange } from 'pd-aio-sdk';
const exchange = await createExchange('hyperliquid', { testnet: true });
await exchange.initialize();
// Fetch 1-hour candles for the last 24 hours
const candles = await exchange.fetchOHLCV('BTC/USDT:USDT', '1h', {
limit: 24
});
for (const [timestamp, open, high, low, close, volume] of candles) {
console.log(`${new Date(timestamp).toISOString()}: O=${open} H=${high} L=${low} C=${close} V=${volume}`);
}
// Supported timeframes: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M
// Currently available on: Hyperliquid, GRVT, dYdX, GMX, Asterimport { createExchange } from 'pd-aio-sdk';
const exchange = await createExchange('hyperliquid', {
privateKey: process.env.PRIVATE_KEY,
testnet: true
});
await exchange.initialize();
// Stream order book updates
for await (const orderBook of exchange.watchOrderBook('BTC/USDT:USDT')) {
console.log('Best bid:', orderBook.bids[0]);
console.log('Best ask:', orderBook.asks[0]);
}
// Stream position updates (requires auth)
for await (const positions of exchange.watchPositions()) {
console.log('Positions updated:', positions);
}
// Stream your own trades (requires auth)
for await (const trade of exchange.watchMyTrades('BTC/USDT:USDT')) {
console.log('My trade:', trade.side, trade.amount, '@', trade.price);
}import { createExchange } from 'pd-aio-sdk';
// Initialize multiple exchanges (public API - no auth needed)
const hyperliquid = await createExchange('hyperliquid', { testnet: true });
const edgex = await createExchange('edgex', {});
const nado = await createExchange('nado', { testnet: true });
await Promise.all([
hyperliquid.initialize(),
edgex.initialize(),
nado.initialize()
]);
// Fetch markets from all exchanges
const [hlMarkets, edgexMarkets, nadoMarkets] = await Promise.all([
hyperliquid.fetchMarkets(),
edgex.fetchMarkets(),
nado.fetchMarkets()
]);
console.log(`Hyperliquid: ${hlMarkets.length} markets`);
console.log(`EdgeX: ${edgexMarkets.length} markets`);
console.log(`Nado: ${nadoMarkets.length} markets`);import { createExchange, PerpDEXError } from 'pd-aio-sdk';
const exchange = await createExchange('hyperliquid', { testnet: true });
await exchange.initialize();
try {
// This will throw if no credentials provided
await exchange.fetchBalance();
} catch (error) {
if (error instanceof PerpDEXError) {
console.log('Error code:', error.code); // 'MISSING_CREDENTIALS'
console.log('Exchange:', error.exchange); // 'hyperliquid'
console.log('Message:', error.message);
console.log('Correlation ID:', error.correlationId); // For tracing
}
}import { createExchange } from 'pd-aio-sdk';
const exchange = await createExchange('hyperliquid', { testnet: true });
await exchange.initialize();
// Get API metrics
const metrics = exchange.getMetrics();
console.log(`Total requests: ${metrics.totalRequests}`);
console.log(`Success rate: ${(metrics.successRate * 100).toFixed(2)}%`);
console.log(`Avg latency: ${metrics.averageLatency.toFixed(2)}ms`);
// Get circuit breaker status
const cbState = exchange.getCircuitBreakerState();
console.log(`Circuit breaker: ${cbState}`); // 'CLOSED', 'OPEN', or 'HALF_OPEN'
// Health check
const health = await exchange.healthCheck();
console.log(`Status: ${health.status}`); // 'healthy', 'degraded', or 'unhealthy'
console.log(`API latency: ${health.api.latency}ms`);Lighter uses WASM-based transaction signing that works cross-platform without any native dependencies. The @oraichain/lighter-ts-sdk package is included as a dependency.
import { createExchange } from 'pd-aio-sdk';
const lighter = await createExchange('lighter', {
apiPrivateKey: '0x...', // Your Lighter private key
testnet: true,
});
await lighter.initialize();
// Verify WASM signing is available
console.log('WASM Signing:', lighter.hasWasmSigning); // Should be true
// Full trading support - no additional setup required
const order = await lighter.createOrder({
symbol: 'BTC/USDT:USDT',
side: 'buy',
type: 'limit',
amount: 0.01,
price: 50000,
});- Cross-platform: Works on macOS, Linux, Windows without native binaries
- No Python required: Pure TypeScript/WASM implementation
- Full trading support: Orders, cancellations, withdrawals all work out of the box
Builder codes enable fee attribution for SDK operators β earn a share of trading fees generated through your application.
| Exchange | Builder Code Field | Notes |
|---|---|---|
| Hyperliquid | builderAddress |
EVM address, fee split on-chain |
| GRVT | builderAddress |
API-level attribution |
| Pacifica | builderAddress |
Solana-based attribution |
| Aster | builderAddress |
BNB Chain referral system |
| Ostium | builderAddress |
Arbitrum RWA fee sharing |
| GMX | builderAddress |
Arbitrum/Avalanche |
| Drift | builderAddress |
Solana referral program |
import { createExchange } from 'pd-aio-sdk';
const exchange = await createExchange('hyperliquid', {
privateKey: process.env.PRIVATE_KEY,
builderAddress: '0xYourAddress',
builderCodeEnabled: true, // default β can be omitted
testnet: true,
});Builder codes are enabled by default when a builderAddress is provided. You can disable them at any time:
// Disable builder code (fees go directly to exchange)
const exchange = await createExchange('hyperliquid', {
builderAddress: '0xYourAddress',
builderCodeEnabled: false, // explicitly disable
});Import only the adapters you need to reduce bundle size:
// Import only what you need (tree-shakeable)
import { HyperliquidAdapter } from 'pd-aio-sdk/hyperliquid';
import { DriftAdapter } from 'pd-aio-sdk/drift';
import { AsterAdapter } from 'pd-aio-sdk/aster';
// Or use the full SDK
import { createExchange } from 'pd-aio-sdk';# All tests
npm test
# With coverage
npm run test:coverage
# Watch mode
npm run test:watch
# Specific exchange
npm test -- hyperliquidβ
6908 tests passing (100% pass rate)
β
194 test suites
β
Coverage: 85% statements, 89% functions
β
ESLint: 0 errors, TypeScript strict: 0 errors
β
Live API: 19/20 exchanges verified against real APIs (March 2026)
All 20 exchange adapters follow Pattern A (Full-Featured) architecture:
src/adapters/{exchange}/
βββ {Exchange}Adapter.ts # Main adapter implementation
βββ {Exchange}Normalizer.ts # Data transformation
βββ auth.ts # Authentication (if complex)
βββ utils.ts # Helper functions
βββ constants.ts # Configuration
βββ types.ts # TypeScript types
βββ index.ts # Public API
- Adapters - Exchange-specific implementations
- Normalizers - Data transformation (CCXT format β Exchange format)
- Core - Rate limiting, retry logic, circuit breaker, logging with correlation IDs
- WebSocket - Connection management, auto-reconnection, backpressure handling
- Validation - Zod schemas for runtime type checking
- Types - Unified data structures, error hierarchy
- Monitoring - Prometheus metrics, health checks
Learn More: See ARCHITECTURE.md for detailed documentation
# Install dependencies
npm install
# Build TypeScript
npm run build
# Watch mode
npm run dev
# Lint
npm run lint
# Type check
npm run typecheckWe welcome contributions! Please see our Contributing Guide for details.
MIT License - see LICENSE file for details.
- Architecture: ARCHITECTURE.md
- API Reference: API.md
- Adapter Guide: ADAPTER_GUIDE.md
- Contributing: CONTRIBUTING.md
- Korean Docs: νκ΅μ΄ λ¬Έμ
- Exchange Guides: docs/guides/
- Examples: examples/
- Inspired by CCXT unified API design
- Built with ethers.js, starknet.js
Built with β€οΈ for the DeFi community