get_open_orders
Retrieve open orders from Bybit exchange by specifying category, symbol, or order ID. Manage and monitor active trades effectively with customizable filters and limits for precise order tracking.
Instructions
Get open orders
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | Yes | Category (spot, linear, inverse, etc.) | |
| limit | No | Number of orders to retrieve | |
| orderFilter | No | Order filter | |
| orderId | No | Order ID | |
| orderLinkId | No | Order link ID | |
| symbol | No | Symbol (e.g., BTCUSDT) |
Implementation Reference
- src/index.ts:870-887 (handler)MCP tool handler case for 'get_open_orders'. Extracts arguments from request, calls BybitService.getOpenOrders, stringifies the result as JSON, and returns it in the MCP response format.case 'get_open_orders': { const result = await this.bybitService.getOpenOrders( typedArgs.category, typedArgs.symbol, typedArgs.orderId, typedArgs.orderLinkId, typedArgs.orderFilter, typedArgs.limit ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:351-383 (schema)Input schema definition for the get_open_orders tool, defining parameters like category (required), symbol, order IDs, filter, and limit with descriptions and types.name: 'get_open_orders', description: 'Get open orders', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'Category (spot, linear, inverse, etc.)', }, symbol: { type: 'string', description: 'Symbol (e.g., BTCUSDT)', }, orderId: { type: 'string', description: 'Order ID', }, orderLinkId: { type: 'string', description: 'Order link ID', }, orderFilter: { type: 'string', description: 'Order filter', }, limit: { type: 'number', description: 'Number of orders to retrieve', default: 50, }, }, required: ['category'], },
- src/index.ts:692-692 (registration)The tool is registered in the MCP server's tools list via this.server.setTools(), making it available for invocation. The specific entry includes name, description, and inputSchema.}));
- src/bybit-service.ts:366-380 (helper)Core implementation in BybitService: constructs parameters and makes authenticated GET request to Bybit API endpoint '/v5/order/realtime' to fetch open orders.async getOpenOrders( category: string, symbol?: string, orderId?: string, orderLinkId?: string, orderFilter?: string, limit: number = 50 ): Promise<BybitResponse<{ list: Order[] }> | { error: string }> { const params: any = { category, limit }; if (symbol) params.symbol = symbol; if (orderId) params.orderId = orderId; if (orderLinkId) params.orderLinkId = orderLinkId; if (orderFilter) params.orderFilter = orderFilter; return this.makeBybitRequest('/v5/order/realtime', 'GET', params); }