Skip to main content
Glama

cancelOrder

Cancel a specific cryptocurrency trading order by providing account details, order ID, and trading symbol. Integrates with CCXT MCP Server for exchange API connectivity.

Instructions

Cancel an existing order using a configured account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountNameYesAccount name defined in the configuration file (e.g., 'bybit_main')
idYesOrder ID to cancel
paramsNoAdditional exchange-specific parameters
symbolYesTrading symbol (e.g., 'BTC/USDT')

Implementation Reference

  • The handler function that retrieves the exchange instance and calls exchange.cancelOrder(id, symbol, params) to cancel the order, returning the result or error.
    async ({ accountName, id, symbol, params }) => { try { const exchange = ccxtServer.getExchangeInstance(accountName); // getExchangeInstance가 성공하면 인증은 보장됨 const result = await exchange.cancelOrder(id, symbol, params); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error canceling order for account '${accountName}': ${ (error as Error).message }`, }, ], isError: true, }; } },
  • Zod schema defining the input parameters for the cancelOrder tool: accountName, id, symbol, and optional params.
    { accountName: z .string() .describe( "Account name defined in the configuration file (e.g., 'bybit_main')" ), id: z.string().describe("Order ID to cancel"), symbol: z.string().describe("Trading symbol (e.g., 'BTC/USDT')"), params: z .record(z.any()) .optional() .describe("Additional exchange-specific parameters"), },
  • Registers the cancelOrder tool on the MCP server using server.tool(), including name, description, input schema, and handler function.
    server.tool( "cancelOrder", "Cancel an existing order using a configured account", { accountName: z .string() .describe( "Account name defined in the configuration file (e.g., 'bybit_main')" ), id: z.string().describe("Order ID to cancel"), symbol: z.string().describe("Trading symbol (e.g., 'BTC/USDT')"), params: z .record(z.any()) .optional() .describe("Additional exchange-specific parameters"), }, async ({ accountName, id, symbol, params }) => { try { const exchange = ccxtServer.getExchangeInstance(accountName); // getExchangeInstance가 성공하면 인증은 보장됨 const result = await exchange.cancelOrder(id, symbol, params); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error canceling order 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