get_trades
Retrieve your team's trade history with filters for blockchain type, token address, and pagination to analyze past trading activity.
Instructions
Get trade history for your team
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of trades to retrieve (default: 20) | |
| offset | No | Offset for pagination | |
| token | No | Filter by token address | |
| chain | No | Filter by blockchain type |
Implementation Reference
- src/index.ts:130-157 (registration)Registration of the 'get_trades' tool in the TRADING_SIM_TOOLS array, including name, description, and JSON input schema for parameters (limit, offset, token, chain).{ name: "get_trades", description: "Get trade history for your team", inputSchema: { type: "object", properties: { limit: { type: "number", description: "Maximum number of trades to retrieve (default: 20)" }, offset: { type: "number", description: "Offset for pagination" }, token: { type: "string", description: "Filter by token address" }, chain: { type: "string", enum: ["svm", "evm"], description: "Filter by blockchain type" } }, additionalProperties: false, $schema: "http://json-schema.org/draft-07/schema#" } },
- src/index.ts:476-492 (handler)MCP CallToolRequest handler for 'get_trades': validates arguments, constructs TradeHistoryParams object, calls tradingClient.getTradeHistory(), and formats response.case "get_trades": { if (!args || typeof args !== "object") { throw new Error("Invalid arguments for get_trades"); } const tradeParams: TradeHistoryParams = {}; if ("limit" in args) tradeParams.limit = args.limit as number; if ("offset" in args) tradeParams.offset = args.offset as number; if ("token" in args) tradeParams.token = args.token as string; if ("chain" in args) tradeParams.chain = args.chain as BlockchainType; const response = await tradingClient.getTradeHistory(tradeParams); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], isError: false }; }
- src/api-client.ts:286-322 (helper)Supporting utility in TradingSimulatorClient: builds URL query string from TradeHistoryParams and executes HTTP GET request to '/api/account/trades' via the internal request() method.async getTradeHistory(options?: TradeHistoryParams): Promise<TradeHistoryResponse | ErrorResponse> { let path = '/api/account/trades'; // Add query parameters if provided if (options) { const params = new URLSearchParams(); if (options.limit !== undefined) { params.append('limit', options.limit.toString()); } if (options.offset !== undefined) { params.append('offset', options.offset.toString()); } if (options.token) { params.append('token', options.token); } if (options.chain) { params.append('chain', options.chain); } // Append query string if we have parameters const queryString = params.toString(); if (queryString) { path += `?${queryString}`; } } return this.request<TradeHistoryResponse>( 'GET', path, null, 'get trade history' ); }
- src/types.ts:84-89 (schema)TypeScript interface definition for TradeHistoryParams, matching the input schema parameters for the get_trades tool.export interface TradeHistoryParams { limit?: number; offset?: number; token?: string; chain?: BlockchainType; }