getOrders
Retrieve current open orders from Bitget exchange to monitor trading positions, filter by symbol or status for order management.
Instructions
Get current open orders
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | No | Filter by symbol | |
| status | No | Filter by status |
Implementation Reference
- src/server.ts:413-424 (handler)MCP tool handler for 'getOrders': parses input parameters using GetOrdersSchema, calls bitgetClient.getOrders(), and returns JSON-formatted orders.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 optional input parameters 'symbol' and 'status' for the getOrders tool.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)Registers the 'getOrders' tool in the MCP server's listTools response with name, description, and input schema (hardcoded 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, which is called by the MCP handler.async getOrders(symbol?: string, status?: string): Promise<Order[]> { if (symbol && this.isFuturesSymbol(symbol)) { return this.getFuturesOrders(symbol, status); } else { return this.getSpotOrders(symbol, status); } }