Docs

openOrders - HyperCore Info Endpoint

Get all open limit orders for any user on Hyperliquid, including order details, prices, sizes, and timestamps.

Get all open limit orders for a user on Hyperliquid perpetual markets.

Why Hyperliquid? Build on the trading-focused EVM and HyperCore ecosystem built for onchain perpetuals and market data with HyperCore market structure, sub-second finality, and direct access to trading-focused data services.

Authenticate HyperCore Info requests by sending your Dwellir API key in the x-api-key header to https://api-hyperliquid-mainnet-info.n.dwellir.com/info.

When to Use This Endpoint

The openOrders endpoint is essential for traders, trading platforms, and market makers who need to:

  • Order Management — Monitor and manage active limit orders
  • Trading Bots — Track order status and execution
  • Market Making — Monitor spread and order book participation
  • Portfolio Management — Track pending orders across multiple markets

Common Use Cases

1. Monitor Order Fill Progress

Track how much of each order has been filled:

JavaScript
async function getOrderFillProgress(userAddress) {
  const orders = await getOpenOrders(userAddress);

  return orders.map(order => {
    const orig = parseFloat(order.origSz);
    const remaining = parseFloat(order.sz);
    const filled = orig - remaining;
    const fillPercent = (filled / orig) * 100;

    return {
      orderId: order.oid,
      coin: order.coin,
      side: order.side === 'B' ? 'BUY' : 'SELL',
      price: parseFloat(order.limitPx),
      originalSize: orig,
      remainingSize: remaining,
      filledSize: filled,
      fillPercent: fillPercent.toFixed(2),
      isPartiallyFilled: fillPercent > 0 && fillPercent < 100
    };
  });
}

// Usage
const progress = await getOrderFillProgress('0x63E8c7C149556D5f34F833419A287bb9Ef81487f');
const partialFills = progress.filter(o => o.isPartiallyFilled);
console.log(`${partialFills.length} partially filled orders`);

2. Calculate Total Order Book Exposure

Calculate total capital committed in open orders:

JavaScript
async function calculateOrderExposure(userAddress) {
  const orders = await getOpenOrders(userAddress);

  const totalExposure = orders.reduce((sum, order) => {
    const size = parseFloat(order.sz);
    const price = parseFloat(order.limitPx);
    return sum + (size * price);
  }, 0);

  const byMarket = orders.reduce((acc, order) => {
    const size = parseFloat(order.sz);
    const price = parseFloat(order.limitPx);
    const exposure = size * price;

    if (!acc[order.coin]) {
      acc[order.coin] = { buy: 0, sell: 0, total: 0 };
    }

    if (order.side === 'B') {
      acc[order.coin].buy += exposure;
    } else {
      acc[order.coin].sell += exposure;
    }
    acc[order.coin].total += exposure;

    return acc;
  }, {});

  return {
    totalExposure: totalExposure,
    byMarket: byMarket,
    orderCount: orders.length
  };
}

3. Find Stale Orders

Identify orders that have been open for a long time:

JavaScript
async function findStaleOrders(userAddress, hoursThreshold = 24) {
  const orders = await getOpenOrders(userAddress);
  const now = Date.now();
  const thresholdMs = hoursThreshold * 60 * 60 * 1000;

  const staleOrders = orders.filter(order => {
    return (now - order.timestamp) > thresholdMs;
  });

  return staleOrders.map(order => ({
    orderId: order.oid,
    coin: order.coin,
    side: order.side === 'B' ? 'BUY' : 'SELL',
    price: order.limitPx,
    size: order.sz,
    ageHours: ((now - order.timestamp) / (1000 * 60 * 60)).toFixed(1)
  }));
}

// Usage
const stale = await findStaleOrders('0x63E8c7C149556D5f34F833419A287bb9Ef81487f', 48);
console.log(`${stale.length} orders older than 48 hours`);
stale.forEach(o => {
  console.log(`${o.coin} ${o.side} @ $${o.price} (${o.ageHours}h old)`);
});

4. Group Orders by Market

Organize orders by trading pair:

JavaScript
async function groupOrdersByMarket(userAddress) {
  const orders = await getOpenOrders(userAddress);

  const grouped = orders.reduce((acc, order) => {
    if (!acc[order.coin]) {
      acc[order.coin] = {
        buy: [],
        sell: [],
        totalBuySize: 0,
        totalSellSize: 0
      };
    }

    const side = order.side === 'B' ? 'buy' : 'sell';
    acc[order.coin][side].push(order);

    if (side === 'buy') {
      acc[order.coin].totalBuySize += parseFloat(order.sz);
    } else {
      acc[order.coin].totalSellSize += parseFloat(order.sz);
    }

    return acc;
  }, {});

  return grouped;
}

// Usage
const byMarket = await groupOrdersByMarket('0x63E8c7C149556D5f34F833419A287bb9Ef81487f');
Object.entries(byMarket).forEach(([coin, data]) => {
  console.log(`\n${coin}:`);
  console.log(`  ${data.buy.length} buy orders (${data.totalBuySize} total)`);
  console.log(`  ${data.sell.length} sell orders (${data.totalSellSize} total)`);
});

5. Order Management Dashboard

Create a comprehensive order dashboard:

JavaScript
async function getOrderDashboard(userAddress) {
  const orders = await getOpenOrders(userAddress);

  const now = Date.now();
  const stats = {
    totalOrders: orders.length,
    buyOrders: orders.filter(o => o.side === 'B').length,
    sellOrders: orders.filter(o => o.side === 'A').length,
    markets: [...new Set(orders.map(o => o.coin))],
    partiallyFilled: orders.filter(o => o.sz !== o.origSz).length,
    averageAge: orders.reduce((sum, o) => sum + (now - o.timestamp), 0) / orders.length / (1000 * 60 * 60)
  };

  console.log('=== Order Dashboard ===');
  console.log(`Total Orders: ${stats.totalOrders}`);
  console.log(`  Buy: ${stats.buyOrders}`);
  console.log(`  Sell: ${stats.sellOrders}`);
  console.log(`Markets: ${stats.markets.join(', ')}`);
  console.log(`Partially Filled: ${stats.partiallyFilled}`);
  console.log(`Average Age: ${stats.averageAge.toFixed(1)} hours`);

  return stats;
}

Best Practices

  1. Poll at appropriate intervals — Poll every 5-10 seconds for active trading, less frequently for monitoring
  2. Handle empty arrays — User may have no open orders
  3. Validate addresses — Ensure user addresses are valid Ethereum addresses
  4. Track order IDs — Use order IDs to track specific orders across polls
  5. Monitor fill rates — Alert when orders are partially filled

Access real-time Hyperliquid order data with Dwellir's HyperCore Info Endpoint. Get your API key →