koreainvestment/open-trading-api
Korea Investment & Securities Open API Github
What it solves
This project provides a comprehensive set of sample codes and tools to help developers and AI agents integrate with the Korea Investment & Securities (KIS) Open API. It simplifies the process of accessing market data, managing accounts, and executing trades for various financial instruments including domestic and overseas stocks, bonds, and futures/options.
How it works
The repository is organized into different layers based on the user's needs:
- LLM-Optimized Samples (
examples_llm/): Small, single-function code snippets designed for AI agents to easily browse and call specific API features. - User-Integrated Samples (
examples_user/): Grouped functions and execution examples organized by asset class for human developers. - Strategy Builder: A visual UI tool to design trading strategies using technical indicators and generate buy/sell/hold signals.
- Backtester: A Docker-based engine (using QuantConnect Lean) that validates designed strategies against historical data.
- Authentication: A centralized
kis_auth.pymodule handles token issuance and environment switching (real vs. mock trading).
Who it’s for
- Python developers new to the KIS Open API.
- Traders looking to improve their existing API implementation or structure.
- Developers building AI-driven trading agents for stock searching, price analysis, and automated trading.
Highlights
- AI-Ready Structure: Includes an
llms.txtfile and a specific folder structure to make the API accessible to LLMs like ChatGPT and Claude. - End-to-End Pipeline: Supports a full workflow from strategy design (Strategy Builder) to historical validation (Backtester) and execution.
- Broad Asset Support: Covers domestic/overseas stocks, bonds, ELW, ETF/ETN, and futures/options.
- Preset Strategies: Includes 10 pre-defined trading strategies (e.g., Golden Cross, Momentum, Mean Reversion) for quick start.