CREATE_ORDER
Execute custom trading orders on the Upbit cryptocurrency exchange by specifying market, side, order type, volume, and price. Requires a private API for secure trading operations.
Instructions
Create an Upbit order (requires private API)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| market | Yes | ||
| ord_type | Yes | ||
| price | No | ||
| side | Yes | ||
| volume | No |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"market": {
"type": "string"
},
"ord_type": {
"enum": [
"limit",
"price",
"market"
],
"type": "string"
},
"price": {
"type": "string"
},
"side": {
"enum": [
"bid",
"ask"
],
"type": "string"
},
"volume": {
"type": "string"
}
},
"required": [
"market",
"side",
"ord_type"
],
"type": "object"
}
Implementation Reference
- src/tools/create-order.ts:32-67 (handler)The main CREATE_ORDER tool implementation, defining the tool object with name, description, parameters, and the execute function that handles order creation via Upbit's private API.export const createOrderTool = { name: "CREATE_ORDER", description: "Create an Upbit order (requires private API)", parameters: paramsSchema, execute: async ({ market, side, ord_type, volume, price, time_in_force, smp_type, identifier, }: Params) => { ensurePrivateEnabled(); const baseURL = `${config.upbit.baseUrl}${config.upbit.apiBasePath}`; const client = createHttpClient(baseURL); const body = { market, side, ord_type, volume, price, time_in_force, smp_type, identifier, }; const token = signJwtToken(body); const data = await fetchJson<unknown>(client, "/orders", { method: "POST", data: body, headers: { Authorization: `Bearer ${token}` }, }); return JSON.stringify(data, null, 2); }, } as const;
- src/tools/create-order.ts:6-28 (schema)Zod schema defining and validating the input parameters for the CREATE_ORDER tool, including refinements for different order types.const paramsSchema = z .object({ market: z.string(), side: z.enum(["bid", "ask"]), ord_type: z.enum(["limit", "price", "market"]), volume: z.string().optional(), price: z.string().optional(), time_in_force: z.enum(["ioc", "fok", "post_only"]).optional(), smp_type: z.enum(["cancel_maker", "cancel_taker", "reduce"]).optional(), identifier: z.string().optional(), }) .refine((p) => (p.ord_type === "limit" ? p.volume && p.price : true), { message: "Limit orders require both volume and price", }) .refine((p) => (p.ord_type === "price" ? !!p.price : true), { message: "Market buy (price) requires price", }) .refine((p) => (p.ord_type === "market" ? !!p.volume : true), { message: "Market sell (market) requires volume", }) .refine((p) => !(p.time_in_force === "post_only" && p.smp_type), { message: "post_only cannot be used with smp_type", });
- src/index.ts:35-35 (registration)Registration of the createOrderTool with the FastMCP server.server.addTool(createOrderTool);