getOrders
Retrieve current open orders from the Bitget exchange, filtered by symbol or status, to manage and monitor trading positions effectively via the MCP Bitget Trading Server.
Instructions
Get current open orders
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Filter by status | |
| symbol | No | Filter by symbol |
Implementation Reference
- src/server.ts:413-424 (handler)MCP tool handler for 'getOrders': parses input parameters using GetOrdersSchema, calls bitgetClient.getOrders(), and returns the orders as a JSON-formatted text response.case 'getOrders': { const { symbol, status } = GetOrdersSchema.parse(args); const orders = await this.bitgetClient.getOrders(symbol, status); return { content: [ { type: 'text', text: JSON.stringify(orders, null, 2), }, ], } as CallToolResult; }
- src/types/mcp.ts:56-59 (schema)Zod schema defining the input parameters for the getOrders tool: optional symbol and status filters.export const GetOrdersSchema = z.object({ symbol: z.string().optional().describe('Filter by symbol'), status: z.enum(['open', 'filled', 'cancelled']).optional().describe('Filter by status') });
- src/server.ts:193-204 (registration)Registration of the 'getOrders' tool in the ListTools response, including name, description, and input schema matching the Zod schema.{ name: 'getOrders', description: 'Get current open orders', inputSchema: { type: 'object', properties: { symbol: { type: 'string', description: 'Filter by symbol' }, status: { type: 'string', enum: ['open', 'filled', 'cancelled'], description: 'Filter by status' } }, required: [] }, },
- src/api/rest-client.ts:690-696 (helper)Core implementation of getOrders in BitgetRestClient: dispatches to spot or futures order fetching based on symbol type.async getOrders(symbol?: string, status?: string): Promise<Order[]> { if (symbol && this.isFuturesSymbol(symbol)) { return this.getFuturesOrders(symbol, status); } else { return this.getSpotOrders(symbol, status); } }