open-trading-api  by koreainvestment

Python SDK for Korea Investment & Securities Open API

Created 3 years ago
801 stars

Top 44.0% on SourcePulse

GitHubView on GitHub
Project Summary

This repository provides sample Python code for interacting with the Korea Investment & Securities (KIS) Open API, targeting both Python developers and LLM-based automation agents. It simplifies understanding and utilizing the KIS API for tasks like stock price analysis and automated trading, offering a structured approach for both individual API calls and integrated trading functions.

How It Works

The project is organized into two main directories: examples_llm for granular, LLM-friendly API function samples, and examples_user for integrated, product-specific examples for human developers. It supports REST and WebSocket connections, with common authentication and environment switching handled by kis_auth.py. The structure separates single API functions with test files in examples_llm and provides consolidated function and example files per asset class in examples_user.

Quick Start & Requirements

  • Installation: Clone the repository and use uv sync for dependency management.
  • Prerequisites: Python 3.9+, uv package manager, KIS Open API service application, App Key/Secret for both real and paper trading accounts, HTS ID, and account numbers.
  • Configuration: Update kis_devlp.yaml with API credentials and adjust kis_auth.py's config_root path.
  • Documentation: KIS Developers Portal

Highlighted Details

  • Supports a wide range of asset classes including domestic stocks, bonds, futures/options, and overseas stocks/futures/options.
  • Differentiated folder structure for LLM-friendly single-function exploration (examples_llm) and user-friendly integrated examples (examples_user).
  • Includes examples for both REST and WebSocket API interactions.
  • Provides guidance on handling authentication, token errors, and common configuration issues.

Maintenance & Community

The repository is maintained by Korea Investment & Securities. For inquiries, users are directed to the "Customer Voice" section on the Korea Investment & Securities website after logging in.

Licensing & Compatibility

The repository's license is not explicitly stated in the README. However, as it's an official sample code from Korea Investment & Securities, it's intended for use with their API services. Commercial use would likely be governed by the terms of service of the KIS Open API.

Limitations & Caveats

The sample code is provided for reference and may be updated without notice; the provider is not liable for damages resulting from its use. Users must obtain their own KIS API credentials. The README does not specify the exact license, which could impact commercial use or integration into closed-source projects.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
205 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.