# open-trading-api ships four sample trees and one argument that moves a paper example to live orders

> The official sample repository for Korea Investment and Securities Open API, written in Korean and laid out for both people and language models. Two things dominate any reading of it: a credentials file that reconstructs an account number from two halves, and a single argument in a sample auth call that switches the whole pipeline from simulated to real trading.

**koreainvestment/open-trading-api** — Korea Investment & Securities Open API Github

- Repository: https://github.com/koreainvestment/open-trading-api
- Website: https://apiportal.koreainvestment.com
- Stars: 1,629 · Forks: 830
- Language: Python
- License: not declared
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/koreainvestment-open-trading-api

## The guide is Korean only, and the layout is built to be read by a model

Everything in the document is in Korean. There is no English version among the top-level entries, so a reader who does not read Korean is working from a translation of their own.

The repository states its intent before anything else. A block at the top offers an llms.txt file so that ChatGPT, Claude and other agents can navigate the repository, and the stated audience is split three ways: Python developers using the KIS Open API for the first time, existing Open API users who want to see the structure improved, and people building code agents for instrument search, price analysis and automated trading.

The layout follows from that. examples_llm/ is organised one folder per single API function, so a model looking for one endpoint finds one folder rather than a search across a large file. examples_user/ is the mirror image, organising everything by product category so a person can read a whole area at once. The two trees carry the same eight categories in both layouts: authentication, domestic stocks, domestic bonds, domestic futures and options, overseas stocks, overseas futures and options, ELW, and ETF and ETN.

Inside examples_llm/ each function is one file named after the function, with a companion test file prefixed chk_ that runs the call and checks the result.

## The folder listing stops on a branch marker, and two directories are never introduced

The structure section prints an ASCII tree of the project and it does not finish. The listing reaches into the authentication folder, into auth_token for REST access tokens and auth_ws_token for websocket connection keys, then into domestic_bond and its inquire_price folder for single-function folders, and the last line is a branch marker with nothing after it. The tree simply stops there.

The top-level entries tell a slightly longer story than the documented structure does. Alongside README.md, docs/, examples_llm/, examples_user/, strategy_builder/ and backtester/, the repository also holds an MCP/ directory for connecting the KIS code assistant and a trading MCP server, a legacy/ directory, a stocks_info/ directory, llms.txt, pyproject.toml, requirements.txt, uv.lock and kis_devlp.yaml.

Of those, MCP/ appears later in the guide as one row of the AI trading tools table. legacy/ and stocks_info/ do not appear anywhere in the document. So the folder structure section is both incomplete at its end and missing two directories that exist, which is worth knowing before you assume an unmentioned folder is yours to change.

## The packaging file calls it kis-github 1.0.0, and there are three dependency files

The project metadata does not use the repository's own name:

```toml
[project]
name = "kis-github"
version = "1.0.0"
requires-python = ">=3.11"
dependencies = [
    "pandas>=2.3.1",
    "pycryptodome>=3.23.0",
    "pyqt6>=6.9.1",
    "pyside6>=6.9.1",
    "pyyaml>=6.0.2",
    "requests>=2.32.4",
    "websockets>=15.0.1",
]
```

The distribution name is kis-github, the version is 1.0.0, and the repository publishes no GitHub releases, so there is no tag to compare that version against.

There are also three dependency declarations rather than one: this file, a requirements.txt that pins every package with an exact equals sign, and uv.lock. The guide recommends uv and installs with one command after the clone:

```bash
git clone https://github.com/koreainvestment/open-trading-api
cd open-trading-api

# uv를 사용한 의존성 설치 - 한줄로 끝
uv sync
```

uv sync reads the project file and the lock, which means requirements.txt is never the path the documented install takes. It is kept in the repository and nothing in the guide refers to it.

## Two Qt bindings are unconditional runtime dependencies

Both pyqt6 and pyside6 are declared as hard dependencies, and both are pinned in the second declaration file along with their shim packages:

```
pyqt6==6.9.1
pyqt6-qt6==6.9.1
pyqt6-sip==13.10.2
pyside6==6.9.1
shiboken6==6.9.1
numpy==2.3.1
```

PyQt6 and PySide6 are two separate Python bindings to the same Qt toolkit. Installing both means two copies of the Qt runtime on one machine, for a repository whose stated subject is HTTP and websocket calls to a brokerage API. The visual components that plausibly need a GUI are the strategy builder and the backtester front end, and those are listed as optional extras requiring Node.js 18 and Docker Desktop.

The same file also pins numpy, which the project metadata does not declare even though pandas needs it, and it pins all twenty-one packages exactly while the project metadata uses lower bounds. So a pip install from requirements.txt and a uv sync from the project file are two different dependency resolutions of the same repository, and only one of them is the documented path.

## The credentials file reconstructs an account number from two halves

Authentication runs through one file. The guide asks you to copy kis_devlp.yaml out of the project root into your home directory:

```bash
mkdir -p ~/KIS/config
cp kis_devlp.yaml ~/KIS/config/
```

The default path is ~/KIS/config/kis_devlp.yaml, and the location is set by a config_root value in kis_auth.py if you want it elsewhere. What goes in the file:

```
my_app: "여기에 실전투자 앱키 입력"
my_sec: "여기에 실전투자 앱시크릿 입력"
paper_app: "여기에 모의투자 앱키 입력"
paper_sec: "여기에 모의투자 앱시크릿 입력"
my_htsid: "사용자 HTS ID"
my_acct_stock: "증권계좌 8자리"
my_acct_future: "선물옵션계좌 8자리"
my_prod: "01" # 종합계좌
# my_prod: "03" # 국내선물옵션 계좌
# my_prod: "08" # 해외선물옵션 계좌
# my_prod: "22" # 개인연금 계좌
# my_prod: "29" # 퇴직연금 계좌
my_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.3
```

Two application secrets, one for the live environment and one for the simulated one, sit in plaintext. So does the HTS ID, described as the KIS Developers customer ID used for trade notifications and conditional order lists. The account number is split into its first eight digits and a two digit product code, with exactly one product code active and four commented out, covering combined accounts, domestic and overseas futures and options accounts, and two pension account types.

The last line of the sample is unfinished. The user agent value ends at AppleWebKit/537.3 with the string still open, in the same file where the guide recommends keeping the default.

## One argument moves a sample file from simulated trading to real orders

The guide's own instruction for testing against the live environment is an edit to the authentication call in the file you run:

```python
import kis_auth as ka

# 실전투자 인증
ka.auth(svr="prod", product="01") # 모의투자: svr="vps"
```

svr is the switch, with vps named as the simulated value, and product is the two digit account code from the credentials file. The guide points at domestic_stock/domestic_stock_examples.py as the place to check this, and describes the result as being able to run trading tests in the live environment through a custody account.

There is no confirmation step in that description, no environment variable, no separate configuration file, and no mention anywhere of a dry run beyond the simulated server itself. The change is one word in one argument at the top of a sample file, which is also the kind of change that survives a copy and paste between branches.

That matters more than usual here because the samples are only the front of a pipeline. The AI trading tools section describes strategy design, backtesting and order execution as one chain, and the flow diagram ends with BUY, SELL and HOLD signals going to the KIS Open API. An MCP directory connects the same API to AI tooling. Nothing in the document sits between a language model and a live order except the argument above.

## A YAML file is the interface between the strategy builder and the backtester

The two new directories are the interesting engineering. strategy_builder/ designs a strategy in a visual interface and emits signals, with eighty technical indicators and ten preset strategies. backtester/ validates a designed strategy against past data as a Docker based QuantConnect Lean engine producing HTML reports. Both need extra software: Node.js 18 or newer for the front ends and Docker Desktop for the Lean engine.

The contract between them is one file. A strategy designed in the builder is exported as .kis.yaml and imported unchanged by the backtester, and the ten presets are supported identically on both sides. They are named for what they do: a golden cross and a momentum rule and a trend filter that buy when a short average crosses above a long one, when recent returns are high, or when price is above a long average; a 52 week high and a volatility expansion rule that buy on breakouts; a consecutive up or down day rule; a deviation ratio rule that sells on overbought and buys on oversold; a failed breakout rule that is a stop loss; a strong close rule; and a mean reversion rule.

The loop the diagram draws is design, export, backtest, and send back when validation completes. The guide's framing is that Cadence comes last, and this repository is where that rule is easy to break, because the same signals that a backtester consumes can also reach the order API.

## The liability notice is in the guide, and the licence file is not in the tree

The first block of the document is a notice with three parts. The sample code is an example of integrating with the Korea Investment Open API, provided for reference so that customers have less development burden. The samples may be updated without separate notice. And the company is not responsible for losses caused by customer programs built using them.

That is a reasonable set of terms for reference code, and it is also the only statement of terms in the repository. There is no LICENSE file among the top-level entries, and no licence is declared in the project metadata. So the samples are offered with a warranty disclaimer and without a licence grant, which leaves the question of what you may do with them unanswered by anything in the tree.

The last recorded change to the repository is dated 2026-09-28, and the guide points readers to a developer portal for applying for the Open API service, for linking an ID, and for receiving an app key and app secret separately for the live and simulated environments.

## Conclusion

Read this repository as a brokerage's published interface surface, not as a trading system to run. The order path is real: a strategy builder emits BUY, SELL and HOLD signals, a YAML file carries them to a backtester, and the same file can be pointed at the live API, with one argument in one sample function and no further guard mentioned anywhere in the guide. Two things to settle before any of that runs. First, the account is not a number here but a combination of an eight digit account, a two digit product code and an HTS ID, all stored in plaintext YAML in your home directory. Second, there is no licence file among the top-level entries, and the guide itself says the samples may change without notice and that losses from programs built on them are not the company's responsibility.

## FAQ

### What does the koreainvestment/open-trading-api repository contain?

Four trees of sample code. examples_llm/ holds one folder per single API function for language models to navigate, examples_user/ holds every function of a product category integrated together, strategy_builder/ designs strategies and emits BUY, SELL and HOLD signals, and backtester/ validates a strategy against past data using Docker based QuantConnect Lean.

### What does open-trading-api need before it can talk to the API?

A KIS account with the ID linked, an application for the Open API service, and an app key and app secret issued separately for the live and the simulated environment, plus an HTS ID and account numbers. Those go into kis_devlp.yaml, read from ~/KIS/config/ by default, with the path set by config_root in kis_auth.py.

### How is the simulated trading environment selected in open-trading-api?

Through the auth call in the file you run. The sample shown uses ka.auth(svr="prod", product="01") for the live environment, with the simulated environment named as svr="vps", and the guide directs you to domestic_stock/domestic_stock_examples.py to review that setting.

### Which Python version and package manager does open-trading-api expect?

Python 3.11 or higher, and uv as the recommended package manager. The documented install is a clone followed by uv sync, and the project metadata declares requires-python of 3.11 or higher. A requirements.txt with exact pins also exists but is not the documented path.

### Is there a licence for the code in open-trading-api?

No licence file appears among the top-level entries and none is declared. What the guide does carry is a notice that the samples are reference code, may be updated without separate notice, and that the company is not responsible for losses caused by customer programs built on them.

## Sources

- [Issues](https://github.com/koreainvestment/open-trading-api/issues)
- [koreainvestment/open-trading-api on GitHub](https://github.com/koreainvestment/open-trading-api)
- [Project website](https://apiportal.koreainvestment.com)
- [README](https://github.com/koreainvestment/open-trading-api/blob/main/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/koreainvestment-open-trading-api
