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
| Name | Required | Description | Default |
|---|---|---|---|
| start_date | Yes | ||
| end_date | Yes |
Implementation Reference
- server.py:411-458 (handler)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", )
- server.py:411-421 (schema)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 """