Skip to main content
Glama

binance.account.openOrders

Retrieve current open orders for a specific trading symbol on Binance to monitor active positions and manage trades.

Instructions

List open orders for a symbol.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes

Implementation Reference

  • The tool handler function that validates input with Zod, calls the Binance client's openOrders method with the symbol and common params, returns the data, and handles errors by converting to ToolError.
    export const tool_open_orders: BinanceTool = { name: "binance.account.openOrders", description: "List open orders for a symbol.", parameters: openOrdersSchema, async run(input) { const params = openOrdersSchema.parse(input); try { const res = await binance.openOrders(params.symbol, withCommonParams({})); return res.data; } catch (err) { throw toToolError(err); } } };
  • Zod schema defining the input parameters for the tool: requires a 'symbol' string.
    const openOrdersSchema = z.object({ symbol: z.string().min(1) });
  • src/index.ts:14-39 (registration)
    Registers the tool_open_orders (imported earlier) by including it in the tools array and using FastMCP's addTool method in a loop, which sets up the execute handler forwarding to the tool's run method.
    const tools = [ tool_market_price, tool_market_klines, tool_exchange_info, tool_account_balances, tool_open_orders, tool_place_order, tool_cancel_order, ]; tools.forEach((tool) => { server.addTool({ name: tool.name, description: tool.description, parameters: tool.parameters, execute: async (args) => { try { const result = await tool.run(args); return JSON.stringify(result, null, 2); } catch (error) { const handled = error instanceof ToolError ? error : new ToolError((error as Error).message); throw handled; } }, }); });
  • Creates and exports the Binance Spot client instance used by the tool handler to call openOrders.
    export const binance = new Spot(apiKey, apiSecret, { baseURL });
  • Helper function to add common parameters like recvWindow to API calls.
    export function withCommonParams<T extends Record<string, unknown>>(params: T) { return { ...params, recvWindow }; }

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/Valerio357/binance-mcp'

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