Skip to main content
Glama

fetchOpenOrders

Retrieve all open orders for a specified account and trading symbol using the CCXT MCP Server. Customize results with optional filters like timestamp, order count, and exchange-specific parameters.

Instructions

Fetch all open orders using a configured account

Input Schema

NameRequiredDescriptionDefault
accountNameYesAccount name defined in the configuration file (e.g., 'bybit_main')
limitNoLimit the number of orders returned (optional)
paramsNoAdditional exchange-specific parameters
sinceNoTimestamp in ms to fetch orders since (optional)
symbolNoTrading symbol (e.g., 'BTC/USDT')

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "accountName": { "description": "Account name defined in the configuration file (e.g., 'bybit_main')", "type": "string" }, "limit": { "description": "Limit the number of orders returned (optional)", "type": "number" }, "params": { "additionalProperties": {}, "description": "Additional exchange-specific parameters", "type": "object" }, "since": { "description": "Timestamp in ms to fetch orders since (optional)", "type": "number" }, "symbol": { "description": "Trading symbol (e.g., 'BTC/USDT')", "type": "string" } }, "required": [ "accountName" ], "type": "object" }

Implementation Reference

  • The asynchronous handler function that retrieves open orders from the CCXT exchange for the specified account, checks if the method is supported, handles errors, and returns JSON-formatted orders.
    async ({ accountName, symbol, since, limit, params }) => { try { const exchange = ccxtServer.getExchangeInstance(accountName); // getExchangeInstance가 성공하면 인증은 보장됨 // fetchOpenOrders 메서드가 지원되는지 확인 if (!exchange.has["fetchOpenOrders"]) { return { content: [ { type: "text", text: `Account '${accountName}' (Exchange: ${exchange.id}) does not support fetching open orders`, }, ], isError: true, }; } const openOrders = await exchange.fetchOpenOrders( symbol, since, limit, params, ); return { content: [ { type: "text", text: JSON.stringify(openOrders, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error fetching open orders for account '${accountName}': ${ (error as Error).message }`, }, ], isError: true, }; } }, );
  • Zod schema defining input parameters for the fetchOpenOrders tool: accountName (required), symbol/since/limit/params (optional).
    { accountName: z .string() .describe( "Account name defined in the configuration file (e.g., 'bybit_main')" ), symbol: z .string() .optional() .describe("Trading symbol (e.g., 'BTC/USDT')"), since: z .number() .optional() .describe("Timestamp in ms to fetch orders since (optional)"), limit: z .number() .optional() .describe("Limit the number of orders returned (optional)"), params: z .record(z.any()) .optional() .describe("Additional exchange-specific parameters"), },
  • The server.tool() call registering the 'fetchOpenOrders' tool with name, description, input schema, and handler function within registerOrderTools.
    server.tool( "fetchOpenOrders", "Fetch all open orders using a configured account", { accountName: z .string() .describe( "Account name defined in the configuration file (e.g., 'bybit_main')" ), symbol: z .string() .optional() .describe("Trading symbol (e.g., 'BTC/USDT')"), since: z .number() .optional() .describe("Timestamp in ms to fetch orders since (optional)"), limit: z .number() .optional() .describe("Limit the number of orders returned (optional)"), params: z .record(z.any()) .optional() .describe("Additional exchange-specific parameters"), }, async ({ accountName, symbol, since, limit, params }) => { try { const exchange = ccxtServer.getExchangeInstance(accountName); // getExchangeInstance가 성공하면 인증은 보장됨 // fetchOpenOrders 메서드가 지원되는지 확인 if (!exchange.has["fetchOpenOrders"]) { return { content: [ { type: "text", text: `Account '${accountName}' (Exchange: ${exchange.id}) does not support fetching open orders`, }, ], isError: true, }; } const openOrders = await exchange.fetchOpenOrders( symbol, since, limit, params, ); return { content: [ { type: "text", text: JSON.stringify(openOrders, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error fetching open orders for account '${accountName}': ${ (error as Error).message }`, }, ], 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/lazy-dinosaur/ccxt-mcp'

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