> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xmonaco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# useLiquidationFeed

> Combine public liquidation history with live pair events

`useLiquidationFeed` returns the newest persisted liquidation events for one margin pair and merges the public WebSocket stream into the same list.

```tsx theme={null}
import { useLiquidationFeed } from "@0xmonaco/react";

function LiquidationFeed({ tradingPairId }: { tradingPairId: string }) {
  const { events, isLoading, error } = useLiquidationFeed(tradingPairId);

  if (isLoading) return <p>Loading liquidation history…</p>;
  if (error) return <p>Could not load liquidation events: {error.message}</p>;

  return (
    <ol>
      {events.map(({ data }) => (
        <li key={data.eventId}>
          {data.side} {data.positionSize} · {data.markNotional} {data.quoteAssetSymbol} · {data.wallet}
        </li>
      ))}
    </ol>
  );
}
```

The hook requests the newest REST page on mount, even before the WebSocket connects, and subscribes to `market_liquidations:{tradingPairId}` for live updates. When the server confirms or restores the subscription, it pages through the full gap from the latest seen event timestamp; if there is no checkpoint, it reads only the newest page. A gap read stops once it has fetched the newest 500 events, the most the hook keeps. Because storage can lag the live stream, the hook repeats the read from the newest stored event it has seen, waiting 1, 2, 4 and then 8 seconds after each read finishes (so roughly 1, 3, 7 and 15 seconds after the first). It stops early once stored history contains the first live event received after the subscription was confirmed, or, when no live event has arrived, once two repeats in a row find nothing new. It merges recovered rows with live updates, deduplicates by `eventId`, and keeps the newest 500 events, dropping older ones. The stream has no snapshot. Timestamps are Unix milliseconds, sizes and prices are decimal strings, and `markNotional` uses the event's captured mark in the quote asset.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.