![header](https://capsule-render.vercel.app/api?type=waving&color=gradient&height=260§ion=header&text=%ED%8C%8C%EC%9D%B4%EC%8D%AC%20%ED%95%9C%EA%B5%AD%ED%88%AC%EC%9E%90%EC%A6%9D%EA%B6%8C%20API&fontSize=50&animation=fadeIn&fontAlignY=38&desc=KIS%20Open%20Trading%20API%20Client&descAlignY=51&descAlign=62&customColorList=24)
## 1. 파이썬용 한국투자증권 API 소개 ✨
한국투자증권의 트레이딩 OPEN API 서비스를 파이썬 환경에서 사용할 수 있도록 만든 강력한 커뮤니티 라이브러리입니다.
**2.0.0 버전 이전의 라이브러리는 [여기](https://github.com/Soju06/python-kis/tree/v1.0.6), 문서는 [1](https://github.com/Soju06/python-kis/wiki/Home/d6aaf207dc523b92b52e734908dd6b8084cd36ff), [2](https://github.com/Soju06/python-kis/wiki/Tutorial/d6aaf207dc523b92b52e734908dd6b8084cd36ff), [3](https://github.com/Soju06/python-kis/wiki/Examples/d6aaf207dc523b92b52e734908dd6b8084cd36ff)에서 확인할 수 있습니다.**
### 1.1. 라이브러리 특징
<details>
<summary>📐 모든 객체에 대한 Type hint</summary>
<ul>
<li>모든 함수와 클래스에 대해 추상화 및 Typing을 적용하여, 파이썬의 동적 타이핑을 보완합니다.</li>
<li>IDE의 자동완성을 100% 활용할 수 있으며, 공식 문서 없이 정확하고 버그 없는 개발이 가능합니다.</li>
</ul>
</details>
<details>
<summary>🔗 복구 가능한 웹소켓 클라이언트</summary>
<ul>
<li>실시간 시세, 호가, 체결 등의 실시간 데이터를 받아오는 과정에서 네트워크 문제 등으로 인해 연결이 끊겼을 때, 완벽히 복구할 수 있도록 만들어졌습니다.</li>
<li>재연결 이전에 등록된 조회도 자동으로 다시 등록하여 유실을 방지합니다.</li>
<li>한국투자증권의 웹소켓 조회 시스템을 파이썬의 메모리 관리 시스템과 완벽히 통합하여, GC에 의해 이벤트 구독이 관리됩니다.</li>
</details>
<details>
<summary>🖋️ 표준 영어 네이밍</summary>
<ul>
<li>한국투자증권의 API의 경우, 한글 발음이나 비표준 약어를 사용하는 경우가 많습니다.</li>
<li>이 라이브러리는 모든 객체에 대해 표준 영어 네이밍을 적용하여, 이해하기 쉽도록 만들었습니다.</li>
</details>
<hr>
## 2. 사용 설명 ⚙️
<details>
<summary>OpenAPI 서비스 신청 방법</summary>
1. 한국투자증권 계좌와 아이디가 필요합니다. KIS 트레이딩 서비스는 [KIS Developers 서비스](https://apiportal.koreainvestment.com/)를 통해 신청 할 수 있습니다.
![image](https://user-images.githubusercontent.com/34199905/193738291-c9c663fd-8ab4-43da-acb6-6a2f7846a79d.png)
2. 서비스를 신청이 완료되면, 아래와 같이 앱 키를 발급 받을 수 있습니다.
![image](https://user-images.githubusercontent.com/34199905/193740291-53f282ee-c40c-40b9-874e-2df39543cb66.png)
</details>
### 2.1. 라이브러리 설치 📦
라이브러리는 파이썬 3.11을 기준으로 작성되었습니다.
```zsh
pip install python-kis
```
<details>
<summary>사용된 모듈 보기</summary>
```
requests>=2.32.3
websocket-client>=1.8.0
cryptography>=43.0.0
colorlog>=6.8.2
```
</details>
<hr>
### 2.2. 라이브러리 사용 📚
#### 2.2.1. PyKis 객체 생성
1. 시크릿 키를 파일로 관리하는 방법 (권장)
먼저 시크릿 키를 파일로 저장합니다.
```python
from pykis import KisAuth
auth = KisAuth(
# HTS 로그인 ID 예) soju06
id="YOUR_HTS_ID",
# 앱 키 예) Pa0knAM6JLAjIa93Miajz7ykJIXXXXXXXXXX
appkey="YOUR_APP_KEY",
# 앱 시크릿 키 예) V9J3YGPE5q2ZRG5EgqnLHn7XqbJjzwXcNpvY . . .
secretkey="YOUR_APP_SECRET",
# 앱 키와 연결된 계좌번호 예) 00000000-01
account="00000000-01",
# 모의투자 여부
virtual=False,
)
# 안전한 경로에 시크릿 키를 파일로 저장합니다.
auth.save("secret.json")
```
그 후, 저장된 시크릿 키를 사용하여 PyKis 객체를 생성합니다.
```python
from pykis import PyKis, KisAuth
# 실전투자용 PyKis 객체를 생성합니다.
kis = PyKis("secret.json", keep_token=True)
kis = PyKis(KisAuth.load("secret.json"), keep_token=True)
# 모의투자용 PyKis 객체를 생성합니다.
kis = PyKis("secret.json", "virtual_secret.json", keep_token=True)
kis = PyKis(KisAuth.load("secret.json"), KisAuth.load("virtual_secret.json"), keep_token=True)
```
2. 시크릿 키를 직접 입력하는 방법
```python
from pykis import PyKis
# 실전투자용 한국투자증권 API를 생성합니다.
kis = PyKis(
id="soju06", # HTS 로그인 ID
account="00000000-01", # 계좌번호
appkey="PSED321z...", # AppKey 36자리
secretkey="RR0sFMVB...", # SecretKey 180자리
keep_token=True, # API 접속 토큰 자동 저장
)
# 모의투자용 한국투자증권 API를 생성합니다.
kis = PyKis(
id="soju06", # HTS 로그인 ID
account="00000000-01", # 모의투자 계좌번호
appkey="PSED321z...", # 실전투자 AppKey 36자리
secretkey="RR0sFMVB...", # 실전투자 SecretKey 180자리
virtual_id="soju06", # 모의투자 HTS 로그인 ID
virtual_appkey="PSED321z...", # 모의투자 AppKey 36자리
virtual_secretkey="RR0sFMVB...", # 모의투자 SecretKey 180자리
keep_token=True, # API 접속 토큰 자동 저장
)
```
#### 2.2.2. 시세 조회
`stock.quote()` 함수를 이용하여 국내주식 및 해외주식의 시세를 조회할 수 있습니다.
```python
from pykis import KisQuote
# 엔비디아의 상품 객체를 가져옵니다.
stock = kis.stock("NVDA")
quote: KisQuote = stock.quote()
quote: KisQuote = stock.quote(extended=True) # 주간거래 시세
# PyKis의 모든 객체는 repr을 통해 주요 내용을 확인할 수 있습니다.
# 데이터를 확인하는 용도이므로 실제 프로퍼티 타입과 다를 수 있습니다.
print(quote)
```
```python
KisForeignQuote(
symbol='NVDA',
market='NASDAQ',
name='엔비디아',
sector_name='반도체 및 반도체장비',
volume=1506310,
amount=160791125,
market_cap=2593332000000,
indicator=KisForeignIndicator(
eps=1.71,
bps=2,
per=63.88,
pbr=54.65,
week52_high=140.76,
week52_low=39.2215,
week52_high_date='2024-06-20',
week52_low_date='2023-10-31'
),
open=109.21,
high=109.38,
low=104.37,
close=105.42,
change=-3.79,
unit=1,
tick=0.01,
risk='none',
halt=False,
overbought=False
)
```
#### 2.2.3. 잔고 조회
`account.balance()` 함수를 이용하여 예수금 및 보유 종목을 조회할 수 있습니다.
```python
from pykis import KisBalance
# 주 계좌 객체를 가져옵니다.
account = kis.account()
balance: KisBalance = account.balance()
print(repr(balance)) # repr을 통해 객체의 주요 내용을 확인할 수 있습니다.
```
```python
KisIntegrationBalance(
account_number=KisAccountNumber('50113500-01'),
deposits={
'KRW': KisDomesticDeposit(account_number=KisAccountNumber('50113500-01'), currency='KRW', amount=2447692, exchange_rate=1),
'USD': KisForeignPresentDeposit(account_number=KisAccountNumber('50113500-01'), currency='USD', amount=0, exchange_rate=1384.6),
},
stocks=[
KisDomesticBalanceStock(account_number=KisAccountNumber('50113500-01'), market='KRX', symbol='000660', qty=14, price=192600, amount=2696400, profit=22900, profit_rate=0.856555077613615111277351786),
KisDomesticBalanceStock(account_number=KisAccountNumber('50113500-01'), market='KRX', symbol='039200', qty=118, price=39600, amount=4672800, profit=-199500, profit_rate=-4.094575457176282248630010467)
],
purchase_amount=7545800,
current_amount=7369200,
profit=-176600,
profit_rate=-2.340374778022211031302181346
)
```
#### 2.2.4. 매도/매수 주문
`stock.order()`, `stock.buy()`, `stock.sell()`, `stock.modify()`, `stock.cancel()` 함수를 이용하여 매수/매도 주문 및 정정/취소를 할 수 있습니다.
```python
from pykis import KisOrder
# SK하이닉스 1주 시장가 매수 주문
order: KisOrder = hynix.buy(qty=1)
# SK하이닉스 1주 지정가 매수 주문
order: KisOrder = hynix.buy(price=194700, qty=1)
# SK하이닉스 전량 시장가 매도 주문
order: KisOrder = hynix.sell()
# SK하이닉스 전량 지정가 매도 주문
order: KisOrder = hynix.sell(price=194700)
print(order.pending) # 미체결 주문인지 여부
print(order.pending_order.pending_qty) # 미체결 수량
order: KisOrder = order.modify(price=195000) # 단가 정정
order: KisOrder = order.modify(qty=10) # 수량 정정
order.cancel() # 주문 취소
# 미체결 주문 전체 취소
for order in account.pending_orders():
order.cancel()
```
#### 2.2.4. 실시간 체결가 조회
국내주식 및 해외주식의 실시간 체결가 조회는 `stock.on("price", callback)` 함수를 이용하여 수신할 수 있습니다.
```python
from pykis import KisRealtimePrice, KisSubscriptionEventArgs, KisWebsocketClient, PyKis
def on_price(sender: KisWebsocketClient, e: KisSubscriptionEventArgs[KisRealtimePrice]):
print(e.response)
ticket = hynix.on("price", on_price)
print(kis.websocket.subscriptions) # 현재 구독중인 이벤트 목록
input("Press Enter to exit...")
ticket.unsubscribe()
```
```python
{KisWebsocketTR(id='H0STCNT0', key='000660')}
Press Enter to exit...
[08/02 13:50:42] INFO: RTC Connected to real server
[08/02 13:50:42] INFO: RTC Restoring subscriptions... H0STCNT0.000660
[08/02 13:50:42] INFO: RTC Subscribed to H0STCNT0.000660
KisDomesticRealtimePrice(market='KRX', symbol='000660', time='2024-08-02T13:50:44+09:00', price=174900, change=-18400, volume=8919304, amount=1587870362300)
KisDomesticRealtimePrice(market='KRX', symbol='000660', time='2024-08-02T13:50:44+09:00', price=174800, change=-18500, volume=8919354, amount=1587879102300)
KisDomesticRealtimePrice(market='KRX', symbol='000660', time='2024-08-02T13:50:45+09:00', price=174800, change=-18500, volume=8919358, amount=1587879801500)
KisDomesticRealtimePrice(market='KRX', symbol='000660', time='2024-08-02T13:50:45+09:00', price=174900, change=-18400, volume=8920313, amount=1588046831000)
KisDomesticRealtimePrice(market='KRX', symbol='000660', time='2024-08-02T13:50:45+09:00', price=174800, change=-18500, volume=8920319, amount=1588047879800)
[08/02 13:50:48] INFO: RTC Unsubscribed from H0STCNT0.000660
```
## 3. 튜토리얼 목록 📖
- [1. PyKis 인증 관리](https://github.com/Soju06/python-kis/wiki/Tutorial#1-pykis-인증-관리)
- [1.1. 시크릿 키 관리](https://github.com/Soju06/python-kis/wiki/Tutorial#11-시크릿-키-관리)
- [1.2. 엑세스 토큰 관리](https://github.com/Soju06/python-kis/wiki/Tutorial#12-엑세스-토큰-관리)
- [2. 종목 시세 및 차트 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#2-종목-시세-및-차트-조회)
- [2.1. 시세 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#21-시세-조회)
- [2.2. 차트 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#22-차트-조회)
- [2.3. 호가 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#23-호가-조회)
- [2.4. 장운영 시간 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#24-장운영-시간-조회)
- [3. 주문 및 잔고 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#3-주문-및-잔고-조회)
- [3.1. 예수금 및 보유 종목 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#31-예수금-및-보유-종목-조회)
- [3.2. 기간 손익 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#32-기간-손익-조회)
- [3.3. 일별 체결 내역 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#33-일별-체결-내역-조회)
- [3.4. 매수 가능 금액/수량 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#34-매수-가능-금액수량-조회)
- [3.5. 매도 가능 수량 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#35-매도-가능-수량-조회)
- [3.6. 미체결 주문 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#36-미체결-주문-조회)
- [3.7. 매도/매수 주문 및 정정/취소](https://github.com/Soju06/python-kis/wiki/Tutorial#37-매도매수-주문-및-정정취소)
- [3.7.1. 매수/매도 주문](https://github.com/Soju06/python-kis/wiki/Tutorial#371-매수매도-주문)
- [3.7.2. 주문 정정](https://github.com/Soju06/python-kis/wiki/Tutorial#372-주문-정정)
- [4. 실시간 이벤트 수신](https://github.com/Soju06/python-kis/wiki/Tutorial#4-실시간-이벤트-수신)
- [4.1. 이벤트 수신을 했는데, 바로 취소됩니다.](https://github.com/Soju06/python-kis/wiki/Tutorial#41-이벤트-수신을-했는데-바로-취소됩니다)
- [4.2. 실시간 체결가 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#42-실시간-체결가-조회)
- [4.3. 실시간 호가 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#43-실시간-호가-조회)
- [4.4. 실시간 체결내역 조회](https://github.com/Soju06/python-kis/wiki/Tutorial#44-실시간-체결내역-조회)
## 4. Changelog ✨
### ver 2.1.3
- [HTTPSConnectionPool이 제대로 닫히지 않는 것 같습니다.](https://github.com/Soju06/python-kis/issues/58) [fixed #58: session 추가](https://github.com/Soju06/python-kis/pull/59) by @tasoo-oos
- [Refector/decorator keeping function information](https://github.com/Soju06/python-kis/pull/60) `KisChartBar`의 타이핑 문제를 해결했습니다.
### ver 2.1.2
- [fix: SyntaxError: f-string: expecting '}' but got "}"](https://github.com/Soju06/python-kis/pull/57) 파이썬 3.11 이하에서 SyntaxError 오류가 발생하는 문제를 해결했습니다. by @tasoo-oos
### ver 2.1.1
- [해외주식 실시간 체결 이벤트 버그 수정](https://github.com/Soju06/python-kis/pull/53) 해외주식 실시간 체결 이벤트를 받을 수 없는 버그를 수정했습니다.
- [이벤트 티켓 암시적 구독 해지 경고 메시지 추가](https://github.com/Soju06/python-kis/pull/55) 이벤트 티켓이 GC에 의해 해지되었을 때 경고 메시지를 추가했습니다.
- [코드 리펙토링](https://github.com/Soju06/python-kis/pull/56) 기존 `EMPTY`, `EMPTY_TYPE` 대신 `EllipsisType`를 사용하도록 변경하고, `Impl` 타입의 이름을 `Mixin`으로 변경했습니다.
### ver 2.1.0
- [몇몇 종목의 주식 객체 quote, chart 동작 관련 질문](https://github.com/Soju06/python-kis/issues/47) 상품기본정보 조회 시세조회 가능 여부 확인 로직을 추가했습니다.
- [order 객체를 분실했을 때, order 객체를 다시 가져올 수 있는 방법이 있을까요?](https://github.com/Soju06/python-kis/issues/45) 미체결 주문 객체에 KisOrder 프로토콜을 지원하도록 개선했습니다.
- 인증 토큰 만료되었을 때 발생하는 예외를 핸들링하여 재발급을 시도하도록 개선했습니다.
### ver 2.0.4
- [krx 주식 002170 정보를 quote 로 가져올 때 발생하는 버그](https://github.com/Soju06/python-kis/issues/48) 국내주식 시세조회의 업종명이 없을때 발생하는 버그를 수정했습니다.
### ver 2.0.3
- [KisIntegrationBalance에서 해외주식 잔고수량이 0으로 표시됨](https://github.com/Soju06/python-kis/issues/41) 버그를 수정했습니다.
### ver 2.0.2
- `KisBalance`, `KisChart` 등 `__iter__` 메서드의 반환 타입이 누락되어있는 버그를 수정했습니다.
- 주문 수량을 입력할 때 `Decimal` 타입 이외의 `int`, `float` 타입을 입력할 수 있도록 개선했습니다.
### ver 2.0.1
- 초기 웹소켓 이벤트 구독시 클라이언트 접속 후 구독을 요청하는 코드에서 `_connected_event`가 set 되어있지 않아, 요청이 무시되는 버그를 수정했습니다.
### ver 2.0.0
- 라이브러리가 완전히 새롭게 변경되었습니다.
- 모든 객체에 대한 추상화 및 네이밍이 변경되었습니다.
- 한국투자증권의 국내, 해외 API 구분 없이 동일한 인터페이스로 사용할 수 있습니다.
- 실시간 시세 조회는 새로운 이벤트 시스템으로 변경되었습니다.
- 계좌 및 상품 Scope 활용이 극대화되었습니다.
### ver 1.0.6
- 상품기본조회가 추가되었습니다.
- 환경 변수를 분리하였습니다.
각각의 파일에 나뉘어있던 Version, 접속 URL, API Rate Limit 등의 상수 데이터를 `__env__.py`로 옮겼습니다.
- 예외구조 변경
기존 HTTP Error, RT_CD Error를 모두 `ValueError`로 처리하던 구조에서 각각의 `KisHTTPError`, `KisAPIError` 예외 객체로 나누었고, `rt_cd`, `msg_cd` 등의 변수를 예외 객체에서 참조할 수 있도록 변경하였습니다.
- 엑세스토큰 발급 Thread Safe
엑세스 토큰이 발급되어있지 않은 상태에서 멀티스레드로 `KisAccessToken.ensure()` 함수를 호출하면 Thread Lock 되지 않고 다수가 `KisAccessToken.issue()`를 호출하는 문제를 해결하였습니다.
### ver 1.0.5
- `RTClient`에서 웹소켓 연결이 끊어졌을 때, 이벤트 처리가 잘못되는 버그를 수정하였습니다.
- `RTClient`에서 재연결시 실시간 조회가 복구되지 않는 버그를 수정하였습니다.
- 휴장일 조회가 추가되었습니다.
- 해외 주식 주문이 추가되었습니다.
- 해외 미체결 조회가 추가되었습니다.
### ver 1.0.4
- 주식잔고조회_실현손익 조회가 추가되었습니다.
- [실시간 해제요청이 정상적으로 되지 않습니다](https://github.com/Soju06/python-kis/issues/1) 버그를 수정하였습니다.
### ver 1.0.3
- `RTClient` [웹소켓 보안강화를 위한 개선 안내](https://apiportal.koreainvestment.com/community/10000000-0000-0011-0000-000000000001)의 내용에 따라, 앱키 대신 웹소켓 접속키를 발급하여 사용하도록 변경되었습니다.
### ver 1.0.2
- API 초당 요청 제한을 넘어버리는 버그를 수정하였습니다.
- `period_price` 응답 데이터의 `stck_fcam`값 `float`으로 변경하였습니다.
- `utils.KRXMarketOpen` 공휴일 데이터가 1개인 경우 오류 발생하는 버그 수정하였습니다.
### License
[MIT](https://github.com/Soju06/python-kis/blob/main/LICENCE)
Raw data
{
"_id": null,
"home_page": null,
"name": "python-kis",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "python, client, library, trading, websocket, realtime, investing, korean, investment, autotrading, koreainvestment",
"author": null,
"author_email": "Soju06 <qlskssk@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/e8/2e/b4a633c5898bddb04c51d1e39705918560d2fd2296759f7c6f75c3eb4660/python_kis-2.1.3.tar.gz",
"platform": null,
"description": "\n![header](https://capsule-render.vercel.app/api?type=waving&color=gradient&height=260§ion=header&text=%ED%8C%8C%EC%9D%B4%EC%8D%AC%20%ED%95%9C%EA%B5%AD%ED%88%AC%EC%9E%90%EC%A6%9D%EA%B6%8C%20API&fontSize=50&animation=fadeIn&fontAlignY=38&desc=KIS%20Open%20Trading%20API%20Client&descAlignY=51&descAlign=62&customColorList=24)\n\n## 1. \ud30c\uc774\uc36c\uc6a9 \ud55c\uad6d\ud22c\uc790\uc99d\uad8c API \uc18c\uac1c \u2728\n\n\ud55c\uad6d\ud22c\uc790\uc99d\uad8c\uc758 \ud2b8\ub808\uc774\ub529 OPEN API \uc11c\ube44\uc2a4\ub97c \ud30c\uc774\uc36c \ud658\uacbd\uc5d0\uc11c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub3c4\ub85d \ub9cc\ub4e0 \uac15\ub825\ud55c \ucee4\ubba4\ub2c8\ud2f0 \ub77c\uc774\ube0c\ub7ec\ub9ac\uc785\ub2c8\ub2e4.\n\n**2.0.0 \ubc84\uc804 \uc774\uc804\uc758 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub294 [\uc5ec\uae30](https://github.com/Soju06/python-kis/tree/v1.0.6), \ubb38\uc11c\ub294 [1](https://github.com/Soju06/python-kis/wiki/Home/d6aaf207dc523b92b52e734908dd6b8084cd36ff), [2](https://github.com/Soju06/python-kis/wiki/Tutorial/d6aaf207dc523b92b52e734908dd6b8084cd36ff), [3](https://github.com/Soju06/python-kis/wiki/Examples/d6aaf207dc523b92b52e734908dd6b8084cd36ff)\uc5d0\uc11c \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.**\n\n\n### 1.1. \ub77c\uc774\ube0c\ub7ec\ub9ac \ud2b9\uc9d5\n\n<details>\n<summary>\ud83d\udcd0 \ubaa8\ub4e0 \uac1d\uccb4\uc5d0 \ub300\ud55c Type hint</summary>\n<ul>\n<li>\ubaa8\ub4e0 \ud568\uc218\uc640 \ud074\ub798\uc2a4\uc5d0 \ub300\ud574 \ucd94\uc0c1\ud654 \ubc0f Typing\uc744 \uc801\uc6a9\ud558\uc5ec, \ud30c\uc774\uc36c\uc758 \ub3d9\uc801 \ud0c0\uc774\ud551\uc744 \ubcf4\uc644\ud569\ub2c8\ub2e4.</li>\n<li>IDE\uc758 \uc790\ub3d9\uc644\uc131\uc744 100% \ud65c\uc6a9\ud560 \uc218 \uc788\uc73c\uba70, \uacf5\uc2dd \ubb38\uc11c \uc5c6\uc774 \uc815\ud655\ud558\uace0 \ubc84\uadf8 \uc5c6\ub294 \uac1c\ubc1c\uc774 \uac00\ub2a5\ud569\ub2c8\ub2e4.</li>\n</ul>\n</details>\n\n<details>\n<summary>\ud83d\udd17 \ubcf5\uad6c \uac00\ub2a5\ud55c \uc6f9\uc18c\ucf13 \ud074\ub77c\uc774\uc5b8\ud2b8</summary>\n<ul>\n<li>\uc2e4\uc2dc\uac04 \uc2dc\uc138, \ud638\uac00, \uccb4\uacb0 \ub4f1\uc758 \uc2e4\uc2dc\uac04 \ub370\uc774\ud130\ub97c \ubc1b\uc544\uc624\ub294 \uacfc\uc815\uc5d0\uc11c \ub124\ud2b8\uc6cc\ud06c \ubb38\uc81c \ub4f1\uc73c\ub85c \uc778\ud574 \uc5f0\uacb0\uc774 \ub04a\uacbc\uc744 \ub54c, \uc644\ubcbd\ud788 \ubcf5\uad6c\ud560 \uc218 \uc788\ub3c4\ub85d \ub9cc\ub4e4\uc5b4\uc84c\uc2b5\ub2c8\ub2e4.</li>\n<li>\uc7ac\uc5f0\uacb0 \uc774\uc804\uc5d0 \ub4f1\ub85d\ub41c \uc870\ud68c\ub3c4 \uc790\ub3d9\uc73c\ub85c \ub2e4\uc2dc \ub4f1\ub85d\ud558\uc5ec \uc720\uc2e4\uc744 \ubc29\uc9c0\ud569\ub2c8\ub2e4.</li>\n<li>\ud55c\uad6d\ud22c\uc790\uc99d\uad8c\uc758 \uc6f9\uc18c\ucf13 \uc870\ud68c \uc2dc\uc2a4\ud15c\uc744 \ud30c\uc774\uc36c\uc758 \uba54\ubaa8\ub9ac \uad00\ub9ac \uc2dc\uc2a4\ud15c\uacfc \uc644\ubcbd\ud788 \ud1b5\ud569\ud558\uc5ec, GC\uc5d0 \uc758\ud574 \uc774\ubca4\ud2b8 \uad6c\ub3c5\uc774 \uad00\ub9ac\ub429\ub2c8\ub2e4.</li>\n</details>\n\n<details>\n<summary>\ud83d\udd8b\ufe0f \ud45c\uc900 \uc601\uc5b4 \ub124\uc774\ubc0d</summary>\n<ul>\n<li>\ud55c\uad6d\ud22c\uc790\uc99d\uad8c\uc758 API\uc758 \uacbd\uc6b0, \ud55c\uae00 \ubc1c\uc74c\uc774\ub098 \ube44\ud45c\uc900 \uc57d\uc5b4\ub97c \uc0ac\uc6a9\ud558\ub294 \uacbd\uc6b0\uac00 \ub9ce\uc2b5\ub2c8\ub2e4.</li>\n<li>\uc774 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub294 \ubaa8\ub4e0 \uac1d\uccb4\uc5d0 \ub300\ud574 \ud45c\uc900 \uc601\uc5b4 \ub124\uc774\ubc0d\uc744 \uc801\uc6a9\ud558\uc5ec, \uc774\ud574\ud558\uae30 \uc27d\ub3c4\ub85d \ub9cc\ub4e4\uc5c8\uc2b5\ub2c8\ub2e4.</li>\n</details>\n\n<hr>\n\n## 2. \uc0ac\uc6a9 \uc124\uba85 \u2699\ufe0f\n\n<details>\n<summary>OpenAPI \uc11c\ube44\uc2a4 \uc2e0\uccad \ubc29\ubc95</summary>\n\n1. \ud55c\uad6d\ud22c\uc790\uc99d\uad8c \uacc4\uc88c\uc640 \uc544\uc774\ub514\uac00 \ud544\uc694\ud569\ub2c8\ub2e4. KIS \ud2b8\ub808\uc774\ub529 \uc11c\ube44\uc2a4\ub294 [KIS Developers \uc11c\ube44\uc2a4](https://apiportal.koreainvestment.com/)\ub97c \ud1b5\ud574 \uc2e0\uccad \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n![image](https://user-images.githubusercontent.com/34199905/193738291-c9c663fd-8ab4-43da-acb6-6a2f7846a79d.png)\n\n2. \uc11c\ube44\uc2a4\ub97c \uc2e0\uccad\uc774 \uc644\ub8cc\ub418\uba74, \uc544\ub798\uc640 \uac19\uc774 \uc571 \ud0a4\ub97c \ubc1c\uae09 \ubc1b\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n![image](https://user-images.githubusercontent.com/34199905/193740291-53f282ee-c40c-40b9-874e-2df39543cb66.png)\n</details>\n\n### 2.1. \ub77c\uc774\ube0c\ub7ec\ub9ac \uc124\uce58 \ud83d\udce6\n\n\ub77c\uc774\ube0c\ub7ec\ub9ac\ub294 \ud30c\uc774\uc36c 3.11\uc744 \uae30\uc900\uc73c\ub85c \uc791\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n\n```zsh\npip install python-kis\n```\n\n<details>\n<summary>\uc0ac\uc6a9\ub41c \ubaa8\ub4c8 \ubcf4\uae30</summary>\n\n```\nrequests>=2.32.3\nwebsocket-client>=1.8.0\ncryptography>=43.0.0\ncolorlog>=6.8.2\n```\n</details>\n\n<hr>\n\n### 2.2. \ub77c\uc774\ube0c\ub7ec\ub9ac \uc0ac\uc6a9 \ud83d\udcda\n\n#### 2.2.1. PyKis \uac1d\uccb4 \uc0dd\uc131\n\n1. \uc2dc\ud06c\ub9bf \ud0a4\ub97c \ud30c\uc77c\ub85c \uad00\ub9ac\ud558\ub294 \ubc29\ubc95 (\uad8c\uc7a5)\n \n \uba3c\uc800 \uc2dc\ud06c\ub9bf \ud0a4\ub97c \ud30c\uc77c\ub85c \uc800\uc7a5\ud569\ub2c8\ub2e4.\n ```python\n from pykis import KisAuth\n\n auth = KisAuth(\n # HTS \ub85c\uadf8\uc778 ID \uc608) soju06\n id=\"YOUR_HTS_ID\",\n # \uc571 \ud0a4 \uc608) Pa0knAM6JLAjIa93Miajz7ykJIXXXXXXXXXX\n appkey=\"YOUR_APP_KEY\",\n # \uc571 \uc2dc\ud06c\ub9bf \ud0a4 \uc608) V9J3YGPE5q2ZRG5EgqnLHn7XqbJjzwXcNpvY . . .\n secretkey=\"YOUR_APP_SECRET\",\n # \uc571 \ud0a4\uc640 \uc5f0\uacb0\ub41c \uacc4\uc88c\ubc88\ud638 \uc608) 00000000-01\n account=\"00000000-01\",\n # \ubaa8\uc758\ud22c\uc790 \uc5ec\ubd80\n virtual=False,\n )\n\n # \uc548\uc804\ud55c \uacbd\ub85c\uc5d0 \uc2dc\ud06c\ub9bf \ud0a4\ub97c \ud30c\uc77c\ub85c \uc800\uc7a5\ud569\ub2c8\ub2e4.\n auth.save(\"secret.json\")\n ```\n\n \uadf8 \ud6c4, \uc800\uc7a5\ub41c \uc2dc\ud06c\ub9bf \ud0a4\ub97c \uc0ac\uc6a9\ud558\uc5ec PyKis \uac1d\uccb4\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4.\n\n ```python\n from pykis import PyKis, KisAuth\n\n # \uc2e4\uc804\ud22c\uc790\uc6a9 PyKis \uac1d\uccb4\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4.\n kis = PyKis(\"secret.json\", keep_token=True)\n kis = PyKis(KisAuth.load(\"secret.json\"), keep_token=True)\n\n # \ubaa8\uc758\ud22c\uc790\uc6a9 PyKis \uac1d\uccb4\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4.\n kis = PyKis(\"secret.json\", \"virtual_secret.json\", keep_token=True)\n kis = PyKis(KisAuth.load(\"secret.json\"), KisAuth.load(\"virtual_secret.json\"), keep_token=True)\n ```\n2. \uc2dc\ud06c\ub9bf \ud0a4\ub97c \uc9c1\uc811 \uc785\ub825\ud558\ub294 \ubc29\ubc95\n ```python\n from pykis import PyKis\n\n # \uc2e4\uc804\ud22c\uc790\uc6a9 \ud55c\uad6d\ud22c\uc790\uc99d\uad8c API\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4.\n kis = PyKis(\n id=\"soju06\", # HTS \ub85c\uadf8\uc778 ID\n account=\"00000000-01\", # \uacc4\uc88c\ubc88\ud638\n appkey=\"PSED321z...\", # AppKey 36\uc790\ub9ac\n secretkey=\"RR0sFMVB...\", # SecretKey 180\uc790\ub9ac\n keep_token=True, # API \uc811\uc18d \ud1a0\ud070 \uc790\ub3d9 \uc800\uc7a5\n )\n\n # \ubaa8\uc758\ud22c\uc790\uc6a9 \ud55c\uad6d\ud22c\uc790\uc99d\uad8c API\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4.\n kis = PyKis(\n id=\"soju06\", # HTS \ub85c\uadf8\uc778 ID\n account=\"00000000-01\", # \ubaa8\uc758\ud22c\uc790 \uacc4\uc88c\ubc88\ud638\n appkey=\"PSED321z...\", # \uc2e4\uc804\ud22c\uc790 AppKey 36\uc790\ub9ac\n secretkey=\"RR0sFMVB...\", # \uc2e4\uc804\ud22c\uc790 SecretKey 180\uc790\ub9ac\n virtual_id=\"soju06\", # \ubaa8\uc758\ud22c\uc790 HTS \ub85c\uadf8\uc778 ID\n virtual_appkey=\"PSED321z...\", # \ubaa8\uc758\ud22c\uc790 AppKey 36\uc790\ub9ac\n virtual_secretkey=\"RR0sFMVB...\", # \ubaa8\uc758\ud22c\uc790 SecretKey 180\uc790\ub9ac\n keep_token=True, # API \uc811\uc18d \ud1a0\ud070 \uc790\ub3d9 \uc800\uc7a5\n )\n ```\n\n#### 2.2.2. \uc2dc\uc138 \uc870\ud68c\n\n`stock.quote()` \ud568\uc218\ub97c \uc774\uc6a9\ud558\uc5ec \uad6d\ub0b4\uc8fc\uc2dd \ubc0f \ud574\uc678\uc8fc\uc2dd\uc758 \uc2dc\uc138\ub97c \uc870\ud68c\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n```python\nfrom pykis import KisQuote\n\n# \uc5d4\ube44\ub514\uc544\uc758 \uc0c1\ud488 \uac1d\uccb4\ub97c \uac00\uc838\uc635\ub2c8\ub2e4.\nstock = kis.stock(\"NVDA\")\n\nquote: KisQuote = stock.quote()\nquote: KisQuote = stock.quote(extended=True) # \uc8fc\uac04\uac70\ub798 \uc2dc\uc138\n\n# PyKis\uc758 \ubaa8\ub4e0 \uac1d\uccb4\ub294 repr\uc744 \ud1b5\ud574 \uc8fc\uc694 \ub0b4\uc6a9\uc744 \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n# \ub370\uc774\ud130\ub97c \ud655\uc778\ud558\ub294 \uc6a9\ub3c4\uc774\ubbc0\ub85c \uc2e4\uc81c \ud504\ub85c\ud37c\ud2f0 \ud0c0\uc785\uacfc \ub2e4\ub97c \uc218 \uc788\uc2b5\ub2c8\ub2e4.\nprint(quote)\n```\n\n```python\nKisForeignQuote(\n symbol='NVDA',\n market='NASDAQ',\n name='\uc5d4\ube44\ub514\uc544',\n sector_name='\ubc18\ub3c4\uccb4 \ubc0f \ubc18\ub3c4\uccb4\uc7a5\ube44',\n volume=1506310,\n amount=160791125,\n market_cap=2593332000000,\n indicator=KisForeignIndicator(\n eps=1.71,\n bps=2,\n per=63.88,\n pbr=54.65,\n week52_high=140.76,\n week52_low=39.2215,\n week52_high_date='2024-06-20',\n week52_low_date='2023-10-31'\n ),\n open=109.21,\n high=109.38,\n low=104.37,\n close=105.42,\n change=-3.79,\n unit=1,\n tick=0.01,\n risk='none',\n halt=False,\n overbought=False\n)\n```\n\n#### 2.2.3. \uc794\uace0 \uc870\ud68c\n\n`account.balance()` \ud568\uc218\ub97c \uc774\uc6a9\ud558\uc5ec \uc608\uc218\uae08 \ubc0f \ubcf4\uc720 \uc885\ubaa9\uc744 \uc870\ud68c\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n```python\nfrom pykis import KisBalance\n\n# \uc8fc \uacc4\uc88c \uac1d\uccb4\ub97c \uac00\uc838\uc635\ub2c8\ub2e4.\naccount = kis.account()\n\nbalance: KisBalance = account.balance()\n\nprint(repr(balance)) # repr\uc744 \ud1b5\ud574 \uac1d\uccb4\uc758 \uc8fc\uc694 \ub0b4\uc6a9\uc744 \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n```\n\n```python\nKisIntegrationBalance(\n account_number=KisAccountNumber('50113500-01'),\n deposits={\n 'KRW': KisDomesticDeposit(account_number=KisAccountNumber('50113500-01'), currency='KRW', amount=2447692, exchange_rate=1),\n 'USD': KisForeignPresentDeposit(account_number=KisAccountNumber('50113500-01'), currency='USD', amount=0, exchange_rate=1384.6),\n },\n stocks=[\n KisDomesticBalanceStock(account_number=KisAccountNumber('50113500-01'), market='KRX', symbol='000660', qty=14, price=192600, amount=2696400, profit=22900, profit_rate=0.856555077613615111277351786),\n KisDomesticBalanceStock(account_number=KisAccountNumber('50113500-01'), market='KRX', symbol='039200', qty=118, price=39600, amount=4672800, profit=-199500, profit_rate=-4.094575457176282248630010467)\n ],\n purchase_amount=7545800,\n current_amount=7369200,\n profit=-176600,\n profit_rate=-2.340374778022211031302181346\n)\n```\n\n#### 2.2.4. \ub9e4\ub3c4/\ub9e4\uc218 \uc8fc\ubb38\n\n`stock.order()`, `stock.buy()`, `stock.sell()`, `stock.modify()`, `stock.cancel()` \ud568\uc218\ub97c \uc774\uc6a9\ud558\uc5ec \ub9e4\uc218/\ub9e4\ub3c4 \uc8fc\ubb38 \ubc0f \uc815\uc815/\ucde8\uc18c\ub97c \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n```python\nfrom pykis import KisOrder\n\n# SK\ud558\uc774\ub2c9\uc2a4 1\uc8fc \uc2dc\uc7a5\uac00 \ub9e4\uc218 \uc8fc\ubb38\norder: KisOrder = hynix.buy(qty=1)\n# SK\ud558\uc774\ub2c9\uc2a4 1\uc8fc \uc9c0\uc815\uac00 \ub9e4\uc218 \uc8fc\ubb38\norder: KisOrder = hynix.buy(price=194700, qty=1)\n# SK\ud558\uc774\ub2c9\uc2a4 \uc804\ub7c9 \uc2dc\uc7a5\uac00 \ub9e4\ub3c4 \uc8fc\ubb38\norder: KisOrder = hynix.sell()\n# SK\ud558\uc774\ub2c9\uc2a4 \uc804\ub7c9 \uc9c0\uc815\uac00 \ub9e4\ub3c4 \uc8fc\ubb38\norder: KisOrder = hynix.sell(price=194700)\n\nprint(order.pending) # \ubbf8\uccb4\uacb0 \uc8fc\ubb38\uc778\uc9c0 \uc5ec\ubd80\nprint(order.pending_order.pending_qty) # \ubbf8\uccb4\uacb0 \uc218\ub7c9\n\norder: KisOrder = order.modify(price=195000) # \ub2e8\uac00 \uc815\uc815\norder: KisOrder = order.modify(qty=10) # \uc218\ub7c9 \uc815\uc815\n\norder.cancel() # \uc8fc\ubb38 \ucde8\uc18c\n\n# \ubbf8\uccb4\uacb0 \uc8fc\ubb38 \uc804\uccb4 \ucde8\uc18c\nfor order in account.pending_orders():\n order.cancel()\n```\n\n\n#### 2.2.4. \uc2e4\uc2dc\uac04 \uccb4\uacb0\uac00 \uc870\ud68c\n\n\uad6d\ub0b4\uc8fc\uc2dd \ubc0f \ud574\uc678\uc8fc\uc2dd\uc758 \uc2e4\uc2dc\uac04 \uccb4\uacb0\uac00 \uc870\ud68c\ub294 `stock.on(\"price\", callback)` \ud568\uc218\ub97c \uc774\uc6a9\ud558\uc5ec \uc218\uc2e0\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n```python\nfrom pykis import KisRealtimePrice, KisSubscriptionEventArgs, KisWebsocketClient, PyKis\n\ndef on_price(sender: KisWebsocketClient, e: KisSubscriptionEventArgs[KisRealtimePrice]):\n print(e.response)\n\nticket = hynix.on(\"price\", on_price)\n\nprint(kis.websocket.subscriptions) # \ud604\uc7ac \uad6c\ub3c5\uc911\uc778 \uc774\ubca4\ud2b8 \ubaa9\ub85d\n\ninput(\"Press Enter to exit...\")\n\nticket.unsubscribe()\n```\n\n```python\n{KisWebsocketTR(id='H0STCNT0', key='000660')}\nPress Enter to exit...\n[08/02 13:50:42] INFO: RTC Connected to real server\n[08/02 13:50:42] INFO: RTC Restoring subscriptions... H0STCNT0.000660\n[08/02 13:50:42] INFO: RTC Subscribed to H0STCNT0.000660\nKisDomesticRealtimePrice(market='KRX', symbol='000660', time='2024-08-02T13:50:44+09:00', price=174900, change=-18400, volume=8919304, amount=1587870362300)\nKisDomesticRealtimePrice(market='KRX', symbol='000660', time='2024-08-02T13:50:44+09:00', price=174800, change=-18500, volume=8919354, amount=1587879102300)\nKisDomesticRealtimePrice(market='KRX', symbol='000660', time='2024-08-02T13:50:45+09:00', price=174800, change=-18500, volume=8919358, amount=1587879801500)\nKisDomesticRealtimePrice(market='KRX', symbol='000660', time='2024-08-02T13:50:45+09:00', price=174900, change=-18400, volume=8920313, amount=1588046831000)\nKisDomesticRealtimePrice(market='KRX', symbol='000660', time='2024-08-02T13:50:45+09:00', price=174800, change=-18500, volume=8920319, amount=1588047879800)\n\n[08/02 13:50:48] INFO: RTC Unsubscribed from H0STCNT0.000660\n```\n\n## 3. \ud29c\ud1a0\ub9ac\uc5bc \ubaa9\ub85d \ud83d\udcd6\n \n- [1. PyKis \uc778\uc99d \uad00\ub9ac](https://github.com/Soju06/python-kis/wiki/Tutorial#1-pykis-\uc778\uc99d-\uad00\ub9ac)\n - [1.1. \uc2dc\ud06c\ub9bf \ud0a4 \uad00\ub9ac](https://github.com/Soju06/python-kis/wiki/Tutorial#11-\uc2dc\ud06c\ub9bf-\ud0a4-\uad00\ub9ac)\n - [1.2. \uc5d1\uc138\uc2a4 \ud1a0\ud070 \uad00\ub9ac](https://github.com/Soju06/python-kis/wiki/Tutorial#12-\uc5d1\uc138\uc2a4-\ud1a0\ud070-\uad00\ub9ac)\n- [2. \uc885\ubaa9 \uc2dc\uc138 \ubc0f \ucc28\ud2b8 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#2-\uc885\ubaa9-\uc2dc\uc138-\ubc0f-\ucc28\ud2b8-\uc870\ud68c)\n - [2.1. \uc2dc\uc138 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#21-\uc2dc\uc138-\uc870\ud68c)\n - [2.2. \ucc28\ud2b8 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#22-\ucc28\ud2b8-\uc870\ud68c)\n - [2.3. \ud638\uac00 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#23-\ud638\uac00-\uc870\ud68c)\n - [2.4. \uc7a5\uc6b4\uc601 \uc2dc\uac04 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#24-\uc7a5\uc6b4\uc601-\uc2dc\uac04-\uc870\ud68c)\n- [3. \uc8fc\ubb38 \ubc0f \uc794\uace0 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#3-\uc8fc\ubb38-\ubc0f-\uc794\uace0-\uc870\ud68c)\n - [3.1. \uc608\uc218\uae08 \ubc0f \ubcf4\uc720 \uc885\ubaa9 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#31-\uc608\uc218\uae08-\ubc0f-\ubcf4\uc720-\uc885\ubaa9-\uc870\ud68c)\n - [3.2. \uae30\uac04 \uc190\uc775 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#32-\uae30\uac04-\uc190\uc775-\uc870\ud68c)\n - [3.3. \uc77c\ubcc4 \uccb4\uacb0 \ub0b4\uc5ed \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#33-\uc77c\ubcc4-\uccb4\uacb0-\ub0b4\uc5ed-\uc870\ud68c)\n - [3.4. \ub9e4\uc218 \uac00\ub2a5 \uae08\uc561/\uc218\ub7c9 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#34-\ub9e4\uc218-\uac00\ub2a5-\uae08\uc561\uc218\ub7c9-\uc870\ud68c)\n - [3.5. \ub9e4\ub3c4 \uac00\ub2a5 \uc218\ub7c9 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#35-\ub9e4\ub3c4-\uac00\ub2a5-\uc218\ub7c9-\uc870\ud68c)\n - [3.6. \ubbf8\uccb4\uacb0 \uc8fc\ubb38 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#36-\ubbf8\uccb4\uacb0-\uc8fc\ubb38-\uc870\ud68c)\n - [3.7. \ub9e4\ub3c4/\ub9e4\uc218 \uc8fc\ubb38 \ubc0f \uc815\uc815/\ucde8\uc18c](https://github.com/Soju06/python-kis/wiki/Tutorial#37-\ub9e4\ub3c4\ub9e4\uc218-\uc8fc\ubb38-\ubc0f-\uc815\uc815\ucde8\uc18c)\n - [3.7.1. \ub9e4\uc218/\ub9e4\ub3c4 \uc8fc\ubb38](https://github.com/Soju06/python-kis/wiki/Tutorial#371-\ub9e4\uc218\ub9e4\ub3c4-\uc8fc\ubb38)\n - [3.7.2. \uc8fc\ubb38 \uc815\uc815](https://github.com/Soju06/python-kis/wiki/Tutorial#372-\uc8fc\ubb38-\uc815\uc815)\n- [4. \uc2e4\uc2dc\uac04 \uc774\ubca4\ud2b8 \uc218\uc2e0](https://github.com/Soju06/python-kis/wiki/Tutorial#4-\uc2e4\uc2dc\uac04-\uc774\ubca4\ud2b8-\uc218\uc2e0)\n - [4.1. \uc774\ubca4\ud2b8 \uc218\uc2e0\uc744 \ud588\ub294\ub370, \ubc14\ub85c \ucde8\uc18c\ub429\ub2c8\ub2e4.](https://github.com/Soju06/python-kis/wiki/Tutorial#41-\uc774\ubca4\ud2b8-\uc218\uc2e0\uc744-\ud588\ub294\ub370-\ubc14\ub85c-\ucde8\uc18c\ub429\ub2c8\ub2e4)\n - [4.2. \uc2e4\uc2dc\uac04 \uccb4\uacb0\uac00 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#42-\uc2e4\uc2dc\uac04-\uccb4\uacb0\uac00-\uc870\ud68c)\n - [4.3. \uc2e4\uc2dc\uac04 \ud638\uac00 \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#43-\uc2e4\uc2dc\uac04-\ud638\uac00-\uc870\ud68c)\n - [4.4. \uc2e4\uc2dc\uac04 \uccb4\uacb0\ub0b4\uc5ed \uc870\ud68c](https://github.com/Soju06/python-kis/wiki/Tutorial#44-\uc2e4\uc2dc\uac04-\uccb4\uacb0\ub0b4\uc5ed-\uc870\ud68c)\n\n\n## 4. Changelog \u2728\n\n### ver 2.1.3\n\n- [HTTPSConnectionPool\uc774 \uc81c\ub300\ub85c \ub2eb\ud788\uc9c0 \uc54a\ub294 \uac83 \uac19\uc2b5\ub2c8\ub2e4.](https://github.com/Soju06/python-kis/issues/58) [fixed #58: session \ucd94\uac00](https://github.com/Soju06/python-kis/pull/59) by @tasoo-oos\n- [Refector/decorator keeping function information](https://github.com/Soju06/python-kis/pull/60) `KisChartBar`\uc758 \ud0c0\uc774\ud551 \ubb38\uc81c\ub97c \ud574\uacb0\ud588\uc2b5\ub2c8\ub2e4.\n\n### ver 2.1.2\n\n- [fix: SyntaxError: f-string: expecting '}' but got \"}\"](https://github.com/Soju06/python-kis/pull/57) \ud30c\uc774\uc36c 3.11 \uc774\ud558\uc5d0\uc11c SyntaxError \uc624\ub958\uac00 \ubc1c\uc0dd\ud558\ub294 \ubb38\uc81c\ub97c \ud574\uacb0\ud588\uc2b5\ub2c8\ub2e4. by @tasoo-oos\n\n\n### ver 2.1.1\n\n- [\ud574\uc678\uc8fc\uc2dd \uc2e4\uc2dc\uac04 \uccb4\uacb0 \uc774\ubca4\ud2b8 \ubc84\uadf8 \uc218\uc815](https://github.com/Soju06/python-kis/pull/53) \ud574\uc678\uc8fc\uc2dd \uc2e4\uc2dc\uac04 \uccb4\uacb0 \uc774\ubca4\ud2b8\ub97c \ubc1b\uc744 \uc218 \uc5c6\ub294 \ubc84\uadf8\ub97c \uc218\uc815\ud588\uc2b5\ub2c8\ub2e4.\n- [\uc774\ubca4\ud2b8 \ud2f0\ucf13 \uc554\uc2dc\uc801 \uad6c\ub3c5 \ud574\uc9c0 \uacbd\uace0 \uba54\uc2dc\uc9c0 \ucd94\uac00](https://github.com/Soju06/python-kis/pull/55) \uc774\ubca4\ud2b8 \ud2f0\ucf13\uc774 GC\uc5d0 \uc758\ud574 \ud574\uc9c0\ub418\uc5c8\uc744 \ub54c \uacbd\uace0 \uba54\uc2dc\uc9c0\ub97c \ucd94\uac00\ud588\uc2b5\ub2c8\ub2e4.\n- [\ucf54\ub4dc \ub9ac\ud399\ud1a0\ub9c1](https://github.com/Soju06/python-kis/pull/56) \uae30\uc874 `EMPTY`, `EMPTY_TYPE` \ub300\uc2e0 `EllipsisType`\ub97c \uc0ac\uc6a9\ud558\ub3c4\ub85d \ubcc0\uacbd\ud558\uace0, `Impl` \ud0c0\uc785\uc758 \uc774\ub984\uc744 `Mixin`\uc73c\ub85c \ubcc0\uacbd\ud588\uc2b5\ub2c8\ub2e4.\n\n### ver 2.1.0\n\n- [\uba87\uba87 \uc885\ubaa9\uc758 \uc8fc\uc2dd \uac1d\uccb4 quote, chart \ub3d9\uc791 \uad00\ub828 \uc9c8\ubb38](https://github.com/Soju06/python-kis/issues/47) \uc0c1\ud488\uae30\ubcf8\uc815\ubcf4 \uc870\ud68c \uc2dc\uc138\uc870\ud68c \uac00\ub2a5 \uc5ec\ubd80 \ud655\uc778 \ub85c\uc9c1\uc744 \ucd94\uac00\ud588\uc2b5\ub2c8\ub2e4.\n- [order \uac1d\uccb4\ub97c \ubd84\uc2e4\ud588\uc744 \ub54c, order \uac1d\uccb4\ub97c \ub2e4\uc2dc \uac00\uc838\uc62c \uc218 \uc788\ub294 \ubc29\ubc95\uc774 \uc788\uc744\uae4c\uc694?](https://github.com/Soju06/python-kis/issues/45) \ubbf8\uccb4\uacb0 \uc8fc\ubb38 \uac1d\uccb4\uc5d0 KisOrder \ud504\ub85c\ud1a0\ucf5c\uc744 \uc9c0\uc6d0\ud558\ub3c4\ub85d \uac1c\uc120\ud588\uc2b5\ub2c8\ub2e4.\n- \uc778\uc99d \ud1a0\ud070 \ub9cc\ub8cc\ub418\uc5c8\uc744 \ub54c \ubc1c\uc0dd\ud558\ub294 \uc608\uc678\ub97c \ud578\ub4e4\ub9c1\ud558\uc5ec \uc7ac\ubc1c\uae09\uc744 \uc2dc\ub3c4\ud558\ub3c4\ub85d \uac1c\uc120\ud588\uc2b5\ub2c8\ub2e4.\n\n### ver 2.0.4\n\n- [krx \uc8fc\uc2dd 002170 \uc815\ubcf4\ub97c quote \ub85c \uac00\uc838\uc62c \ub54c \ubc1c\uc0dd\ud558\ub294 \ubc84\uadf8](https://github.com/Soju06/python-kis/issues/48) \uad6d\ub0b4\uc8fc\uc2dd \uc2dc\uc138\uc870\ud68c\uc758 \uc5c5\uc885\uba85\uc774 \uc5c6\uc744\ub54c \ubc1c\uc0dd\ud558\ub294 \ubc84\uadf8\ub97c \uc218\uc815\ud588\uc2b5\ub2c8\ub2e4.\n\n### ver 2.0.3\n\n- [KisIntegrationBalance\uc5d0\uc11c \ud574\uc678\uc8fc\uc2dd \uc794\uace0\uc218\ub7c9\uc774 0\uc73c\ub85c \ud45c\uc2dc\ub428](https://github.com/Soju06/python-kis/issues/41) \ubc84\uadf8\ub97c \uc218\uc815\ud588\uc2b5\ub2c8\ub2e4.\n\n### ver 2.0.2\n\n- `KisBalance`, `KisChart` \ub4f1 `__iter__` \uba54\uc11c\ub4dc\uc758 \ubc18\ud658 \ud0c0\uc785\uc774 \ub204\ub77d\ub418\uc5b4\uc788\ub294 \ubc84\uadf8\ub97c \uc218\uc815\ud588\uc2b5\ub2c8\ub2e4.\n- \uc8fc\ubb38 \uc218\ub7c9\uc744 \uc785\ub825\ud560 \ub54c `Decimal` \ud0c0\uc785 \uc774\uc678\uc758 `int`, `float` \ud0c0\uc785\uc744 \uc785\ub825\ud560 \uc218 \uc788\ub3c4\ub85d \uac1c\uc120\ud588\uc2b5\ub2c8\ub2e4.\n\n### ver 2.0.1\n\n- \ucd08\uae30 \uc6f9\uc18c\ucf13 \uc774\ubca4\ud2b8 \uad6c\ub3c5\uc2dc \ud074\ub77c\uc774\uc5b8\ud2b8 \uc811\uc18d \ud6c4 \uad6c\ub3c5\uc744 \uc694\uccad\ud558\ub294 \ucf54\ub4dc\uc5d0\uc11c `_connected_event`\uac00 set \ub418\uc5b4\uc788\uc9c0 \uc54a\uc544, \uc694\uccad\uc774 \ubb34\uc2dc\ub418\ub294 \ubc84\uadf8\ub97c \uc218\uc815\ud588\uc2b5\ub2c8\ub2e4.\n\n### ver 2.0.0\n\n- \ub77c\uc774\ube0c\ub7ec\ub9ac\uac00 \uc644\uc804\ud788 \uc0c8\ub86d\uac8c \ubcc0\uacbd\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n- \ubaa8\ub4e0 \uac1d\uccb4\uc5d0 \ub300\ud55c \ucd94\uc0c1\ud654 \ubc0f \ub124\uc774\ubc0d\uc774 \ubcc0\uacbd\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n- \ud55c\uad6d\ud22c\uc790\uc99d\uad8c\uc758 \uad6d\ub0b4, \ud574\uc678 API \uad6c\ubd84 \uc5c6\uc774 \ub3d9\uc77c\ud55c \uc778\ud130\ud398\uc774\uc2a4\ub85c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n- \uc2e4\uc2dc\uac04 \uc2dc\uc138 \uc870\ud68c\ub294 \uc0c8\ub85c\uc6b4 \uc774\ubca4\ud2b8 \uc2dc\uc2a4\ud15c\uc73c\ub85c \ubcc0\uacbd\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n- \uacc4\uc88c \ubc0f \uc0c1\ud488 Scope \ud65c\uc6a9\uc774 \uadf9\ub300\ud654\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n\n### ver 1.0.6\n\n- \uc0c1\ud488\uae30\ubcf8\uc870\ud68c\uac00 \ucd94\uac00\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n\n- \ud658\uacbd \ubcc0\uc218\ub97c \ubd84\ub9ac\ud558\uc600\uc2b5\ub2c8\ub2e4.\n \uac01\uac01\uc758 \ud30c\uc77c\uc5d0 \ub098\ub258\uc5b4\uc788\ub358 Version, \uc811\uc18d URL, API Rate Limit \ub4f1\uc758 \uc0c1\uc218 \ub370\uc774\ud130\ub97c `__env__.py`\ub85c \uc62e\uacbc\uc2b5\ub2c8\ub2e4.\n\n- \uc608\uc678\uad6c\uc870 \ubcc0\uacbd\n \uae30\uc874 HTTP Error, RT_CD Error\ub97c \ubaa8\ub450 `ValueError`\ub85c \ucc98\ub9ac\ud558\ub358 \uad6c\uc870\uc5d0\uc11c \uac01\uac01\uc758 `KisHTTPError`, `KisAPIError` \uc608\uc678 \uac1d\uccb4\ub85c \ub098\ub204\uc5c8\uace0, `rt_cd`, `msg_cd` \ub4f1\uc758 \ubcc0\uc218\ub97c \uc608\uc678 \uac1d\uccb4\uc5d0\uc11c \ucc38\uc870\ud560 \uc218 \uc788\ub3c4\ub85d \ubcc0\uacbd\ud558\uc600\uc2b5\ub2c8\ub2e4.\n\n- \uc5d1\uc138\uc2a4\ud1a0\ud070 \ubc1c\uae09 Thread Safe\n \uc5d1\uc138\uc2a4 \ud1a0\ud070\uc774 \ubc1c\uae09\ub418\uc5b4\uc788\uc9c0 \uc54a\uc740 \uc0c1\ud0dc\uc5d0\uc11c \uba40\ud2f0\uc2a4\ub808\ub4dc\ub85c `KisAccessToken.ensure()` \ud568\uc218\ub97c \ud638\ucd9c\ud558\uba74 Thread Lock \ub418\uc9c0 \uc54a\uace0 \ub2e4\uc218\uac00 `KisAccessToken.issue()`\ub97c \ud638\ucd9c\ud558\ub294 \ubb38\uc81c\ub97c \ud574\uacb0\ud558\uc600\uc2b5\ub2c8\ub2e4.\n\n### ver 1.0.5\n\n- `RTClient`\uc5d0\uc11c \uc6f9\uc18c\ucf13 \uc5f0\uacb0\uc774 \ub04a\uc5b4\uc84c\uc744 \ub54c, \uc774\ubca4\ud2b8 \ucc98\ub9ac\uac00 \uc798\ubabb\ub418\ub294 \ubc84\uadf8\ub97c \uc218\uc815\ud558\uc600\uc2b5\ub2c8\ub2e4.\n\n- `RTClient`\uc5d0\uc11c \uc7ac\uc5f0\uacb0\uc2dc \uc2e4\uc2dc\uac04 \uc870\ud68c\uac00 \ubcf5\uad6c\ub418\uc9c0 \uc54a\ub294 \ubc84\uadf8\ub97c \uc218\uc815\ud558\uc600\uc2b5\ub2c8\ub2e4.\n\n- \ud734\uc7a5\uc77c \uc870\ud68c\uac00 \ucd94\uac00\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n\n- \ud574\uc678 \uc8fc\uc2dd \uc8fc\ubb38\uc774 \ucd94\uac00\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n\n- \ud574\uc678 \ubbf8\uccb4\uacb0 \uc870\ud68c\uac00 \ucd94\uac00\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n\n### ver 1.0.4\n\n- \uc8fc\uc2dd\uc794\uace0\uc870\ud68c_\uc2e4\ud604\uc190\uc775 \uc870\ud68c\uac00 \ucd94\uac00\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n\n- [\uc2e4\uc2dc\uac04 \ud574\uc81c\uc694\uccad\uc774 \uc815\uc0c1\uc801\uc73c\ub85c \ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4](https://github.com/Soju06/python-kis/issues/1) \ubc84\uadf8\ub97c \uc218\uc815\ud558\uc600\uc2b5\ub2c8\ub2e4.\n\n### ver 1.0.3\n\n- `RTClient` [\uc6f9\uc18c\ucf13 \ubcf4\uc548\uac15\ud654\ub97c \uc704\ud55c \uac1c\uc120 \uc548\ub0b4](https://apiportal.koreainvestment.com/community/10000000-0000-0011-0000-000000000001)\uc758 \ub0b4\uc6a9\uc5d0 \ub530\ub77c, \uc571\ud0a4 \ub300\uc2e0 \uc6f9\uc18c\ucf13 \uc811\uc18d\ud0a4\ub97c \ubc1c\uae09\ud558\uc5ec \uc0ac\uc6a9\ud558\ub3c4\ub85d \ubcc0\uacbd\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n\n### ver 1.0.2\n\n- API \ucd08\ub2f9 \uc694\uccad \uc81c\ud55c\uc744 \ub118\uc5b4\ubc84\ub9ac\ub294 \ubc84\uadf8\ub97c \uc218\uc815\ud558\uc600\uc2b5\ub2c8\ub2e4.\n- `period_price` \uc751\ub2f5 \ub370\uc774\ud130\uc758 `stck_fcam`\uac12 `float`\uc73c\ub85c \ubcc0\uacbd\ud558\uc600\uc2b5\ub2c8\ub2e4.\n- `utils.KRXMarketOpen` \uacf5\ud734\uc77c \ub370\uc774\ud130\uac00 1\uac1c\uc778 \uacbd\uc6b0 \uc624\ub958 \ubc1c\uc0dd\ud558\ub294 \ubc84\uadf8 \uc218\uc815\ud558\uc600\uc2b5\ub2c8\ub2e4.\n\n\n### License\n\n[MIT](https://github.com/Soju06/python-kis/blob/main/LICENCE)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "\ud30c\uc774\uc36c \ud55c\uad6d\ud22c\uc790\uc99d\uad8c REST \uae30\ubc18 Trading API \ub77c\uc774\ube0c\ub7ec\ub9ac",
"version": "2.1.3",
"project_urls": {
"Bug Tracker": "https://github.com/Soju06/python-kis/issues",
"Documentation": "https://github.com/Soju06/python-kis/wiki/Tutorial",
"Source Code": "https://github.com/Soju06/python-kis"
},
"split_keywords": [
"python",
" client",
" library",
" trading",
" websocket",
" realtime",
" investing",
" korean",
" investment",
" autotrading",
" koreainvestment"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9de638f92168d4d9c89a1863e85a9c6b9c87d30181efd5a790476a02def858b2",
"md5": "00e1f9a5e39600c6038a2beba7fa2c4f",
"sha256": "316c785624117e5a9a1c51a31d55bb7d008ed799b7432b5552886af03e1a2a9b"
},
"downloads": -1,
"filename": "python_kis-2.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "00e1f9a5e39600c6038a2beba7fa2c4f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 148439,
"upload_time": "2024-12-10T06:26:37",
"upload_time_iso_8601": "2024-12-10T06:26:37.895707Z",
"url": "https://files.pythonhosted.org/packages/9d/e6/38f92168d4d9c89a1863e85a9c6b9c87d30181efd5a790476a02def858b2/python_kis-2.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e82eb4a633c5898bddb04c51d1e39705918560d2fd2296759f7c6f75c3eb4660",
"md5": "b2436440d45e8f4eb771cf5080627b11",
"sha256": "e61a33e6973939755bc54de2e933cc94d99fb7c60d525d81fdfa2e60606293c8"
},
"downloads": -1,
"filename": "python_kis-2.1.3.tar.gz",
"has_sig": false,
"md5_digest": "b2436440d45e8f4eb771cf5080627b11",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 121542,
"upload_time": "2024-12-10T06:26:40",
"upload_time_iso_8601": "2024-12-10T06:26:40.859326Z",
"url": "https://files.pythonhosted.org/packages/e8/2e/b4a633c5898bddb04c51d1e39705918560d2fd2296759f7c6f75c3eb4660/python_kis-2.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-10 06:26:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Soju06",
"github_project": "python-kis",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "python-kis"
}