Skip to main content
Glama
ChunSam

kiwoom-mcp-server

by ChunSam

대차거래 추이 조회

get_stock_lending

Get stock lending trends for a stock or market, or rank stocks by lending balance on a date. Use trend for history, balance_rank for rankings.

Instructions

대차거래(주식 대여) 정보를 조회합니다 (키움 ka10068/ka20068/ka90012). view=trend(기본)은 일자별 추이 — 체결·상환·증감 주수와 대차잔고, 잔고금액을 시계열로 보여줍니다. stock_code를 지정하면 해당 종목, 생략하면 시장 전체 집계이고 기본 기간은 최근 30일입니다. view=balance_rank는 특정 하루의 대차잔고가 가장 많은 종목 순위입니다 — '어느 종목에 대차 물량이 쌓여 있나'를 물을 때 쓰고, 한 종목의 시간 흐름은 trend를 쓰세요. balance_rank는 시장 전체 횡단면이라 stock_code·from_date를 받지 않으며(주면 무시하고 각주로 알립니다), 기준일은 to_date로 지정하되 생략하는 쪽이 안전합니다 — 당일 집계는 장 마감 후 저녁 늦게(20시 무렵) 열려서, 오늘을 직접 지정하면 그전까지 빈 결과이고 생략하면 최신 집계일로 자동으로 물러섭니다. 공매도 흐름과 함께 보려면 get_short_selling을 참고하세요.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topNoview=balance_rank의 표시 종목 수 (기본값 20, 최대 50)
viewNo조회 종류 (기본값: trend)
to_dateNo조회 종료일 (기본값: 오늘). view=balance_rank에서는 순위의 기준일이며, 오늘을 지정하면 저녁 집계 전까지 빈 결과입니다 — 생략하면 최신 집계일로 자동으로 물러섭니다
from_dateNo조회 시작일 (기본값: 30일 전). view=balance_rank에서는 무시됩니다
stock_codeNo6자리 종목코드 (생략 시 시장 전체 대차 추이). view=balance_rank에서는 무시됩니다

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.52.4
    • changedInput schema / properties / to_date / description
      Previous value: -"조회 종료일 (기본값: 오늘). view=balance_rank에서는 순위의 기준일입니다"New value: +"조회 종료일 (기본값: 오늘). view=balance_rank에서는 순위의 기준일이며, 오늘을 지정하면 저녁 집계 전까지 빈 결과입니다 — 생략하면 최신 집계일로 자동으로 물러섭니다"
  2. Changed5 schema fields changedv0.51.0
    • changedInput schema / properties / from_date / description
      Previous value: -"조회 시작일 (기본값: 30일 전)"New value: +"조회 시작일 (기본값: 30일 전). view=balance_rank에서는 무시됩니다"
    • changedInput schema / properties / stock_code / description
      Previous value: -"6자리 종목코드 (생략 시 시장 전체 대차 추이)"New value: +"6자리 종목코드 (생략 시 시장 전체 대차 추이). view=balance_rank에서는 무시됩니다"
    • changedInput schema / properties / to_date / description
      Previous value: -"조회 종료일 (기본값: 오늘)"New value: +"조회 종료일 (기본값: 오늘). view=balance_rank에서는 순위의 기준일입니다"
    • addedInput schema / properties / top
      Added value: +{
      +  "description": "view=balance_rank의 표시 종목 수 (기본값 20, 최대 50)",
      +  "maximum": 50,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / view
      Added value: +{
      +  "description": "조회 종류 (기본값: trend)",
      +  "enum": [
      +    "trend",
      +    "balance_rank"
      +  ],
      +  "type": "string"
      +}
  3. Changed1 schema field changedv0.26.0
    • changedInput schema / properties / stock_code / pattern
      Previous value: -"^\\d{6}$"New value: +"^[0-9A-Z]{6}$"
  4. Addedv0.16.0

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses non-obvious behaviors: `balance_rank` ignores certain parameters (and does so with a footnote), same-day data only becomes available after ~20:00 (otherwise empty results), and omitting `to_date` automatically falls back to the latest aggregation date. It does not mention auth or rate limits, but core invocation behaviors are well covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is moderately long but well-structured: it leads with purpose, then explains each view, then covers parameter behavior and a timing caveat. It is dense and every sentence contributes value, but it could be slightly tightened without losing critical nuance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 5 optional parameters, no output schema, and no annotations, the description thoroughly covers purpose, usage, parameter interactions, and edge-case timing behavior. It clearly explains what trend fields are shown, but does not detail the return structure for `balance_rank`, which is a minor gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds contextual value beyond the schema: it explains the `view` enum semantics, the default recent-30-day period, which parameters are ignored in `balance_rank`, and why omitting `to_date` is safer. This goes beyond the field-level descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description precisely states it queries stock lending (securities lending) information and distinguishes two views: `trend` (daily time series of contract/repayment/change and lending balance) and `balance_rank` (ranking of stocks by largest lending balance on a given day). It also clearly differentiates itself from sibling `get_short_selling` by cross-referencing it.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly tells when to use `balance_rank` ('which stocks have accumulated lending volume') vs `trend` for a single stock's flow. It also warns that `balance_rank` ignores `stock_code` and `from_date`, advises omitting `to_date` for safety due to late evening aggregation, and points to `get_short_selling` for combined short-selling flow.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.