Skip to main content

kxt — Korean Securities Market Access SDK for Python

PyPI Python License: MIT

kxt is an async, library-first Python SDK for Korean securities market access. It provides broker-neutral request and response models with current KIS and Toss Invest provider clients. Documentation is written in Korean and published at https://pumpkinredbean.github.io/kxt/.


kxt는 한국 증권시장 접근을 비동기 파이썬으로 다루기 위한 라이브러리 우선 SDK입니다. 브로커 중립 요청·응답 DTO를 중심에 두고, 현재 구현 상태로 KIS와 Toss Invest 프로바이더 클라이언트를 제공합니다.

Audience

  • 파이썬으로 KRX 데이터를 수집하거나 자동매매 코드를 작성하는 개발자
  • ccxt 계열의 브로커 중립 인터페이스를 한국 시장에서 찾는 사용자
  • 라이브러리 우선(runtime-free) SDK를 선호하는 사용자

Key features

  • 비동기 전용 — async/await 기반, 이벤트 루프 친화적
  • 브로커 중립 DTO — Trade, Bar, OrderBookSnapshot 등 정규화된 응답 타입 (입력은 종목 코드 문자열)
  • 시세·주문·스트림 — get_bars, get_quote, submit_order, stream_trades 등 flat 메서드. Toss Invest는 최대 200개 batch quote를 지원하고, 스트리밍은 현재 KIS만 지원합니다.
  • 얇은 CLI — 동일한 코드 경로를 kxt bars, kxt quote 같은 명령으로 호출

Import policy

  • from kxt import ... — KISClient, TossInvestClient, 응답·이벤트 DTO, enum, 에러 등 사용자가 읽는 타입.
  • from kxt.requests import ... — BarsRequest, SubmitOrderRequest, *Cursor, *Subscription, OrderInstruction, OrderAmendment, ProviderRef 같은 power-user 입력 DTO. 일반 호출은 primitive(symbol 문자열, kwargs)만으로 충분합니다.
  • from kxt.models import ... — 모든 DTO를 통째로 introspection할 때.

Install

pip install kxt

최신 공개 릴리스가 설치됩니다.

Quick start

import asyncio
from datetime import date, timedelta

from kxt import KISClient


async def main() -> None:
    async with KISClient(
        app_key="<APP_KEY>",
        app_secret="<APP_SECRET>",
    ) as client:
        today = date.today()
        response = await client.get_bars(
            "005930",  # 삼성전자
            timeframe="day",
            start=today - timedelta(days=14),
            end=today,
        )
        for bar in response.bars[-5:]:
            print(bar.opened_at.date(), bar.close)


asyncio.run(main())

<APP_KEY> / <APP_SECRET>은 본인의 KIS OpenAPI 자격증명으로 대체하세요. SDK는 환경변수에 관여하지 않습니다. 환경변수 기반 흐름은 CLI에서만 사용합니다.

Toss Invest를 사용할 때는 TossInvestClient(client_id="...", client_secret="...")를 사용합니다. 계좌·주문 메서드는 account_seq가 필요합니다.

Documentation

전체 한국어 문서: https://pumpkinredbean.github.io/kxt/

로컬에서 빌드하려면:

uv sync --all-extras
uv run pytest
uv run mkdocs serve
uv build

Status

현재 0.x 릴리스 단계입니다. 공개 API는 1.0 이전까지 변경될 수 있습니다. 실거래 전에 반드시 소량으로 검증하세요.

License

MIT. LICENSE 참조.

Metadata

Release files for kxt 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kxt 0.2.0
File Size Uploaded Provenance Actions
kxt-0.2.0.tar.gz 101.5 kB With provenance Details for kxt-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kxt 0.2.0
File Interpreter ABI Platform Actions
kxt-0.2.0-py3-none-any.whl Python 3 none any Details for kxt-0.2.0-py3-none-any.whl

Total release size: 202.2 kB

Release files / kxt-0.2.0.tar.gz

Download URL kxt-0.2.0.tar.gz
Size 101.5 kB
Tags Source
SHA-256 checksum
How to use checksums
259f49cd302d3ce3823c2e7b0173bcf0911712c098a96ce8bf1fb2a3162c7251
BLAKE2b-256 checksum
How to use checksums
cd27128e46fbfcc1f6a5928e7a82f1f3c1e7077616153e244d9eba057876dce7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

Release files / kxt-0.2.0-py3-none-any.whl

Download URL kxt-0.2.0-py3-none-any.whl
Size 100.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b3b1c45e08e702169472ed904ee09f84b104092ff04a0a85f50701f20d1a8e0
BLAKE2b-256 checksum
How to use checksums
d00c5d340c5c8240c10b20aad9f447aa54c9e0c03beab99c59b259c7b2499d35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

Security for kxt 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kxt-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page