Open Trading API
Korea Investment & Securities Open API Github
What is Open Trading API?
Open Trading API is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to korea investment & securities open api github
Korea Investment & Securities Open API Github
This server falls under the Finance & Fintech category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Korea Investment & Securities Open API Github
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx open-trading-apiConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Open Trading API
The Korea Investment & Securities Open Trading API repository provides official Python sample code and an MCP-based AI trading toolkit for developers integrating with the KIS (Korea Investment & Securities) Open API. It covers REST and WebSocket access for domestic stocks, bonds, futures/options, overseas stocks, ETFs, and ELWs — with LLM-optimized single-function samples in examples_llm/ and full integration examples in examples_user/. Quantitative developers and automated trading engineers use it to build AI-driven Korean market trading bots, backtest strategies with QuantConnect Lean, and let LLM agents directly call trading APIs via the included MCP server.
Prerequisites
- Python 3.11 or later
- uv package manager (recommended) or pip
- A Korea Investment & Securities account with Open API service activated at apiportal.koreainvestment.com
- An App Key and App Secret from the KIS Developer portal (separate keys for paper trading and live trading)
- An MCP-compatible AI client such as Claude Desktop or Claude Code for the MCP integration
Apply for KIS Open API access
You must have a KIS brokerage account and apply for Open API access at the KIS Developer Portal. After approval, generate your App Key and App Secret for both paper trading (모의투자) and live trading (실전투자) environments.
# Visit: https://apiportal.koreainvestment.com/about-howtoClone the repository and install dependencies
Clone the open-trading-api repository and install Python dependencies using uv. The uv sync command reads pyproject.toml and installs everything in one step.
git clone https://github.com/koreainvestment/open-trading-api
cd open-trading-api
# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install project dependencies
uv syncConfigure kis_devlp.yaml with your API credentials
Edit the kis_devlp.yaml configuration file in the project root. Fill in your App Key, App Secret, account number, and whether you are using paper trading or live trading mode. This file is read by the shared kis_auth.py authentication module.
# Edit kis_devlp.yaml:
# app_key: your-app-key-here
# app_secret: your-app-secret-here
# account_no: your-account-number
# is_paper_trading: true # set false for live tradingTest authentication and token generation
Run the authentication example to verify your credentials and generate an access token. The token is cached and reused for subsequent API calls.
# Using uv
uv run python examples_llm/kis_auth.py
# Or: python examples_llm/kis_auth.py (with venv activated)Run a sample API call
Try an LLM-optimized single-function sample to verify end-to-end connectivity. For example, query the current price of a domestic stock.
# Domestic stock price inquiry
uv run python examples_llm/domestic_stock/inquire_price/inquire_price.pyConnect the MCP server to your AI client
The MCP/ directory contains the KIS Code Assistant and Trading MCP server. Add it to your MCP client configuration to allow an LLM agent to call trading APIs and query market data directly.
Open Trading API Examples
Client configuration
Add the KIS Open Trading API MCP server to Claude Desktop. Your App Key, App Secret, and account number are passed as environment variables.
{
"mcpServers": {
"open-trading-api": {
"command": "npx",
"args": ["open-trading-api"],
"env": {
"KIS_APP_KEY": "your-app-key-here",
"KIS_APP_SECRET": "your-app-secret-here",
"KIS_ACCOUNT_NO": "your-account-number",
"KIS_IS_PAPER_TRADING": "true"
}
}
}
}Prompts to try
These prompts work with an LLM agent connected to the KIS Open Trading API MCP server.
- "Fetch the current price and trading volume for Samsung Electronics (005930) on the KRX."
- "Place a paper-trading buy order for 10 shares of Kakao (035720) at the current market price."
- "Get my current portfolio balance and show unrealized gains and losses for each position."
- "Stream real-time price ticks for KOSPI 200 index futures via WebSocket for the next 60 seconds."
- "Query the overseas stock price for Apple (AAPL) on the NASDAQ using the KIS overseas API."Troubleshooting Open Trading API
Access token generation fails with an authentication error
Verify that your App Key and App Secret in kis_devlp.yaml exactly match what is shown in the KIS Developer Portal. Also confirm that the Open API service is activated on your account — there is sometimes a delay of several hours after initial application before access is granted.
API calls succeed in paper trading but fail with errors in live trading
Paper trading (모의투자) and live trading (실전투자) use different App Keys. Ensure you have generated a separate App Key for live trading and have set 'is_paper_trading: false' in kis_devlp.yaml. Some API endpoints also differ between the two environments.
WebSocket connection disconnects after a short period
KIS WebSocket connections require periodic keep-alive messages (PINGPONG). The examples_user/*_functions_ws.py files include the correct keep-alive handling. If you are building a custom WebSocket client, implement the PINGPONG response as documented in the KIS API portal's WebSocket guide.
Frequently Asked Questions about Open Trading API
What is Open Trading API?
Open Trading API is a Model Context Protocol (MCP) server that korea investment & securities open api github It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Open Trading API?
Follow the installation instructions on the Open Trading API GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Open Trading API?
Open Trading API works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Open Trading API free to use?
Yes, Open Trading API is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Open Trading API Alternatives — Similar Finance & Fintech Servers
Looking for alternatives to Open Trading API? Here are other popular finance & fintech servers you can use with Claude, Cursor, and VS Code.
ValueCell
★ 10.7kValueCell is a community-driven, multi-agent platform for financial applications.
Vibe Trading
★ 8.1k'Vibe-Trading: Your Personal Trading Agent'
Quantdinger
★ 6.2kAI quantitative trading platform for crypto, stocks, and forex with backtesting, live trading, market data, and multi-agent research.vibe-trading ,trading-agents,ai-trader,ai-trading
TradingView
★ 2.8kReal-time crypto & stock screening, advanced technical indicators, Bollinger Bands intelligence, candlestick patterns + native Claude Desktop integration. Multi-exchange (Binance, KuCoin, Bybit+). Open-source AI trading infrastructure.
Financial Datasets
★ 2.1kProvides access to comprehensive financial data including income statements, balance sheets, cash flow statements, stock prices, company news, SEC filings, and cryptocurrency information with built-in financial ratio analysis.
Stripe
★ 1.6kThe Stripe Model Context Protocol server allows you to integrate with Stripe APIs through function calling. This protocol supports various tools to interact with different Stripe services.
Browse More Finance & Fintech MCP Servers
Explore all finance & fintech servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Open Trading API in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Open Trading API?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.