Skip to main content
Glama

get_order_history

Retrieve detailed order history by category, symbol, time range, and status. Use this tool to analyze past trades, manage accounts, and validate positions within the Bybit exchange ecosystem.

Instructions

Get order history

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory (spot, linear, inverse, etc.)
endTimeNoEnd time in milliseconds
limitNoNumber of orders to retrieve
orderFilterNoOrder filter
orderIdNoOrder ID
orderLinkIdNoOrder link ID
orderStatusNoOrder status
startTimeNoStart time in milliseconds
symbolNoSymbol (e.g., BTCUSDT)

Implementation Reference

  • Core handler implementation that builds request parameters and calls Bybit's /v5/order/history API endpoint to retrieve order history.
    async getOrderHistory( category: string, symbol?: string, orderId?: string, orderLinkId?: string, orderFilter?: string, orderStatus?: string, startTime?: number, endTime?: number, 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; if (orderStatus) params.orderStatus = orderStatus; if (startTime) params.startTime = startTime; if (endTime) params.endTime = endTime; return this.makeBybitRequest('/v5/order/history', 'GET', params); }
  • MCP server dispatch handler that extracts arguments from tool call request and delegates execution to BybitService.getOrderHistory.
    case 'get_order_history': { const result = await this.bybitService.getOrderHistory( typedArgs.category, typedArgs.symbol, typedArgs.orderId, typedArgs.orderLinkId, typedArgs.orderFilter, typedArgs.orderStatus, typedArgs.startTime, typedArgs.endTime, typedArgs.limit ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • src/index.ts:303-349 (registration)
    Tool registration in the ListTools response, including name, description, and detailed input schema definition.
    { name: 'get_order_history', description: 'Get order history', 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', }, orderStatus: { type: 'string', description: 'Order status', }, startTime: { type: 'number', description: 'Start time in milliseconds', }, endTime: { type: 'number', description: 'End time in milliseconds', }, limit: { type: 'number', description: 'Number of orders to retrieve', default: 50, }, }, required: ['category'], }, },
  • Input schema definition for the get_order_history tool, specifying properties, descriptions, defaults, and required fields.
    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', }, orderStatus: { type: 'string', description: 'Order status', }, startTime: { type: 'number', description: 'Start time in milliseconds', }, endTime: { type: 'number', description: 'End time in milliseconds', }, limit: { type: 'number', description: 'Number of orders to retrieve', default: 50, }, }, required: ['category'], }, },

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/kondisettyravi/mcp-bybit-node'

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