Skip to main content
Glama

fetchMyTrades

Retrieve personal trade history from cryptocurrency exchanges to track transactions, analyze performance, and maintain records for configured trading accounts.

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')
symbolNoTrading symbol (e.g., 'BTC/USDT')
sinceNoTimestamp in ms to fetch trades since (optional)
limitNoLimit the number of trades returned (optional)

Implementation Reference

  • The main handler function for the 'fetchMyTrades' tool. It retrieves the CCXT exchange instance for the given account, checks if fetchMyTrades is supported, fetches the trades, and returns them as JSON or an error message.
    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), symbol (optional), since (optional), limit (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 trades since (optional)"),
      limit: z
        .number()
        .optional()
        .describe("Limit the number of trades returned (optional)"),
    },
  • The server.tool() call that registers the 'fetchMyTrades' tool with MCP server, including description, input schema, and handler 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,
          };
        }
      }
    );
  • src/server.ts:374-374 (registration)
    The call to registerAccountTools in the main CcxtMcpServer class's registerTools() method, which triggers the registration of fetchMyTrades among other account tools.
    registerAccountTools(this.server, this);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states what the tool does without behavioral details. It doesn't disclose rate limits, authentication needs, pagination behavior, error conditions, or what 'fetch' entails (e.g., real-time vs. cached data). This is inadequate for a tool with potential complexity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's front-loaded with the core purpose and appropriately sized for the tool's scope.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete. It doesn't explain return values (e.g., trade format, fields), error handling, or behavioral constraints. For a tool fetching personal trade data with 4 parameters, this leaves significant gaps for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema. The description adds no additional parameter semantics beyond implying 'accountName' refers to a pre-configured account, which is already covered in the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('fetch') and resource ('personal trade history for a configured account'), making the purpose immediately understandable. It distinguishes from siblings like 'fetchTrades' (likely public trades) by specifying 'personal' and 'configured account', though it doesn't explicitly name alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'fetchClosedOrders' or 'fetchTrades', nor does it mention prerequisites (e.g., needing a configured account). It implies usage for personal trade history but lacks explicit when/when-not instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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