kiwoom-cli 2.1.0__tar.gz → 2.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/PKG-INFO +92 -46
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/README.md +91 -45
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/__init__.py +1 -1
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/auth.py +1 -1
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/order.py +20 -20
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/us/exchange.py +3 -4
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/us/order_ops.py +5 -5
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/config.py +16 -7
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/formatters.py +13 -1
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/main.py +62 -42
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/streaming.py +8 -8
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli.egg-info/PKG-INFO +92 -46
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli.egg-info/SOURCES.txt +1 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_auth_cli.py +15 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_cli.py +25 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_credentials.py +29 -0
- kiwoom_cli-2.1.1/tests/test_json_purity.py +82 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/LICENSE +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/api_spec.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/client.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/__init__.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/_constants.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/account.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/dashboard.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/market.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/stock.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/stream.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/us/__init__.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/us/_constants.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/us/account_ops.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/us/detect.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/us/stock_ops.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/commands/watch.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli/output.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli.egg-info/dependency_links.txt +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli.egg-info/entry_points.txt +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli.egg-info/requires.txt +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/kiwoom_cli.egg-info/top_level.txt +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/pyproject.toml +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/setup.cfg +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_account.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_auth.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_client.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_formatters.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_formatters_property.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_market.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_migration.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_order.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_stock.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_us.py +0 -0
- {kiwoom_cli-2.1.0 → kiwoom_cli-2.1.1}/tests/test_us_account.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kiwoom-cli
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: User-friendly CLI for the Kiwoom Securities REST API (키움증권)
|
|
5
5
|
License: LicenseRef-kiwoom-cli-Source-Available-1.0
|
|
6
6
|
Project-URL: Homepage, https://github.com/gejyn14/kiwoom-cli
|
|
@@ -37,30 +37,59 @@ Dynamic: license-file
|
|
|
37
37
|
|
|
38
38
|
# kiwoom-cli
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
**키움증권 REST API 전체를 터미널에서.** 시세 조회부터 주문, 실시간 스트리밍, 미국주식까지 — 명령어 하나로.
|
|
41
41
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
## 설치
|
|
42
|
+
[](https://pypi.org/project/kiwoom-cli/)
|
|
43
|
+
[](https://pypi.org/project/kiwoom-cli/)
|
|
44
|
+
[](https://github.com/gejyn14/kiwoom-cli/actions/workflows/ci.yml)
|
|
45
|
+
[](https://pypi.org/project/kiwoom-cli/)
|
|
46
|
+
[](LICENSE)
|
|
49
47
|
|
|
50
48
|
```bash
|
|
51
49
|
pip install kiwoom-cli
|
|
52
50
|
```
|
|
53
51
|
|
|
52
|
+
```bash
|
|
53
|
+
$ kiwoom stock price 005930 # 삼성전자 현재가
|
|
54
|
+
$ kiwoom order buy NVDA 10 --price 213.04 # 미국주식도 그대로
|
|
55
|
+
$ kiwoom -f json account balance | jq # AI 에이전트·스크립트 친화
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 왜 kiwoom-cli인가
|
|
59
|
+
|
|
60
|
+
- **236개 API 전체 지원** — REST 217개 + WebSocket 실시간 19종. 시세·차트·계좌·주문·순위·업종·테마·ETF·ELW·금현물·미국주식까지 키움 REST API를 빠짐없이 커버합니다.
|
|
61
|
+
- **프롬프트 제로** — 인증정보는 OS 키체인에 저장되고, 어떤 명령도 비밀번호를 묻지 않습니다. `gh`/`aws`/`docker`와 같은 모델. 크론잡, CI, AI 에이전트가 그대로 돌립니다.
|
|
62
|
+
- **AI 에이전트 퍼스트** — 구조화된 JSON 출력(`-f json`), 일관된 exit code(0/1/2/3), 주문 확인 게이트(`--confirm`). Claude Code, 자동매매 스크립트에 바로 연결됩니다.
|
|
63
|
+
- **미국주식 자동 라우팅** — `005930`은 국내로, `NVDA`는 미국으로. 거래소(NASDAQ/NYSE/AMEX)도 자동 판별. 국내+미국 통합 잔고를 원화 총계로 보여줍니다.
|
|
64
|
+
- **사람에게도 친절** — Rich 테이블, 상승=빨강/하락=파랑 색상, 실시간 TUI 대시보드, shell 자동완성.
|
|
65
|
+
- **246개 테스트 + CI** — Python 3.10–3.13 매트릭스, CodeQL 정적 분석.
|
|
66
|
+
|
|
67
|
+
> 📖 **전체 문서는 [Wiki](https://github.com/gejyn14/kiwoom-cli/wiki)에서** — 설치 가이드, 명령어 레퍼런스, 미국주식·AI 에이전트·멀티 프로필 가이드, 릴리스 노트.
|
|
68
|
+
|
|
69
|
+
## 최근 업데이트
|
|
70
|
+
|
|
71
|
+
### v2.1 — 비밀번호 프롬프트 완전 제거 (2026-07)
|
|
72
|
+
|
|
73
|
+
앱 자체 암호화 계층을 걷어내고 모든 인증정보를 OS 키체인에 직접 저장합니다. `config setup`, `auth login` 어디서도 더 이상 비밀번호를 묻지 않습니다. 기존 사용자는 업그레이드 후 `kiwoom config setup` 한 번만 다시 실행하면 됩니다.
|
|
74
|
+
|
|
75
|
+
### v2.0 — 미국주식 지원 (2026-07)
|
|
76
|
+
|
|
77
|
+
미국주식 29개 엔드포인트를 기존 명령 체계에 그대로 통합했습니다. 티커만 입력하면 시장을 자동 판별하므로 미국 주문도 국내 주문과 똑같이 짧습니다. 소수점 가격, stop/stop-limit/vwap/twap 주문유형, 환전(`account exchange`), 국내+미국 통합 계좌 뷰를 지원합니다.
|
|
78
|
+
|
|
79
|
+
전체 변경 내역: [CHANGELOG](CHANGELOG.md) · [Wiki 릴리스 노트](https://github.com/gejyn14/kiwoom-cli/wiki/Release-Notes)
|
|
80
|
+
|
|
54
81
|
## 시작하기
|
|
55
82
|
|
|
83
|
+
[키움증권 REST API](https://openapi.kiwoom.com)에서 appkey/secretkey를 발급받은 뒤:
|
|
84
|
+
|
|
56
85
|
```bash
|
|
57
|
-
# 1. 초기 설정 (appkey, secretkey
|
|
86
|
+
# 1. 초기 설정 (appkey, secretkey → OS 키체인)
|
|
58
87
|
kiwoom config setup
|
|
59
88
|
|
|
60
89
|
# 2. 토큰 발급
|
|
61
90
|
kiwoom auth login
|
|
62
91
|
|
|
63
|
-
# 3.
|
|
92
|
+
# 3. 끝. 이후 모든 명령은 프롬프트 없이 동작
|
|
64
93
|
kiwoom stock info 005930
|
|
65
94
|
```
|
|
66
95
|
|
|
@@ -111,17 +140,38 @@ kiwoom -p isa account balance
|
|
|
111
140
|
kiwoom -p isa auth login
|
|
112
141
|
```
|
|
113
142
|
|
|
143
|
+
## AI 에이전트와 함께 쓰기
|
|
144
|
+
|
|
145
|
+
kiwoom-cli는 AI 에이전트가 도구로 쓰는 것을 처음부터 염두에 두고 설계됐습니다.
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# 구조화된 JSON — 파싱이 필요 없는 출력
|
|
149
|
+
kiwoom -f json stock info 005930
|
|
150
|
+
kiwoom -f json market rank volume | jq '.[].stk_nm'
|
|
151
|
+
|
|
152
|
+
# 일관된 exit code — 0=성공, 1=입력오류, 2=API오류, 3=인증필요
|
|
153
|
+
kiwoom stock price 005930 || echo "재시도 또는 재인증"
|
|
154
|
+
|
|
155
|
+
# 주문은 기본 확인 게이트, 자동화 시에만 --confirm으로 명시적 스킵
|
|
156
|
+
kiwoom order buy 005930 10 --type market --confirm
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
- 어떤 명령도 비밀번호·생체인증을 요구하지 않으므로 에이전트 세션이 중간에 멈추지 않습니다.
|
|
160
|
+
- 페이지네이션(연속조회)은 자동 처리 — 에이전트가 커서를 관리할 필요가 없습니다.
|
|
161
|
+
- 자세한 패턴은 [Wiki: AI 에이전트 가이드](https://github.com/gejyn14/kiwoom-cli/wiki/AI-Agents) 참고.
|
|
162
|
+
|
|
114
163
|
## 명령어 구조
|
|
115
164
|
|
|
116
165
|
```
|
|
117
|
-
kiwoom [--format table|json|csv] [--no-color]
|
|
118
|
-
├── config 설정 (setup / show / domain)
|
|
166
|
+
kiwoom [--format table|json|csv] [--no-color] [-p 프로필]
|
|
167
|
+
├── config 설정 (setup / show / domain / profiles)
|
|
119
168
|
├── auth 인증 (login / logout / status)
|
|
120
169
|
├── stock 종목 조회 (info / orderbook / chart / compare ...)
|
|
121
170
|
├── account 계좌 조회 (balance / deposit / returns / pnl ...)
|
|
122
171
|
├── order 주문 (buy / sell / modify / cancel / credit / gold)
|
|
123
172
|
├── market 시장 정보 (rank / sector / theme / etf / elw / gold)
|
|
124
173
|
├── stream 실시간 스트리밍 (quote / orderbook / order / vi ...)
|
|
174
|
+
├── watch 실시간 종목 모니터링 (TUI)
|
|
125
175
|
├── dashboard 대시보드 (계좌 + 거래량 상위 한눈에)
|
|
126
176
|
└── api Raw API 호출
|
|
127
177
|
```
|
|
@@ -145,6 +195,7 @@ kiwoom stock sync # 전 시장 종목 리스트 다운로
|
|
|
145
195
|
kiwoom stock search 삼성 # 캐시에서 종목 검색
|
|
146
196
|
kiwoom stock search 삼성 --market kospi # 코스피만 필터
|
|
147
197
|
kiwoom stock watchlist "005930|000660" # 관심종목
|
|
198
|
+
kiwoom stock compare 005930 000660 # 종목 비교 (최대 여러 종목)
|
|
148
199
|
```
|
|
149
200
|
|
|
150
201
|
### 차트
|
|
@@ -197,6 +248,7 @@ kiwoom stock credit trend 005930 --date 20260301 --type loan
|
|
|
197
248
|
| `search` | 종목 검색 (캐시 기반, 시장/유형 필터) |
|
|
198
249
|
| `watchlist` | 관심종목 |
|
|
199
250
|
| `brokers` | 회원사 리스트 |
|
|
251
|
+
| `compare` | 복수 종목 비교 |
|
|
200
252
|
| `chart *` | 틱/분봉/일봉/주봉/월봉/년봉, 투자자별 차트 |
|
|
201
253
|
| `investor *` | 기관매매, 투자자별매매, 프로그램매매 등 10개 |
|
|
202
254
|
| `analysis *` | 거래상세, 거래량갱신, 매물대, PER, VI, 증권사 등 10개 |
|
|
@@ -211,7 +263,7 @@ kiwoom stock credit trend 005930 --date 20260301 --type loan
|
|
|
211
263
|
|
|
212
264
|
```bash
|
|
213
265
|
kiwoom account list # 계좌번호
|
|
214
|
-
kiwoom account balance # 잔고 + 보유종목 + 손익
|
|
266
|
+
kiwoom account balance # 잔고 + 보유종목 + 손익 (국내+미국 통합)
|
|
215
267
|
kiwoom account deposit # 예수금
|
|
216
268
|
kiwoom account asset # 추정자산
|
|
217
269
|
kiwoom account today # 당일현황
|
|
@@ -253,6 +305,9 @@ kiwoom account orderable amount 005930 --side buy --price 70000
|
|
|
253
305
|
| `orderable` | `amount` | 주문가능 금액 |
|
|
254
306
|
| `orderable` | `margin-qty` | 증거금율별 수량 |
|
|
255
307
|
| `orderable` | `credit-qty` | 신용보증금율별 수량 |
|
|
308
|
+
| `exchange` | `rate` | 환율 조회 |
|
|
309
|
+
| `exchange` | `estimate` | 환전 예상금액 |
|
|
310
|
+
| `exchange` | `apply` | 환전 신청 |
|
|
256
311
|
| `history` | `transactions` | 위탁종합 거래내역 |
|
|
257
312
|
| `history` | `journal` | 당일 매매일지 |
|
|
258
313
|
|
|
@@ -281,11 +336,13 @@ kiwoom account exchange apply 1000000 --confirm # 원화 → 달러 환전
|
|
|
281
336
|
- 정정은 가격만 가능(전량), 취소는 전량 취소만 지원됩니다 (키움 API 제약).
|
|
282
337
|
- 계좌 조회 명령(`balance/deposit/pnl/orders/history`)은 기본 통합 표시이며 `--market kr|us`로 필터링합니다.
|
|
283
338
|
|
|
339
|
+
자세한 가이드: [Wiki: 미국주식](https://github.com/gejyn14/kiwoom-cli/wiki/US-Stocks)
|
|
340
|
+
|
|
284
341
|
---
|
|
285
342
|
|
|
286
343
|
## order - 주문
|
|
287
344
|
|
|
288
|
-
|
|
345
|
+
주문은 실행 전 미리보기 + 대화형 확인이 기본입니다. 자동화 시에만 `--confirm`으로 스킵하세요.
|
|
289
346
|
|
|
290
347
|
```bash
|
|
291
348
|
# 주식
|
|
@@ -400,27 +457,13 @@ kiwoom stream types # 타입 코드 목록
|
|
|
400
457
|
|
|
401
458
|
---
|
|
402
459
|
|
|
403
|
-
## Raw API
|
|
404
|
-
|
|
405
|
-
```bash
|
|
406
|
-
kiwoom api ka10001 '{"stk_cd":"005930"}' # 테이블 출력
|
|
407
|
-
kiwoom api ka10001 '{"stk_cd":"005930"}' --raw # JSON 원본
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
---
|
|
411
|
-
|
|
412
|
-
## dashboard - 대시보드
|
|
460
|
+
## dashboard / Raw API
|
|
413
461
|
|
|
414
462
|
```bash
|
|
415
463
|
kiwoom dashboard # 계좌 요약 + 거래량 상위 한눈에
|
|
416
|
-
```
|
|
417
464
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
```bash
|
|
421
|
-
kiwoom stock compare 005930 000660 # 삼성전자 vs SK하이닉스
|
|
422
|
-
kiwoom stock compare 005930 000660 035420 # 3종목 비교
|
|
423
|
-
kiwoom -f json stock compare 005930 000660 # JSON 출력
|
|
465
|
+
kiwoom api ka10001 '{"stk_cd":"005930"}' # Raw API — 테이블 출력
|
|
466
|
+
kiwoom api ka10001 '{"stk_cd":"005930"}' --raw # JSON 원본
|
|
424
467
|
```
|
|
425
468
|
|
|
426
469
|
---
|
|
@@ -466,6 +509,23 @@ eval (env _KIWOOM_COMPLETE=fish_source kiwoom)
|
|
|
466
509
|
| 2 | API/네트워크 오류 |
|
|
467
510
|
| 3 | 인증 필요 (토큰 만료) |
|
|
468
511
|
|
|
512
|
+
## 보안
|
|
513
|
+
|
|
514
|
+
모든 인증정보(appkey, secretkey, 토큰)는 **OS 키체인**(macOS Keychain / Windows Credential Manager / Linux Secret Service)에 저장됩니다. 파일로 존재하지 않으며, 키체인이 디스크 저장 시 암호화를 담당합니다. `gh`, `aws`, `docker` CLI와 동일한 모델입니다.
|
|
515
|
+
|
|
516
|
+
| 항목 | 저장 방식 | 프롬프트 |
|
|
517
|
+
| ------------------ | ------------------ | :------: |
|
|
518
|
+
| appkey / secretkey | OS 키체인 | X |
|
|
519
|
+
| 토큰 | OS 키체인 | X |
|
|
520
|
+
| config.toml | 도메인, 계좌번호만 | X |
|
|
521
|
+
|
|
522
|
+
- 모든 명령어는 비밀번호/생체인증 프롬프트 없이 동작 (AI 에이전트·자동화 친화적)
|
|
523
|
+
- 앱 자체 암호화 계층은 의도적으로 두지 않음 — 추가 계층은 명령마다 잠금 해제 프롬프트를 요구하게 되어 CLI 사용성을 해침
|
|
524
|
+
- v2.0 이하에서 업그레이드한 경우: 암호화 저장소 형식이 제거되어 `kiwoom config setup`을 한 번 다시 실행해야 합니다
|
|
525
|
+
- 주문은 기본적으로 미리보기 + 대화형 확인을 거칩니다 (`--confirm`으로 스킵)
|
|
526
|
+
|
|
527
|
+
자세한 내용: [Wiki: 보안 모델](https://github.com/gejyn14/kiwoom-cli/wiki/Security) · [SECURITY.md](SECURITY.md)
|
|
528
|
+
|
|
469
529
|
## 참고
|
|
470
530
|
|
|
471
531
|
| 항목 | 값 |
|
|
@@ -484,20 +544,6 @@ eval (env _KIWOOM_COMPLETE=fish_source kiwoom)
|
|
|
484
544
|
- 종목코드 6자리: `005930` (삼성전자)
|
|
485
545
|
- 금현물: `M04020000` (1kg), `M04020100` (미니 100g)
|
|
486
546
|
|
|
487
|
-
## 보안
|
|
488
|
-
|
|
489
|
-
모든 인증정보(appkey, secretkey, 토큰)는 **OS 키체인**(macOS Keychain / Windows Credential Manager / Linux Secret Service)에 저장됩니다. 파일로 존재하지 않으며, 키체인이 디스크 저장 시 암호화를 담당합니다. `gh`, `aws`, `docker` CLI와 동일한 모델입니다.
|
|
490
|
-
|
|
491
|
-
| 항목 | 저장 방식 | 프롬프트 |
|
|
492
|
-
| ------------------ | ------------------ | :------: |
|
|
493
|
-
| appkey / secretkey | OS 키체인 | X |
|
|
494
|
-
| 토큰 | OS 키체인 | X |
|
|
495
|
-
| config.toml | 도메인, 계좌번호만 | X |
|
|
496
|
-
|
|
497
|
-
- 모든 명령어는 비밀번호/생체인증 프롬프트 없이 동작 (AI 에이전트·자동화 친화적)
|
|
498
|
-
- 앱 자체 암호화 계층은 의도적으로 두지 않음 — 추가 계층은 명령마다 잠금 해제 프롬프트를 요구하게 되어 CLI 사용성을 해침
|
|
499
|
-
- v2.0 이하에서 업그레이드한 경우: 암호화 저장소 형식이 제거되어 `kiwoom config setup`을 한 번 다시 실행해야 합니다
|
|
500
|
-
|
|
501
547
|
## License
|
|
502
548
|
|
|
503
549
|
kiwoom-cli **Source-Available License, Version 1.0** — see [LICENSE](LICENSE).
|
|
@@ -1,29 +1,58 @@
|
|
|
1
1
|
# kiwoom-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**키움증권 REST API 전체를 터미널에서.** 시세 조회부터 주문, 실시간 스트리밍, 미국주식까지 — 명령어 하나로.
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## 설치
|
|
5
|
+
[](https://pypi.org/project/kiwoom-cli/)
|
|
6
|
+
[](https://pypi.org/project/kiwoom-cli/)
|
|
7
|
+
[](https://github.com/gejyn14/kiwoom-cli/actions/workflows/ci.yml)
|
|
8
|
+
[](https://pypi.org/project/kiwoom-cli/)
|
|
9
|
+
[](LICENSE)
|
|
12
10
|
|
|
13
11
|
```bash
|
|
14
12
|
pip install kiwoom-cli
|
|
15
13
|
```
|
|
16
14
|
|
|
15
|
+
```bash
|
|
16
|
+
$ kiwoom stock price 005930 # 삼성전자 현재가
|
|
17
|
+
$ kiwoom order buy NVDA 10 --price 213.04 # 미국주식도 그대로
|
|
18
|
+
$ kiwoom -f json account balance | jq # AI 에이전트·스크립트 친화
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 왜 kiwoom-cli인가
|
|
22
|
+
|
|
23
|
+
- **236개 API 전체 지원** — REST 217개 + WebSocket 실시간 19종. 시세·차트·계좌·주문·순위·업종·테마·ETF·ELW·금현물·미국주식까지 키움 REST API를 빠짐없이 커버합니다.
|
|
24
|
+
- **프롬프트 제로** — 인증정보는 OS 키체인에 저장되고, 어떤 명령도 비밀번호를 묻지 않습니다. `gh`/`aws`/`docker`와 같은 모델. 크론잡, CI, AI 에이전트가 그대로 돌립니다.
|
|
25
|
+
- **AI 에이전트 퍼스트** — 구조화된 JSON 출력(`-f json`), 일관된 exit code(0/1/2/3), 주문 확인 게이트(`--confirm`). Claude Code, 자동매매 스크립트에 바로 연결됩니다.
|
|
26
|
+
- **미국주식 자동 라우팅** — `005930`은 국내로, `NVDA`는 미국으로. 거래소(NASDAQ/NYSE/AMEX)도 자동 판별. 국내+미국 통합 잔고를 원화 총계로 보여줍니다.
|
|
27
|
+
- **사람에게도 친절** — Rich 테이블, 상승=빨강/하락=파랑 색상, 실시간 TUI 대시보드, shell 자동완성.
|
|
28
|
+
- **246개 테스트 + CI** — Python 3.10–3.13 매트릭스, CodeQL 정적 분석.
|
|
29
|
+
|
|
30
|
+
> 📖 **전체 문서는 [Wiki](https://github.com/gejyn14/kiwoom-cli/wiki)에서** — 설치 가이드, 명령어 레퍼런스, 미국주식·AI 에이전트·멀티 프로필 가이드, 릴리스 노트.
|
|
31
|
+
|
|
32
|
+
## 최근 업데이트
|
|
33
|
+
|
|
34
|
+
### v2.1 — 비밀번호 프롬프트 완전 제거 (2026-07)
|
|
35
|
+
|
|
36
|
+
앱 자체 암호화 계층을 걷어내고 모든 인증정보를 OS 키체인에 직접 저장합니다. `config setup`, `auth login` 어디서도 더 이상 비밀번호를 묻지 않습니다. 기존 사용자는 업그레이드 후 `kiwoom config setup` 한 번만 다시 실행하면 됩니다.
|
|
37
|
+
|
|
38
|
+
### v2.0 — 미국주식 지원 (2026-07)
|
|
39
|
+
|
|
40
|
+
미국주식 29개 엔드포인트를 기존 명령 체계에 그대로 통합했습니다. 티커만 입력하면 시장을 자동 판별하므로 미국 주문도 국내 주문과 똑같이 짧습니다. 소수점 가격, stop/stop-limit/vwap/twap 주문유형, 환전(`account exchange`), 국내+미국 통합 계좌 뷰를 지원합니다.
|
|
41
|
+
|
|
42
|
+
전체 변경 내역: [CHANGELOG](CHANGELOG.md) · [Wiki 릴리스 노트](https://github.com/gejyn14/kiwoom-cli/wiki/Release-Notes)
|
|
43
|
+
|
|
17
44
|
## 시작하기
|
|
18
45
|
|
|
46
|
+
[키움증권 REST API](https://openapi.kiwoom.com)에서 appkey/secretkey를 발급받은 뒤:
|
|
47
|
+
|
|
19
48
|
```bash
|
|
20
|
-
# 1. 초기 설정 (appkey, secretkey
|
|
49
|
+
# 1. 초기 설정 (appkey, secretkey → OS 키체인)
|
|
21
50
|
kiwoom config setup
|
|
22
51
|
|
|
23
52
|
# 2. 토큰 발급
|
|
24
53
|
kiwoom auth login
|
|
25
54
|
|
|
26
|
-
# 3.
|
|
55
|
+
# 3. 끝. 이후 모든 명령은 프롬프트 없이 동작
|
|
27
56
|
kiwoom stock info 005930
|
|
28
57
|
```
|
|
29
58
|
|
|
@@ -74,17 +103,38 @@ kiwoom -p isa account balance
|
|
|
74
103
|
kiwoom -p isa auth login
|
|
75
104
|
```
|
|
76
105
|
|
|
106
|
+
## AI 에이전트와 함께 쓰기
|
|
107
|
+
|
|
108
|
+
kiwoom-cli는 AI 에이전트가 도구로 쓰는 것을 처음부터 염두에 두고 설계됐습니다.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# 구조화된 JSON — 파싱이 필요 없는 출력
|
|
112
|
+
kiwoom -f json stock info 005930
|
|
113
|
+
kiwoom -f json market rank volume | jq '.[].stk_nm'
|
|
114
|
+
|
|
115
|
+
# 일관된 exit code — 0=성공, 1=입력오류, 2=API오류, 3=인증필요
|
|
116
|
+
kiwoom stock price 005930 || echo "재시도 또는 재인증"
|
|
117
|
+
|
|
118
|
+
# 주문은 기본 확인 게이트, 자동화 시에만 --confirm으로 명시적 스킵
|
|
119
|
+
kiwoom order buy 005930 10 --type market --confirm
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
- 어떤 명령도 비밀번호·생체인증을 요구하지 않으므로 에이전트 세션이 중간에 멈추지 않습니다.
|
|
123
|
+
- 페이지네이션(연속조회)은 자동 처리 — 에이전트가 커서를 관리할 필요가 없습니다.
|
|
124
|
+
- 자세한 패턴은 [Wiki: AI 에이전트 가이드](https://github.com/gejyn14/kiwoom-cli/wiki/AI-Agents) 참고.
|
|
125
|
+
|
|
77
126
|
## 명령어 구조
|
|
78
127
|
|
|
79
128
|
```
|
|
80
|
-
kiwoom [--format table|json|csv] [--no-color]
|
|
81
|
-
├── config 설정 (setup / show / domain)
|
|
129
|
+
kiwoom [--format table|json|csv] [--no-color] [-p 프로필]
|
|
130
|
+
├── config 설정 (setup / show / domain / profiles)
|
|
82
131
|
├── auth 인증 (login / logout / status)
|
|
83
132
|
├── stock 종목 조회 (info / orderbook / chart / compare ...)
|
|
84
133
|
├── account 계좌 조회 (balance / deposit / returns / pnl ...)
|
|
85
134
|
├── order 주문 (buy / sell / modify / cancel / credit / gold)
|
|
86
135
|
├── market 시장 정보 (rank / sector / theme / etf / elw / gold)
|
|
87
136
|
├── stream 실시간 스트리밍 (quote / orderbook / order / vi ...)
|
|
137
|
+
├── watch 실시간 종목 모니터링 (TUI)
|
|
88
138
|
├── dashboard 대시보드 (계좌 + 거래량 상위 한눈에)
|
|
89
139
|
└── api Raw API 호출
|
|
90
140
|
```
|
|
@@ -108,6 +158,7 @@ kiwoom stock sync # 전 시장 종목 리스트 다운로
|
|
|
108
158
|
kiwoom stock search 삼성 # 캐시에서 종목 검색
|
|
109
159
|
kiwoom stock search 삼성 --market kospi # 코스피만 필터
|
|
110
160
|
kiwoom stock watchlist "005930|000660" # 관심종목
|
|
161
|
+
kiwoom stock compare 005930 000660 # 종목 비교 (최대 여러 종목)
|
|
111
162
|
```
|
|
112
163
|
|
|
113
164
|
### 차트
|
|
@@ -160,6 +211,7 @@ kiwoom stock credit trend 005930 --date 20260301 --type loan
|
|
|
160
211
|
| `search` | 종목 검색 (캐시 기반, 시장/유형 필터) |
|
|
161
212
|
| `watchlist` | 관심종목 |
|
|
162
213
|
| `brokers` | 회원사 리스트 |
|
|
214
|
+
| `compare` | 복수 종목 비교 |
|
|
163
215
|
| `chart *` | 틱/분봉/일봉/주봉/월봉/년봉, 투자자별 차트 |
|
|
164
216
|
| `investor *` | 기관매매, 투자자별매매, 프로그램매매 등 10개 |
|
|
165
217
|
| `analysis *` | 거래상세, 거래량갱신, 매물대, PER, VI, 증권사 등 10개 |
|
|
@@ -174,7 +226,7 @@ kiwoom stock credit trend 005930 --date 20260301 --type loan
|
|
|
174
226
|
|
|
175
227
|
```bash
|
|
176
228
|
kiwoom account list # 계좌번호
|
|
177
|
-
kiwoom account balance # 잔고 + 보유종목 + 손익
|
|
229
|
+
kiwoom account balance # 잔고 + 보유종목 + 손익 (국내+미국 통합)
|
|
178
230
|
kiwoom account deposit # 예수금
|
|
179
231
|
kiwoom account asset # 추정자산
|
|
180
232
|
kiwoom account today # 당일현황
|
|
@@ -216,6 +268,9 @@ kiwoom account orderable amount 005930 --side buy --price 70000
|
|
|
216
268
|
| `orderable` | `amount` | 주문가능 금액 |
|
|
217
269
|
| `orderable` | `margin-qty` | 증거금율별 수량 |
|
|
218
270
|
| `orderable` | `credit-qty` | 신용보증금율별 수량 |
|
|
271
|
+
| `exchange` | `rate` | 환율 조회 |
|
|
272
|
+
| `exchange` | `estimate` | 환전 예상금액 |
|
|
273
|
+
| `exchange` | `apply` | 환전 신청 |
|
|
219
274
|
| `history` | `transactions` | 위탁종합 거래내역 |
|
|
220
275
|
| `history` | `journal` | 당일 매매일지 |
|
|
221
276
|
|
|
@@ -244,11 +299,13 @@ kiwoom account exchange apply 1000000 --confirm # 원화 → 달러 환전
|
|
|
244
299
|
- 정정은 가격만 가능(전량), 취소는 전량 취소만 지원됩니다 (키움 API 제약).
|
|
245
300
|
- 계좌 조회 명령(`balance/deposit/pnl/orders/history`)은 기본 통합 표시이며 `--market kr|us`로 필터링합니다.
|
|
246
301
|
|
|
302
|
+
자세한 가이드: [Wiki: 미국주식](https://github.com/gejyn14/kiwoom-cli/wiki/US-Stocks)
|
|
303
|
+
|
|
247
304
|
---
|
|
248
305
|
|
|
249
306
|
## order - 주문
|
|
250
307
|
|
|
251
|
-
|
|
308
|
+
주문은 실행 전 미리보기 + 대화형 확인이 기본입니다. 자동화 시에만 `--confirm`으로 스킵하세요.
|
|
252
309
|
|
|
253
310
|
```bash
|
|
254
311
|
# 주식
|
|
@@ -363,27 +420,13 @@ kiwoom stream types # 타입 코드 목록
|
|
|
363
420
|
|
|
364
421
|
---
|
|
365
422
|
|
|
366
|
-
## Raw API
|
|
367
|
-
|
|
368
|
-
```bash
|
|
369
|
-
kiwoom api ka10001 '{"stk_cd":"005930"}' # 테이블 출력
|
|
370
|
-
kiwoom api ka10001 '{"stk_cd":"005930"}' --raw # JSON 원본
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
---
|
|
374
|
-
|
|
375
|
-
## dashboard - 대시보드
|
|
423
|
+
## dashboard / Raw API
|
|
376
424
|
|
|
377
425
|
```bash
|
|
378
426
|
kiwoom dashboard # 계좌 요약 + 거래량 상위 한눈에
|
|
379
|
-
```
|
|
380
427
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
```bash
|
|
384
|
-
kiwoom stock compare 005930 000660 # 삼성전자 vs SK하이닉스
|
|
385
|
-
kiwoom stock compare 005930 000660 035420 # 3종목 비교
|
|
386
|
-
kiwoom -f json stock compare 005930 000660 # JSON 출력
|
|
428
|
+
kiwoom api ka10001 '{"stk_cd":"005930"}' # Raw API — 테이블 출력
|
|
429
|
+
kiwoom api ka10001 '{"stk_cd":"005930"}' --raw # JSON 원본
|
|
387
430
|
```
|
|
388
431
|
|
|
389
432
|
---
|
|
@@ -429,6 +472,23 @@ eval (env _KIWOOM_COMPLETE=fish_source kiwoom)
|
|
|
429
472
|
| 2 | API/네트워크 오류 |
|
|
430
473
|
| 3 | 인증 필요 (토큰 만료) |
|
|
431
474
|
|
|
475
|
+
## 보안
|
|
476
|
+
|
|
477
|
+
모든 인증정보(appkey, secretkey, 토큰)는 **OS 키체인**(macOS Keychain / Windows Credential Manager / Linux Secret Service)에 저장됩니다. 파일로 존재하지 않으며, 키체인이 디스크 저장 시 암호화를 담당합니다. `gh`, `aws`, `docker` CLI와 동일한 모델입니다.
|
|
478
|
+
|
|
479
|
+
| 항목 | 저장 방식 | 프롬프트 |
|
|
480
|
+
| ------------------ | ------------------ | :------: |
|
|
481
|
+
| appkey / secretkey | OS 키체인 | X |
|
|
482
|
+
| 토큰 | OS 키체인 | X |
|
|
483
|
+
| config.toml | 도메인, 계좌번호만 | X |
|
|
484
|
+
|
|
485
|
+
- 모든 명령어는 비밀번호/생체인증 프롬프트 없이 동작 (AI 에이전트·자동화 친화적)
|
|
486
|
+
- 앱 자체 암호화 계층은 의도적으로 두지 않음 — 추가 계층은 명령마다 잠금 해제 프롬프트를 요구하게 되어 CLI 사용성을 해침
|
|
487
|
+
- v2.0 이하에서 업그레이드한 경우: 암호화 저장소 형식이 제거되어 `kiwoom config setup`을 한 번 다시 실행해야 합니다
|
|
488
|
+
- 주문은 기본적으로 미리보기 + 대화형 확인을 거칩니다 (`--confirm`으로 스킵)
|
|
489
|
+
|
|
490
|
+
자세한 내용: [Wiki: 보안 모델](https://github.com/gejyn14/kiwoom-cli/wiki/Security) · [SECURITY.md](SECURITY.md)
|
|
491
|
+
|
|
432
492
|
## 참고
|
|
433
493
|
|
|
434
494
|
| 항목 | 값 |
|
|
@@ -447,20 +507,6 @@ eval (env _KIWOOM_COMPLETE=fish_source kiwoom)
|
|
|
447
507
|
- 종목코드 6자리: `005930` (삼성전자)
|
|
448
508
|
- 금현물: `M04020000` (1kg), `M04020100` (미니 100g)
|
|
449
509
|
|
|
450
|
-
## 보안
|
|
451
|
-
|
|
452
|
-
모든 인증정보(appkey, secretkey, 토큰)는 **OS 키체인**(macOS Keychain / Windows Credential Manager / Linux Secret Service)에 저장됩니다. 파일로 존재하지 않으며, 키체인이 디스크 저장 시 암호화를 담당합니다. `gh`, `aws`, `docker` CLI와 동일한 모델입니다.
|
|
453
|
-
|
|
454
|
-
| 항목 | 저장 방식 | 프롬프트 |
|
|
455
|
-
| ------------------ | ------------------ | :------: |
|
|
456
|
-
| appkey / secretkey | OS 키체인 | X |
|
|
457
|
-
| 토큰 | OS 키체인 | X |
|
|
458
|
-
| config.toml | 도메인, 계좌번호만 | X |
|
|
459
|
-
|
|
460
|
-
- 모든 명령어는 비밀번호/생체인증 프롬프트 없이 동작 (AI 에이전트·자동화 친화적)
|
|
461
|
-
- 앱 자체 암호화 계층은 의도적으로 두지 않음 — 추가 계층은 명령마다 잠금 해제 프롬프트를 요구하게 되어 CLI 사용성을 해침
|
|
462
|
-
- v2.0 이하에서 업그레이드한 경우: 암호화 저장소 형식이 제거되어 `kiwoom config setup`을 한 번 다시 실행해야 합니다
|
|
463
|
-
|
|
464
510
|
## License
|
|
465
511
|
|
|
466
512
|
kiwoom-cli **Source-Available License, Version 1.0** — see [LICENSE](LICENSE).
|
|
@@ -21,7 +21,7 @@ def save_token(token: str, profile: str | None = None) -> None:
|
|
|
21
21
|
|
|
22
22
|
def load_token(profile: str | None = None) -> str | None:
|
|
23
23
|
p = config.resolve_profile(profile)
|
|
24
|
-
return
|
|
24
|
+
return config._keyring_get(f"{p}:token")
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def delete_token(profile: str | None = None) -> None:
|
|
@@ -17,8 +17,8 @@ import click
|
|
|
17
17
|
from rich.panel import Panel
|
|
18
18
|
|
|
19
19
|
from ..client import KiwoomClient
|
|
20
|
-
from ..formatters import print_order_result, print_generic_table
|
|
21
|
-
from ..output import
|
|
20
|
+
from ..formatters import human, print_order_result, print_generic_table
|
|
21
|
+
from ..output import err_console
|
|
22
22
|
from .us import order_ops as us_order_ops
|
|
23
23
|
from .us._constants import US_ORDER_TYPES
|
|
24
24
|
from .us.detect import is_us_symbol
|
|
@@ -83,7 +83,7 @@ def _show_order_preview(action: str, code: str, qty: int, price: int, order_type
|
|
|
83
83
|
)
|
|
84
84
|
if dmst_stex_tp is not None:
|
|
85
85
|
body += f"\n 거래소: {dmst_stex_tp}"
|
|
86
|
-
|
|
86
|
+
human(Panel(
|
|
87
87
|
body,
|
|
88
88
|
title="주문 확인",
|
|
89
89
|
border_style="yellow",
|
|
@@ -99,7 +99,7 @@ def _show_modify_preview(action: str, orig_ord_no: str, code: str, qty: int, pri
|
|
|
99
99
|
]
|
|
100
100
|
if dmst_stex_tp is not None:
|
|
101
101
|
lines.append(f" 거래소: {dmst_stex_tp}")
|
|
102
|
-
|
|
102
|
+
human(Panel(
|
|
103
103
|
f"[bold]{action} 주문[/]\n\n" + "\n".join(lines),
|
|
104
104
|
title="주문 확인",
|
|
105
105
|
border_style="yellow",
|
|
@@ -115,7 +115,7 @@ def _show_cancel_preview(action: str, orig_ord_no: str, code: str, qty: int, dms
|
|
|
115
115
|
]
|
|
116
116
|
if dmst_stex_tp is not None:
|
|
117
117
|
lines.append(f" 거래소: {dmst_stex_tp}")
|
|
118
|
-
|
|
118
|
+
human(Panel(
|
|
119
119
|
f"[bold]{action} 주문[/]\n\n" + "\n".join(lines),
|
|
120
120
|
title="주문 확인",
|
|
121
121
|
border_style="yellow",
|
|
@@ -160,7 +160,7 @@ def buy(code: str, qty: int, price: float, order_type: str, exchange: str | None
|
|
|
160
160
|
trde_tp = _kr_type_or_exit(order_type)
|
|
161
161
|
kr_price = _kr_price_or_exit(price)
|
|
162
162
|
if not confirm:
|
|
163
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
163
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
164
164
|
|
|
165
165
|
_show_order_preview("매수", code, qty, kr_price, order_type, dmst_stex_tp)
|
|
166
166
|
|
|
@@ -204,7 +204,7 @@ def sell(code: str, qty: int, price: float, order_type: str, exchange: str | Non
|
|
|
204
204
|
trde_tp = _kr_type_or_exit(order_type)
|
|
205
205
|
kr_price = _kr_price_or_exit(price)
|
|
206
206
|
if not confirm:
|
|
207
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
207
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
208
208
|
|
|
209
209
|
_show_order_preview("매도", code, qty, kr_price, order_type, dmst_stex_tp)
|
|
210
210
|
|
|
@@ -247,7 +247,7 @@ def modify(orig_order_no: str, code: str, qty: int, price: float, exchange: str
|
|
|
247
247
|
dmst_stex_tp = exchange or "KRX"
|
|
248
248
|
kr_price = _kr_price_or_exit(price)
|
|
249
249
|
if not confirm:
|
|
250
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
250
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
251
251
|
|
|
252
252
|
_show_modify_preview("정정", orig_order_no, code, qty, kr_price, dmst_stex_tp)
|
|
253
253
|
|
|
@@ -280,7 +280,7 @@ def cancel(orig_order_no: str, code: str, qty: int, exchange: str | None, confir
|
|
|
280
280
|
|
|
281
281
|
dmst_stex_tp = exchange or "KRX"
|
|
282
282
|
if not confirm:
|
|
283
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
283
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
284
284
|
|
|
285
285
|
_show_cancel_preview("취소", orig_order_no, code, qty, dmst_stex_tp)
|
|
286
286
|
|
|
@@ -318,7 +318,7 @@ def credit_buy(code: str, qty: int, price: int, order_type: str, dmst_stex_tp: s
|
|
|
318
318
|
예: kiwoom order credit buy 005930 10 --type limit --price 70000 --confirm
|
|
319
319
|
"""
|
|
320
320
|
if not confirm:
|
|
321
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
321
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
322
322
|
|
|
323
323
|
_show_order_preview("신용 매수", code, qty, price, order_type, dmst_stex_tp)
|
|
324
324
|
|
|
@@ -348,7 +348,7 @@ def credit_sell(code: str, qty: int, price: int, order_type: str, dmst_stex_tp:
|
|
|
348
348
|
예: kiwoom order credit sell 005930 10 --type market --confirm
|
|
349
349
|
"""
|
|
350
350
|
if not confirm:
|
|
351
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
351
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
352
352
|
|
|
353
353
|
_show_order_preview("신용 매도", code, qty, price, order_type, dmst_stex_tp)
|
|
354
354
|
|
|
@@ -378,7 +378,7 @@ def credit_modify(orig_order_no: str, code: str, qty: int, price: int, dmst_stex
|
|
|
378
378
|
예: kiwoom order credit modify 0000139 005930 1 70000 --confirm
|
|
379
379
|
"""
|
|
380
380
|
if not confirm:
|
|
381
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
381
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
382
382
|
|
|
383
383
|
_show_modify_preview("신용 정정", orig_order_no, code, qty, price, dmst_stex_tp)
|
|
384
384
|
|
|
@@ -406,7 +406,7 @@ def credit_cancel(orig_order_no: str, code: str, qty: int, dmst_stex_tp: str, co
|
|
|
406
406
|
예: kiwoom order credit cancel 0000140 005930 --confirm
|
|
407
407
|
"""
|
|
408
408
|
if not confirm:
|
|
409
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
409
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
410
410
|
|
|
411
411
|
_show_cancel_preview("신용 취소", orig_order_no, code, qty, dmst_stex_tp)
|
|
412
412
|
|
|
@@ -442,7 +442,7 @@ def gold_buy(code: str, qty: int, price: int, order_type: str, confirm: bool):
|
|
|
442
442
|
예: kiwoom order gold buy 730060 10 --type limit --price 90000 --confirm
|
|
443
443
|
"""
|
|
444
444
|
if not confirm:
|
|
445
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
445
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
446
446
|
|
|
447
447
|
_show_order_preview("금현물 매수", code, qty, price, order_type)
|
|
448
448
|
|
|
@@ -468,7 +468,7 @@ def gold_sell(code: str, qty: int, price: int, order_type: str, confirm: bool):
|
|
|
468
468
|
예: kiwoom order gold sell 730060 10 --type market --confirm
|
|
469
469
|
"""
|
|
470
470
|
if not confirm:
|
|
471
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
471
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
472
472
|
|
|
473
473
|
_show_order_preview("금현물 매도", code, qty, price, order_type)
|
|
474
474
|
|
|
@@ -494,7 +494,7 @@ def gold_modify(orig_order_no: str, code: str, qty: int, price: int, confirm: bo
|
|
|
494
494
|
예: kiwoom order gold modify 0000139 730060 1 90000 --confirm
|
|
495
495
|
"""
|
|
496
496
|
if not confirm:
|
|
497
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
497
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
498
498
|
|
|
499
499
|
_show_modify_preview("금현물 정정", orig_order_no, code, qty, price)
|
|
500
500
|
|
|
@@ -519,7 +519,7 @@ def gold_cancel(orig_order_no: str, code: str, qty: int, confirm: bool):
|
|
|
519
519
|
예: kiwoom order gold cancel 0000140 730060 --confirm
|
|
520
520
|
"""
|
|
521
521
|
if not confirm:
|
|
522
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
522
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
523
523
|
|
|
524
524
|
_show_cancel_preview("금현물 취소", orig_order_no, code, qty)
|
|
525
525
|
|
|
@@ -635,7 +635,7 @@ def condition_search(seq: str, stex_tp: str, cont_yn: str, next_key: str, confir
|
|
|
635
635
|
예: kiwoom order condition search 001 --confirm
|
|
636
636
|
"""
|
|
637
637
|
if not confirm:
|
|
638
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
638
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
639
639
|
|
|
640
640
|
body = {
|
|
641
641
|
"trnm": "CNSRREQ",
|
|
@@ -663,7 +663,7 @@ def condition_realtime(seq: str, stex_tp: str, confirm: bool):
|
|
|
663
663
|
예: kiwoom order condition realtime 001 --confirm
|
|
664
664
|
"""
|
|
665
665
|
if not confirm:
|
|
666
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
666
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
667
667
|
|
|
668
668
|
with KiwoomClient() as c:
|
|
669
669
|
data, _ = c.request("ka10173", {
|
|
@@ -684,7 +684,7 @@ def condition_stop(seq: str, confirm: bool):
|
|
|
684
684
|
예: kiwoom order condition stop 001 --confirm
|
|
685
685
|
"""
|
|
686
686
|
if not confirm:
|
|
687
|
-
click.confirm("주문을 실행하시겠습니까?", abort=True)
|
|
687
|
+
click.confirm("주문을 실행하시겠습니까?", abort=True, err=True)
|
|
688
688
|
|
|
689
689
|
with KiwoomClient() as c:
|
|
690
690
|
data, _ = c.request("ka10174", {
|