Skip to main content
Glama
migusdn

KIS REST API MCP Server

inquery-order-list

Retrieve daily order lists from Korea Investment & Securities for specified date ranges to track trading activity and manage investment portfolios.

Instructions

Get daily order list from Korea Investment & Securities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateYes
end_dateYes

Implementation Reference

  • The main handler function for the 'inquery-order-list' tool. It authenticates with the Korea Investment & Securities API, prepares request parameters for the order list query between start_date and end_date, sends a GET request, and returns the JSON response.
    async def inquery_order_list(start_date: str, end_date: str):
        """
        Get daily order list from Korea Investment & Securities
        
        Args:
            start_date: Start date (YYYYMMDD)
            end_date: End date (YYYYMMDD)
            
        Returns:
            Dictionary containing order list information
        """
        async with httpx.AsyncClient() as client:
            token = await get_access_token(client)
            
            # Prepare request data
            request_data = {
                "CANO": os.environ["KIS_CANO"],  # 계좌번호
                "ACNT_PRDT_CD": "01",  # 계좌상품코드
                "INQR_STRT_DT": start_date,  # 조회시작일자
                "INQR_END_DT": end_date,  # 조회종료일자
                "SLL_BUY_DVSN_CD": "00",  # 매도매수구분
                "INQR_DVSN": "00",  # 조회구분
                "PDNO": "",  # 종목코드
                "CCLD_DVSN": "00",  # 체결구분
                "ORD_GNO_BRNO": "",  # 주문채번지점번호
                "ODNO": "",  # 주문번호
                "INQR_DVSN_3": "00",  # 조회구분3
                "INQR_DVSN_1": "",  # 조회구분1
                "CTX_AREA_FK100": "",  # 연속조회검색조건100
                "CTX_AREA_NK100": "",  # 연속조회키100
            }
            
            response = await client.get(
                f"{TrIdManager.get_domain('order_list')}{ORDER_LIST_PATH}",
                headers={
                    "content-type": CONTENT_TYPE,
                    "authorization": f"{AUTH_TYPE} {token}",
                    "appkey": os.environ["KIS_APP_KEY"],
                    "appsecret": os.environ["KIS_APP_SECRET"],
                    "tr_id": TrIdManager.get_tr_id("order_list")
                },
                params=request_data
            )
            
            if response.status_code != 200:
                raise Exception(f"Failed to get order list: {response.text}")
            
            return response.json()
  • server.py:407-410 (registration)
    Registers the tool with MCP framework using the @mcp.tool decorator, specifying the name and description.
    @mcp.tool(
        name="inquery-order-list",
        description="Get daily order list from Korea Investment & Securities",
    )
  • Input schema defined by function parameters (start_date: str, end_date: str) and docstring describing expected formats (YYYYMMDD) and return type.
    async def inquery_order_list(start_date: str, end_date: str):
        """
        Get daily order list from Korea Investment & Securities
        
        Args:
            start_date: Start date (YYYYMMDD)
            end_date: End date (YYYYMMDD)
            
        Returns:
            Dictionary containing order list information
        """

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/migusdn/KIS_MCP_Server'

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