Skip to main content

KiwoomOpenAPI

Windows COM 기반으로 파이썬 32비트로만 동작하는 키움증권 오픈API 패키지.

KiwoomTraderV2 프로젝트 패키지의 내부 모듈을 독립적인 패키지로 분리하는 작업 완료.

사용법

데이터 요청할 때는 패키지의 함수들을 사용해야 한다.

import kiwoomapi as api
api.CommConnect()

데이터 수신할 때는 PyQt-QAxWidget 객체인 'OpenAPI'의 pyqtSinal 을 사용해야 한다.

키움증권으로부터 메시지를 수신하기 위해서는 아래와 같이 코드를 작성해야 한다.

from kiwoomapi import OpenAPI
OpenAPI.OnReceiveMessage.connect(YOUR_METHOD) 

로그인 객체 구현 예시:

from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, QEventLoop
import kiwoomapi as api
from kiwoomapi import OpenAPI

class LoginAPI(QObject):

    LoginSucceeded = pyqtSignal()

    def __init__(self):
        super().__init__()
        OpenAPI.OnReceiveMessage.connect(self.__recv_msg__)
        OpenAPI.OnEventConnect.connect(self.__recv_login__)

    @pyqtSlot(str, str, str, str)
    def __recv_msg__(self, ScrNo, RQName, TrCode, Msg):
        print([ScrNo, RQName, TrCode, Msg])
    
    @pyqtSlot(int)
    def __recv_login__(self, ErrCode):
        print(ErrCode)
        if ErrCode == 0:
            self.LoginSucceeded.emit()
        else:
            print('로그인 실패)
        self._event_loop.exit()

    def login(self):
        api.CommConnect()
        self._event_loop = QEventLoop()
        self._event_loop.exec()


app = QApplication(sys.argv)

LoginAPI = LoginAPI()
LoginAPI.login()

sys.exit(app.exec())

개발 가이드 문서

로그인-버전처리\기본설명

모의투자

로그인-버전처리

조건검색

조회와-실시간데이터처리

주문과-잔고처리

OpenAPI-오류코드

OpenAPI-사용제한

Metadata

Release files for kiwoomapi 0.5.4

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

Source distribution (sdist)

Source distribution for kiwoomapi 0.5.4
File Size Uploaded Provenance Actions
kiwoomapi-0.5.4.tar.gz 11.5 kB Without provenance Details for kiwoomapi-0.5.4.tar.gz

Built distribution (wheel)

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

Total release size: 23.6 kB

Release files / kiwoomapi-0.5.4.tar.gz

Download URL kiwoomapi-0.5.4.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1a4172b5f7675ce1b2ca731dba83f86b364a5c06659de92e3be244b50c8332de
BLAKE2b-256 checksum
How to use checksums
f11f1df1c1d840451f5f5e95d9a913b6b9bb04bdb333f556784ea65bd6fa7926
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.2

Release files / kiwoomapi-0.5.4-py3-none-any.whl

Download URL kiwoomapi-0.5.4-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3aee4723eb00d3f7118d4dafc51b8347a0825fb859a3d06123bc54ccb8a5c92
BLAKE2b-256 checksum
How to use checksums
53beca5502709f22a510548082f15a83b7ee23b2a01b299a9e343b2301bf7960
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.2

Security for kiwoomapi 0.5.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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