Skip to main content
Glama
migusdn

KIS REST API MCP Server

inquery-balance

Retrieve current stock balance details for Korea Investment & Securities accounts using the KIS REST API MCP Server. Simplify account management and stock tracking with real-time balance information.

Instructions

Get current stock balance information from Korea Investment & Securities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'inquery-balance' tool. It authenticates with the Korea Investment & Securities API, prepares the request parameters for balance inquiry, and returns the JSON response containing stock balance details.
    @mcp.tool( name="inquery-balance", description="Get current stock balance information from Korea Investment & Securities", ) async def inquery_balance(): """ Get current stock balance information from Korea Investment & Securities Returns: Dictionary containing stock balance information including: - pdno: Stock code - prdt_name: Stock name - hldg_qty: Holding quantity - pchs_amt: Purchase amount - prpr: Current price - evlu_amt: Evaluation amount - evlu_pfls_amt: Evaluation profit/loss amount - evlu_pfls_rt: Evaluation profit/loss rate """ async with httpx.AsyncClient() as client: token = await get_access_token(client) logger.info(f"TrIdManager.get_tr_id('balance'): {TrIdManager.get_tr_id('balance')}") # Prepare request data request_data = { "CANO": os.environ["KIS_CANO"], # 계좌번호 "ACNT_PRDT_CD": "01", # 계좌상품코드 (기본값: 01) "AFHR_FLPR_YN": "N", # 시간외단일가여부 "INQR_DVSN": "01", # 조회구분 "UNPR_DVSN": "01", # 단가구분 "FUND_STTL_ICLD_YN": "N", # 펀드결제분포함여부 "FNCG_AMT_AUTO_RDPT_YN": "N", # 융자금액자동상환여부 "PRCS_DVSN": "00", # 처리구분 "CTX_AREA_FK100": "", # 연속조회검색조건100 "CTX_AREA_NK100": "", # 연속조회키100 "OFL_YN": "" # 오프라인여부 } response = await client.get( f"{TrIdManager.get_domain('balance')}{BALANCE_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("balance") }, params=request_data ) if response.status_code != 200: raise Exception(f"Failed to get balance: {response.text}") return response.json()

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