Skip to content

Instantly share code, notes, and snippets.

@cr0sh
Created March 11, 2026 12:11
Show Gist options
  • Select an option

  • Save cr0sh/bba130593d9d7ccdf9d222fd000fbfb0 to your computer and use it in GitHub Desktop.

Select an option

Save cr0sh/bba130593d9d7ccdf9d222fd000fbfb0 to your computer and use it in GitHub Desktop.
Korea Investment (KIS) OpenAPI skill
name description compatibility metadata
hantu-api
Retrieve and summarize Korea Investment (Hantu/KIS) Open API documentation from assets/hantu-api.xlsx in an LLM-friendly format
opencode
source workbook
project-local
assets/hantu-api.xlsx

What I do

  • Find relevant Hantu API endpoints from the workbook catalogue.
  • Fetch the full manual for a specific endpoint by 순번.
  • Convert the raw CSV-like sheet into a compact engineering summary.

When to use me

Use this skill when you need Korea Investment Securities Open API docs, also called Hantu or KIS API docs, and the source of truth is assets/hantu-api.xlsx.

Workflow

  1. Print the catalogue sheet:
bunx xlsx-cli assets/hantu-api.xlsx
  1. Filter the output with rg to find candidates:
bunx xlsx-cli assets/hantu-api.xlsx | rg '주식현재가 시세|inquire-price|FHKST01010100'
bunx xlsx-cli assets/hantu-api.xlsx | rg '\[국내주식\].*주문/계좌'
bunx xlsx-cli assets/hantu-api.xlsx | rg 'WEBSOCKET|실시간체결'
  1. Read the matching row's leftmost 순번 value.

Simple index examples:

순번,API 통신방식,메뉴 위치,API 명,API ID,실전 TR_ID,모의 TR_ID,HTTP Method,URL 명
20,REST,[국내주식] 주문/계좌,주식주문(현금),v1_국내주식-001,(매도) TTTC0011U (매수) TTTC0012U,(매도) VTTC0011U (매수) VTTC0012U,POST,/uapi/domestic-stock/v1/trading/order-cash
29,REST,[국내주식] 기본시세,주식현재가 시세,v1_국내주식-008,FHKST01010100,FHKST01010100,GET,/uapi/domestic-stock/v1/quotations/inquire-price

In the index sheet, 순번 is the first column and is the value to pass to --sheet-index for endpoint detail sheets.

  1. Fetch the detailed manual for that row:
bunx xlsx-cli assets/hantu-api.xlsx --sheet-index <순번>

Workbook mapping

  • xlsx-cli -h documents --sheet-index as 0-based.
  • In this workbook, sheet 0 is the top-level catalogue API 목록.
  • Endpoint detail sheets start at 1, so catalogue 순번 maps directly to --sheet-index.

Examples:

# 순번 20 -> 주식주문(현금)
bunx xlsx-cli assets/hantu-api.xlsx --sheet-index 20

# 순번 29 -> 주식현재가 시세
bunx xlsx-cli assets/hantu-api.xlsx --sheet-index 29

How to summarize results

Prefer a compact structured summary with:

  • endpoint name and product area
  • REST vs WebSocket
  • method, domain, path
  • real TR ID and mock TR ID
  • required headers
  • query params or body fields
  • important response fields
  • mock support and special constraints
  • one minimal example request

Hantu-specific quirks

  • POST body keys are often required in uppercase exactly as documented.
  • Numeric-looking request fields are often strings and should be sent as strings.
  • Real and mock TR IDs may differ.
  • Some endpoints explicitly say 모의투자 미지원.
  • Market codes like KRX, NXT, and SOR can materially change behavior.
  • Some WebSocket docs appear in the catalogue as POST with /tryitout/...; treat those as subscription docs, not normal REST calls.

Useful xlsx-cli options

Check help with:

bunx xlsx-cli -h

Most useful options here:

  • --sheet-index <idx> to fetch a detail sheet by 순번
  • --sheet <name> to fetch by sheet name
  • --list-sheets to inspect workbook layout
  • --sheet-rows <n> to limit rows
  • --output <file> to save output
  • --field-sep <sep> to change CSV delimiter
  • --json if structured JSON output is easier than CSV
  • --txt for TSV/plain-text output
  • --quiet to reduce noise

Default CSV output is usually best for this workbook.

Response style

  • For broad searches, first return 3-10 candidate rows with 순번, API 명, API ID, TR_ID, method, and path.
  • For specific requests, fetch the matching sheet immediately.
  • Do not dump hundreds of catalogue rows unless explicitly asked.
  • Do not assume mock support when the workbook says 모의투자 미지원.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment