inquery-order-list
Retrieve daily order lists from Korea Investment & Securities by specifying start and end dates using the KIS REST API MCP Server.
Instructions
Get daily order list from Korea Investment & Securities
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end_date | Yes | ||
| start_date | Yes |
Implementation Reference
- server.py:411-458 (handler)The handler function that implements the core logic for the 'inquery-order-list' tool. It makes an API call to the Korea Investment & Securities endpoint for daily order lists using the provided date range.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)The @mcp.tool decorator registers the 'inquery-order-list' tool with the MCP server, specifying its name and description.@mcp.tool( name="inquery-order-list", description="Get daily order list from Korea Investment & Securities", )
- server.py:412-421 (schema)The docstring provides the input schema (parameters: start_date, end_date as strings in YYYYMMDD format) and output description for the tool.""" 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 """
- server.py:78-78 (helper)TR ID for order_list operation in real account."order_list": "TTTC8001R", # 일별주문체결조회
- server.py:106-106 (helper)TR ID for order_list operation in virtual account."order_list": "VTTC8001R", # 일별주문체결조회