place_order
Execute trading orders on Bybit for spot, linear, inverse, and option markets using market or limit order types with configurable parameters.
Instructions
Place a new order (⚠️ WARNING: Can use real funds on mainnet)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | Yes | ||
| symbol | Yes | ||
| side | Yes | ||
| orderType | Yes | ||
| qty | Yes | ||
| price | No | ||
| timeInForce | No |
Implementation Reference
- src/client.ts:123-150 (handler)The core handler function in BybitClient that executes the place_order tool by calling Bybit's submitOrder API endpoint.async placeOrder(params: { category: string; symbol: string; side: string; orderType: string; qty: string; price?: string; timeInForce?: string; }) { try { if (this.config.environment === 'mainnet') { console.error('⚠️ WARNING: Placing order on MAINNET with real funds!'); } const response = await this.client.submitOrder({ category: params.category as any, symbol: params.symbol, side: params.side as any, orderType: params.orderType as any, qty: params.qty, price: params.price, timeInForce: params.timeInForce as any }); return response; } catch (error) { throw new Error(`Failed to place order: ${error instanceof Error ? error.message : JSON.stringify(error)}`); } }
- src/types.ts:45-53 (schema)Zod schema defining the input parameters for the place_order tool.export const PlaceOrderSchema = z.object({ category: z.enum(['spot', 'linear', 'inverse', 'option']).describe('Product type'), symbol: z.string().describe('Trading symbol'), side: z.enum(['Buy', 'Sell']).describe('Order side'), orderType: z.enum(['Market', 'Limit']).describe('Order type'), qty: z.string().describe('Order quantity'), price: z.string().optional().describe('Order price (required for limit orders)'), timeInForce: z.enum(['GTC', 'IOC', 'FOK']).optional().describe('Time in force (default: GTC)') });
- src/tools.ts:88-95 (registration)Tool registration metadata including name, description, and input schema reference, included in the exported tools array used by the MCP server.name: 'place_order', description: 'Place a new order (⚠️ WARNING: Can use real funds on mainnet)', inputSchema: { type: 'object', properties: PlaceOrderSchema.shape, required: ['category', 'symbol', 'side', 'orderType', 'qty'] } },
- src/server.ts:108-118 (handler)Dispatch handler in MCP server that routes 'place_order' tool calls to the BybitClient.placeOrder method.case 'place_order': result = await this.client.placeOrder({ category: args.category as string, symbol: args.symbol as string, side: args.side as string, orderType: args.orderType as string, qty: args.qty as string, price: args.price as string, timeInForce: args.timeInForce as string, }); break;