Skip to main content
Glama
kwonsw812

kiwoom-mcp

by kwonsw812

cancel_order

Cancel pending stock orders in Kiwoom Securities accounts using original order numbers. Specify quantity or cancel all remaining shares by setting quantity to zero.

Instructions

원주문번호로 미체결 주문을 취소합니다. 수량을 0으로 입력하면 잔량 전부 취소

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
original_order_noYes취소할 원주문번호
stock_codeYes종목코드 (예: 005930)
quantityYes취소 수량 (0 입력시 잔량 전부 취소)
account_noNo계좌번호 (미입력시 기본 계좌 사용)

Implementation Reference

  • The MCP tool handler for 'cancel_order', which extracts input parameters and calls the client's cancelOrder method.
    async ({ original_order_no, stock_code, quantity, account_no }) => {
      try {
        const acct = resolveAccountNo(account_no);
        const data = await client.cancelOrder(acct, original_order_no, stock_code, quantity);
        let text = `## 주문 취소 완료\n\n`;
        text += `- 취소 주문번호: ${data.ord_no ?? "N/A"}\n`;
        text += `- 원주문번호: ${original_order_no}\n`;
        text += `- 종목코드: ${stock_code}\n`;
        text += `- 취소수량: ${data.cncl_qty ?? quantity}주\n`;
        return textContent(text);
      } catch (error) {
        return errorContent(formatError(error));
      }
    }
  • src/index.ts:732-741 (registration)
    Registration of the 'cancel_order' MCP tool with its schema definition.
    server.tool(
      "cancel_order",
      "원주문번호로 미체결 주문을 취소합니다. 수량을 0으로 입력하면 잔량 전부 취소",
      {
        original_order_no: z.string().describe("취소할 원주문번호"),
        stock_code: stockCodeSchema,
        quantity: z.number().int().min(0).describe("취소 수량 (0 입력시 잔량 전부 취소)"),
        account_no: accountNoSchema,
      },
      { readOnlyHint: false, idempotentHint: false, destructiveHint: true },
  • The underlying API client method that performs the network request for cancelling an order.
    async cancelOrder(accountNo: string, origOrdNo: string, stockCode: string, quantity: number) {
      return this.request("/api/dostk/ordr", "kt10003", {
        acc_no: accountNo,
        dmst_stex_tp: "KRX",
        orig_ord_no: origOrdNo,
        stk_cd: stockCode,
        cncl_qty: String(quantity),
      });
    }

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/kwonsw812/kiwoom-mcp'

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