Skip to main content
Glama

fetchMyTrades

Retrieve your trade history for a specific cryptocurrency account and symbol through the CCXT MCP Server. Input account details, symbol, and optional filters like timestamp or limit to fetch personal trading data.

Instructions

Fetch personal trade history for a configured account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountNameYesAccount name defined in the configuration file (e.g., 'bybit_main')
limitNoLimit the number of trades returned (optional)
sinceNoTimestamp in ms to fetch trades since (optional)
symbolNoTrading symbol (e.g., 'BTC/USDT')

Implementation Reference

  • The handler function that executes the fetchMyTrades tool logic. It gets the CCXT exchange for the account, checks if fetchMyTrades is supported, fetches the trades, and returns them as JSON or handles errors.
    async ({ accountName, symbol, since, limit }) => { try { const exchange = ccxtServer.getExchangeInstance(accountName); // getExchangeInstance가 성공하면 인증은 보장됨 // fetchMyTrades 메서드가 지원되는지 확인 if (!exchange.has["fetchMyTrades"]) { return { content: [ { type: "text", text: `Account '${accountName}' (Exchange: ${exchange.id}) does not support fetching personal trades`, }, ], isError: true, }; } const trades = await exchange.fetchMyTrades(symbol, since, limit); return { content: [ { type: "text", text: JSON.stringify(trades, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error fetching personal trades for account '${accountName}': ${ (error as Error).message }`, }, ], isError: true, }; } }
  • Zod schema defining the input parameters for the fetchMyTrades tool: accountName (required string), symbol (optional string), since (optional number), limit (optional number).
    { 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 trades since (optional)"), limit: z .number() .optional() .describe("Limit the number of trades returned (optional)"), },
  • The server.tool call that registers the fetchMyTrades MCP tool with its name, description, input schema, and handler function within the registerAccountTools function.
    server.tool( "fetchMyTrades", "Fetch personal trade history for 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 trades since (optional)"), limit: z .number() .optional() .describe("Limit the number of trades returned (optional)"), }, async ({ accountName, symbol, since, limit }) => { try { const exchange = ccxtServer.getExchangeInstance(accountName); // getExchangeInstance가 성공하면 인증은 보장됨 // fetchMyTrades 메서드가 지원되는지 확인 if (!exchange.has["fetchMyTrades"]) { return { content: [ { type: "text", text: `Account '${accountName}' (Exchange: ${exchange.id}) does not support fetching personal trades`, }, ], isError: true, }; } const trades = await exchange.fetchMyTrades(symbol, since, limit); return { content: [ { type: "text", text: JSON.stringify(trades, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error fetching personal trades 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