Skip to main content
Glama

get_orderbook

Retrieve the order book (bids and asks) for a trading pair on supported exchanges to analyze market depth and liquidity.

Instructions

Get the order book (bids and asks) for a symbol on an exchange

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exchangeYesExchange name: pacifica, hyperliquid, or lighter
symbolYesTrading pair symbol, e.g. BTC, ETH, SOL

Implementation Reference

  • The "get_orderbook" tool is registered here. It takes 'exchange' and 'symbol' as parameters and calls 'adapter.getOrderbook(symbol)'.
    server.tool(
      "get_orderbook",
      "Get the order book (bids and asks) for a symbol on an exchange",
      {
        exchange: z.string().describe("Exchange name: pacifica, hyperliquid, or lighter"),
        symbol: z.string().describe("Trading pair symbol, e.g. BTC, ETH, SOL"),
      },
      async ({ exchange, symbol }) => {
        try {
          const adapter = await getOrCreateAdapter(exchange);
          const book = await adapter.getOrderbook(symbol);
          return { content: [{ type: "text", text: ok(book, { exchange, symbol }) }] };
        } catch (e) {
          return { content: [{ type: "text", text: err(e instanceof Error ? e.message : String(e), { exchange, symbol }) }], isError: true };
        }
      },
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hypurrquant/perp-cli'

If you have feedback or need assistance with the MCP directory API, please join our Discord server