Skip to main content
Glama
ethancod1ng

Bybit MCP Server

by ethancod1ng

get_order_history

Retrieve historical trading orders from Bybit to analyze past transactions, track performance, and review trading activity across spot, linear, inverse, and option markets.

Instructions

Get historical orders

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYes
symbolNo
limitNo

Implementation Reference

  • Core implementation of getOrderHistory that calls Bybit's getHistoricOrders API endpoint.
    async getOrderHistory(category: string, symbol?: string, limit: number = 20) { try { const response = await this.client.getHistoricOrders({ category: category as any, symbol: symbol, limit: limit }); return response; } catch (error) { throw new Error(`Failed to get order history: ${error instanceof Error ? error.message : JSON.stringify(error)}`); } }
  • Zod input schema for the get_order_history tool defining category, optional symbol and limit.
    export const OrderHistorySchema = z.object({ category: z.enum(['spot', 'linear', 'inverse', 'option']).describe('Product type'), symbol: z.string().optional().describe('Trading symbol'), limit: z.number().min(1).max(50).optional().describe('Number of records to return (default: 20)') });
  • src/tools.ts:78-86 (registration)
    MCP tool registration defining name, description, and input schema for get_order_history.
    { name: 'get_order_history', description: 'Get historical orders', inputSchema: { type: 'object', properties: OrderHistorySchema.shape, required: ['category'] } },
  • Server-side dispatch handler that routes get_order_history calls to the client implementation.
    case 'get_order_history': result = await this.client.getOrderHistory( args.category as string, args.symbol as string, args.limit as number ); break;

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/ethancod1ng/bybit-mcp-server'

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