kiwoom-cli 0.6.1__tar.gz → 0.6.3__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-0.6.1 → kiwoom_cli-0.6.3}/PKG-INFO +9 -6
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/README.md +8 -5
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/__init__.py +1 -1
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/commands/dashboard.py +15 -7
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/formatters.py +29 -6
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/main.py +26 -9
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli.egg-info/PKG-INFO +9 -6
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/pyproject.toml +1 -1
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/tests/test_cli.py +1 -1
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/LICENSE +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/api_spec.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/auth.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/client.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/commands/__init__.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/commands/account.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/commands/market.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/commands/order.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/commands/stock.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/commands/stream.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/commands/watch.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/config.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/output.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/secure_store.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli/streaming.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli.egg-info/SOURCES.txt +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli.egg-info/dependency_links.txt +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli.egg-info/entry_points.txt +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli.egg-info/requires.txt +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/kiwoom_cli.egg-info/top_level.txt +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/setup.cfg +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/tests/test_client.py +0 -0
- {kiwoom_cli-0.6.1 → kiwoom_cli-0.6.3}/tests/test_formatters.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kiwoom-cli
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.3
|
|
4
4
|
Summary: User-friendly CLI for the Kiwoom Securities REST API (키움증권)
|
|
5
5
|
License: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/gejyn14/kiwoom-cli
|
|
@@ -92,16 +92,19 @@ appkey/secretkey는 보안을 위해 환경변수를 지원하지 않습니다.
|
|
|
92
92
|
```bash
|
|
93
93
|
# 프로필별 설정
|
|
94
94
|
kiwoom config setup --profile default # 메인계좌
|
|
95
|
-
kiwoom config setup --profile isa
|
|
95
|
+
kiwoom config setup --profile isa # ISA계좌
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
kiwoom config
|
|
97
|
+
# 프로필 설정 변경
|
|
98
|
+
kiwoom config set domain prod # 도메인 변경
|
|
99
|
+
kiwoom config set account 1234567 # 계좌번호 설정
|
|
100
|
+
kiwoom -p isa config set domain mock # 특정 프로필
|
|
99
101
|
|
|
100
|
-
# 프로필 목록
|
|
102
|
+
# 프로필 전환 / 목록
|
|
103
|
+
kiwoom config use isa
|
|
101
104
|
kiwoom config profiles
|
|
102
105
|
|
|
103
106
|
# 특정 프로필로 사용
|
|
104
|
-
kiwoom -p
|
|
107
|
+
kiwoom -p isa account balance
|
|
105
108
|
kiwoom -p isa auth login
|
|
106
109
|
```
|
|
107
110
|
|
|
@@ -58,16 +58,19 @@ appkey/secretkey는 보안을 위해 환경변수를 지원하지 않습니다.
|
|
|
58
58
|
```bash
|
|
59
59
|
# 프로필별 설정
|
|
60
60
|
kiwoom config setup --profile default # 메인계좌
|
|
61
|
-
kiwoom config setup --profile isa
|
|
61
|
+
kiwoom config setup --profile isa # ISA계좌
|
|
62
62
|
|
|
63
|
-
#
|
|
64
|
-
kiwoom config
|
|
63
|
+
# 프로필 설정 변경
|
|
64
|
+
kiwoom config set domain prod # 도메인 변경
|
|
65
|
+
kiwoom config set account 1234567 # 계좌번호 설정
|
|
66
|
+
kiwoom -p isa config set domain mock # 특정 프로필
|
|
65
67
|
|
|
66
|
-
# 프로필 목록
|
|
68
|
+
# 프로필 전환 / 목록
|
|
69
|
+
kiwoom config use isa
|
|
67
70
|
kiwoom config profiles
|
|
68
71
|
|
|
69
72
|
# 특정 프로필로 사용
|
|
70
|
-
kiwoom -p
|
|
73
|
+
kiwoom -p isa account balance
|
|
71
74
|
kiwoom -p isa auth login
|
|
72
75
|
```
|
|
73
76
|
|
|
@@ -31,13 +31,21 @@ def _build_account_panel(data: dict[str, Any]) -> Panel:
|
|
|
31
31
|
t.add_row("유가잔고평가액", _fmt_number(data.get("tot_est_amt", "")))
|
|
32
32
|
t.add_row("예탁자산평가액", _fmt_number(data.get("aset_evlt_amt", "")))
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
# 평가손익 = 유가잔고평가액 - 총매입금액
|
|
35
|
+
try:
|
|
36
|
+
evlt = int(data.get("tot_est_amt", "0").lstrip("0") or "0")
|
|
37
|
+
pur = int(data.get("tot_pur_amt", "0").lstrip("0") or "0")
|
|
38
|
+
eval_pl = evlt - pur
|
|
39
|
+
eval_pl_rt = (eval_pl / pur * 100) if pur else 0
|
|
40
|
+
eval_pl_str = f"+{eval_pl:,}" if eval_pl > 0 else f"{eval_pl:,}"
|
|
41
|
+
eval_pl_rt_str = f"{eval_pl_rt:+.2f}"
|
|
42
|
+
except (ValueError, ZeroDivisionError):
|
|
43
|
+
eval_pl_str = "-"
|
|
44
|
+
eval_pl_rt_str = "0.00"
|
|
45
|
+
eval_pl = 0
|
|
46
|
+
eval_color = "red" if eval_pl > 0 else ("blue" if eval_pl < 0 else "white")
|
|
47
|
+
t.add_row("평가손익", Text(eval_pl_str, style=eval_color))
|
|
48
|
+
t.add_row("평가손익율", Text(eval_pl_rt_str + "%", style=eval_color))
|
|
41
49
|
|
|
42
50
|
return Panel(t, title="계좌 요약", border_style="green")
|
|
43
51
|
|
|
@@ -240,11 +240,24 @@ def print_account_eval(data: dict[str, Any]) -> None:
|
|
|
240
240
|
summary.add_row("예탁자산평가액", _fmt_number(data.get("aset_evlt_amt", "")))
|
|
241
241
|
summary.add_row("추정예탁자산", _fmt_number(data.get("prsm_dpst_aset_amt", "")))
|
|
242
242
|
|
|
243
|
+
# 평가손익 = 유가잔고평가액 - 총매입금액
|
|
244
|
+
try:
|
|
245
|
+
evlt = int(data.get("tot_est_amt", "0").lstrip("0") or "0")
|
|
246
|
+
pur = int(data.get("tot_pur_amt", "0").lstrip("0") or "0")
|
|
247
|
+
eval_pl = evlt - pur
|
|
248
|
+
eval_pl_rt = (eval_pl / pur * 100) if pur else 0
|
|
249
|
+
eval_pl_str = f"+{eval_pl:,}" if eval_pl > 0 else f"{eval_pl:,}"
|
|
250
|
+
eval_pl_rt_str = f"{eval_pl_rt:+.2f}"
|
|
251
|
+
except (ValueError, ZeroDivisionError):
|
|
252
|
+
eval_pl_str = "-"
|
|
253
|
+
eval_pl_rt_str = "0.00"
|
|
254
|
+
eval_pl = 0
|
|
255
|
+
eval_color = "red" if eval_pl > 0 else ("blue" if eval_pl < 0 else "white")
|
|
256
|
+
summary.add_row("평가손익", Text(eval_pl_str, style=eval_color))
|
|
257
|
+
summary.add_row("평가손익율", Text(eval_pl_rt_str + "%", style=eval_color))
|
|
243
258
|
pl_color = _sign_color(data.get("tdy_lspft", "0"))
|
|
244
|
-
summary.add_row("
|
|
245
|
-
summary.add_row("
|
|
246
|
-
summary.add_row("누적손익", Text(_fmt_number(data.get("lspft", "")), style=_sign_color(data.get("lspft", "0"))))
|
|
247
|
-
summary.add_row("누적손익율", data.get("lspft_rt", "0") + "%")
|
|
259
|
+
summary.add_row("당일실현손익", Text(_fmt_number(data.get("tdy_lspft", "")), style=pl_color))
|
|
260
|
+
summary.add_row("당일실현손익율", Text(data.get("tdy_lspft_rt", "0") + "%", style=pl_color))
|
|
248
261
|
console.print(summary)
|
|
249
262
|
|
|
250
263
|
holdings = data.get("stk_acnt_evlt_prst", [])
|
|
@@ -410,16 +423,25 @@ _FIELD_LABELS: dict[str, str] = {
|
|
|
410
423
|
"acnt_nm": "계좌명", "rmnd_qty": "보유수량", "avg_prc": "평균단가",
|
|
411
424
|
"evlt_amt": "평가금액", "pl_amt": "손익금액", "pl_rt": "손익율",
|
|
412
425
|
"evltv_prft": "평가손익", "prft_rt": "수익률", "tot_prft_rt": "수익률",
|
|
413
|
-
"dt_prft_rt": "기간수익률",
|
|
426
|
+
"tot_evlt_pl": "총평가손익", "dt_prft_rt": "기간수익률",
|
|
414
427
|
"entr": "예수금", "d2_entra": "D+2추정예수금",
|
|
415
428
|
"tot_pur_amt": "총매입금액", "tot_est_amt": "유가잔고평가액",
|
|
416
429
|
"prsm_dpst_aset_amt": "추정예탁자산", "tot_evlt_amt": "총평가금액",
|
|
417
430
|
"pur_amt": "매입금액", "pur_pric": "매입가", "buy_uv": "매입단가",
|
|
431
|
+
"pur_cmsn": "매입수수료", "sell_cmsn": "매도수수료", "sum_cmsn": "총수수료",
|
|
418
432
|
"repl_amt": "대용금", "pymn_alow_amt": "출금가능금액",
|
|
419
433
|
"rmnd": "잔고주수", "remn_amt": "잔고금액", "setl_remn": "결제잔고",
|
|
434
|
+
"trde_able_qty": "매매가능수량", "poss_rt": "보유비중",
|
|
420
435
|
"cmsn": "수수료", "tax": "세금",
|
|
421
436
|
"tdy_trde_cmsn": "당일매매수수료", "tdy_trde_tax": "당일매매세금",
|
|
422
437
|
"tdy_sel_pl": "당일매도손익", "profa_ch": "증거금현금",
|
|
438
|
+
"tot_loan_amt": "총대출금액", "tot_crd_loan_amt": "총신용대출금액",
|
|
439
|
+
"tot_crd_ls_amt": "총신용이자금액",
|
|
440
|
+
"crd_tp_nm": "신용구분명", "crd_loan_dt": "신용대출일",
|
|
441
|
+
"pred_buyq": "전일매수수량", "pred_sellq": "전일매도수량",
|
|
442
|
+
"tdy_buyq": "당일매수수량", "tdy_sellq": "당일매도수량",
|
|
443
|
+
"aset_evlt_amt": "예탁자산평가액", "acnt_evlt_remn_indv_tot": "계좌평가잔고상세",
|
|
444
|
+
"stk_acnt_evlt_prst": "보유종목",
|
|
423
445
|
# 매수/매도
|
|
424
446
|
"buy_qty": "매수수량", "sell_qty": "매도수량",
|
|
425
447
|
"buy_amt": "매수금액", "sell_amt": "매도금액",
|
|
@@ -543,7 +565,8 @@ def print_generic_table(data: dict[str, Any] | list, title: str = "결과") -> N
|
|
|
543
565
|
console.print(t)
|
|
544
566
|
|
|
545
567
|
for list_key, list_val in lists.items():
|
|
546
|
-
|
|
568
|
+
list_title = _FIELD_LABELS.get(list_key, list_key)
|
|
569
|
+
print_generic_table(list_val, title=list_title)
|
|
547
570
|
|
|
548
571
|
|
|
549
572
|
def print_deposit(data: dict[str, Any]) -> None:
|
|
@@ -150,16 +150,30 @@ def config_show(ctx):
|
|
|
150
150
|
console.print(f" 보안: [bold]{'SecureStore 활성' if initialized else '미초기화'}[/]")
|
|
151
151
|
|
|
152
152
|
|
|
153
|
-
@config_cmd.command("
|
|
154
|
-
@click.argument("
|
|
153
|
+
@config_cmd.command("set")
|
|
154
|
+
@click.argument("key", type=click.Choice(["domain", "account"]))
|
|
155
|
+
@click.argument("value")
|
|
155
156
|
@click.pass_context
|
|
156
|
-
def
|
|
157
|
-
"""
|
|
157
|
+
def config_set(ctx, key: str, value: str):
|
|
158
|
+
"""프로필 설정 변경. (예: kiwoom config set domain prod)"""
|
|
158
159
|
profile = config.resolve_profile(ctx.obj.get("profile") if ctx.obj else None)
|
|
160
|
+
if key == "domain" and value not in ("prod", "mock"):
|
|
161
|
+
console.print("[red]domain은 prod 또는 mock만 가능합니다.[/]")
|
|
162
|
+
raise SystemExit(1)
|
|
159
163
|
cfg = config.load_config()
|
|
160
|
-
cfg.setdefault("profiles", {}).setdefault(profile, {})[
|
|
164
|
+
cfg.setdefault("profiles", {}).setdefault(profile, {})[key] = value
|
|
161
165
|
config.save_config(cfg)
|
|
162
|
-
|
|
166
|
+
display = config.DOMAINS[value] if key == "domain" else value
|
|
167
|
+
console.print(f"[green]{key} 변경:[/] {display} (프로필: {profile})")
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
# Backward compatibility: keep 'domain' as alias
|
|
171
|
+
@config_cmd.command("domain", hidden=True)
|
|
172
|
+
@click.argument("domain", type=click.Choice(["prod", "mock"]))
|
|
173
|
+
@click.pass_context
|
|
174
|
+
def config_domain(ctx, domain: str):
|
|
175
|
+
"""도메인 변경 (config set domain의 별칭)."""
|
|
176
|
+
ctx.invoke(config_set, key="domain", value=domain)
|
|
163
177
|
|
|
164
178
|
|
|
165
179
|
@config_cmd.command("use")
|
|
@@ -183,11 +197,14 @@ def config_profiles():
|
|
|
183
197
|
if not profiles:
|
|
184
198
|
console.print("[yellow]등록된 프로필이 없습니다.[/]")
|
|
185
199
|
return
|
|
200
|
+
console.print(f" 현재 프로필: [bold green]{default}[/]")
|
|
201
|
+
console.print()
|
|
186
202
|
for name, settings in profiles.items():
|
|
187
|
-
marker = " [green]
|
|
203
|
+
marker = " [green]*[/]" if name == default else " "
|
|
188
204
|
domain = settings.get("domain", "mock")
|
|
189
|
-
account = settings.get("account", "
|
|
190
|
-
|
|
205
|
+
account = settings.get("account", "")
|
|
206
|
+
account_str = f" 계좌={account}" if account else ""
|
|
207
|
+
console.print(f" {marker} {name:15s} 도메인={domain}{account_str}")
|
|
191
208
|
|
|
192
209
|
|
|
193
210
|
# ── Auth ──────────────────────────────────────────────
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kiwoom-cli
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.3
|
|
4
4
|
Summary: User-friendly CLI for the Kiwoom Securities REST API (키움증권)
|
|
5
5
|
License: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/gejyn14/kiwoom-cli
|
|
@@ -92,16 +92,19 @@ appkey/secretkey는 보안을 위해 환경변수를 지원하지 않습니다.
|
|
|
92
92
|
```bash
|
|
93
93
|
# 프로필별 설정
|
|
94
94
|
kiwoom config setup --profile default # 메인계좌
|
|
95
|
-
kiwoom config setup --profile isa
|
|
95
|
+
kiwoom config setup --profile isa # ISA계좌
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
kiwoom config
|
|
97
|
+
# 프로필 설정 변경
|
|
98
|
+
kiwoom config set domain prod # 도메인 변경
|
|
99
|
+
kiwoom config set account 1234567 # 계좌번호 설정
|
|
100
|
+
kiwoom -p isa config set domain mock # 특정 프로필
|
|
99
101
|
|
|
100
|
-
# 프로필 목록
|
|
102
|
+
# 프로필 전환 / 목록
|
|
103
|
+
kiwoom config use isa
|
|
101
104
|
kiwoom config profiles
|
|
102
105
|
|
|
103
106
|
# 특정 프로필로 사용
|
|
104
|
-
kiwoom -p
|
|
107
|
+
kiwoom -p isa account balance
|
|
105
108
|
kiwoom -p isa auth login
|
|
106
109
|
```
|
|
107
110
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|