Skip to main content
Glama
enderekici

Trading 212 MCP Server

by enderekici

get_order_history

Retrieve past trading orders with pagination and filtering options to analyze transaction history and track investment performance.

Instructions

Get historical orders with pagination support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoPagination cursor for fetching next page
limitNoMaximum number of results to return (default 50)
tickerNoFilter by ticker symbol

Implementation Reference

  • Tool handler in the main MCP switch block.
    case 'get_order_history': {
      const { cursor, limit, ticker } = PaginatedWithTickerInputSchema.parse(args);
      const history = await client.getOrderHistory({ cursor, limit, ticker });
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(history, null, 2),
          },
        ],
      };
  • Actual API client implementation for fetching order history.
    async getOrderHistory(params?: {
      cursor?: number;
      limit?: number;
      ticker?: string;
    }): Promise<{ items: HistoricalOrder[]; nextPagePath?: string }> {
      const queryParams = new URLSearchParams();
      if (params?.cursor) queryParams.append('cursor', params.cursor.toString());
      if (params?.limit) queryParams.append('limit', params.limit.toString());
      if (params?.ticker) queryParams.append('ticker', params.ticker);
    
      const endpoint = `/equity/history/orders${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
      const response = await this.request<{ items: unknown[]; nextPagePath?: string }>(endpoint);
    
      return {
        items: z.array(HistoricalOrderSchema).parse(response.items),
        nextPagePath: response.nextPagePath,
      };
    }

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/enderekici/trading212-mcp'

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