GET_ORDERBOOK
Retrieve real-time orderbook data for cryptocurrency markets on Upbit to analyze market depth and trading opportunities.
Instructions
Get orderbook snapshot for a given market
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| market | Yes | Upbit market code, e.g., KRW-BTC |
Implementation Reference
- src/tools/get-orderbook.ts:15-24 (handler)The main handler function that performs an HTTP request to the Upbit API to fetch the orderbook for the specified market and returns it as formatted JSON.execute: async ({ market }: Params) => { const baseURL = `${config.upbit.baseUrl}${config.upbit.apiBasePath}`; const client = createHttpClient(baseURL); const data = await fetchJson<unknown>(client, "/orderbook", { params: { markets: market }, }); /** biome-ignore lint/suspicious/noExplicitAny: <not important> */ const item = Array.isArray(data) ? (data as any[])[0] : (data as any); return JSON.stringify(item, null, 2); },
- src/tools/get-orderbook.ts:5-7 (schema)Zod schema defining the input parameters for the tool, specifically the 'market' string.const paramsSchema = z.object({ market: z.string().min(3).describe("Upbit market code, e.g., KRW-BTC"), });
- src/index.ts:32-32 (registration)Registers the getOrderbookTool with the FastMCP server instance.server.addTool(getOrderbookTool);