kiwoom-cli 0.6.3__tar.gz → 1.0.0__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.
Files changed (34) hide show
  1. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/PKG-INFO +3 -4
  2. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/README.md +0 -2
  3. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/__init__.py +1 -1
  4. kiwoom_cli-1.0.0/kiwoom_cli/commands/_constants.py +9 -0
  5. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/commands/account.py +1 -8
  6. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/commands/dashboard.py +2 -12
  7. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/commands/market.py +171 -202
  8. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/commands/order.py +76 -37
  9. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/commands/stock.py +30 -64
  10. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/formatters.py +40 -15
  11. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/secure_store.py +9 -25
  12. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli.egg-info/PKG-INFO +3 -4
  13. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli.egg-info/SOURCES.txt +3 -1
  14. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli.egg-info/requires.txt +1 -0
  15. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/pyproject.toml +6 -2
  16. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/tests/test_cli.py +38 -1
  17. kiwoom_cli-1.0.0/tests/test_secure_store.py +54 -0
  18. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/LICENSE +0 -0
  19. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/api_spec.py +0 -0
  20. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/auth.py +0 -0
  21. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/client.py +0 -0
  22. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/commands/__init__.py +0 -0
  23. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/commands/stream.py +0 -0
  24. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/commands/watch.py +0 -0
  25. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/config.py +0 -0
  26. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/main.py +0 -0
  27. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/output.py +0 -0
  28. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli/streaming.py +0 -0
  29. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli.egg-info/dependency_links.txt +0 -0
  30. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli.egg-info/entry_points.txt +0 -0
  31. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/kiwoom_cli.egg-info/top_level.txt +0 -0
  32. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/setup.cfg +0 -0
  33. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/tests/test_client.py +0 -0
  34. {kiwoom_cli-0.6.3 → kiwoom_cli-1.0.0}/tests/test_formatters.py +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kiwoom-cli
3
- Version: 0.6.3
3
+ Version: 1.0.0
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
7
7
  Project-URL: Repository, https://github.com/gejyn14/kiwoom-cli
8
8
  Project-URL: Issues, https://github.com/gejyn14/kiwoom-cli/issues
9
9
  Keywords: kiwoom,stock,trading,cli,korea,finance
10
- Classifier: Development Status :: 4 - Beta
10
+ Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Environment :: Console
12
12
  Classifier: Intended Audience :: Financial and Insurance Industry
13
13
  Classifier: License :: OSI Approved :: MIT License
@@ -26,6 +26,7 @@ Requires-Dist: tomli>=2.0; python_version < "3.11"
26
26
  Requires-Dist: tomli-w>=1.0
27
27
  Requires-Dist: keyring>=25.0
28
28
  Requires-Dist: websockets>=12.0
29
+ Requires-Dist: cryptography>=42.0
29
30
  Provides-Extra: dev
30
31
  Requires-Dist: pytest>=8.0; extra == "dev"
31
32
  Requires-Dist: pytest-httpx>=0.30; extra == "dev"
@@ -444,8 +445,6 @@ eval (env _KIWOOM_COMPLETE=fish_source kiwoom)
444
445
 
445
446
  | 항목 | 값 |
446
447
  | ---------------- | ---------------------------------------- |
447
- | 항목 | 값 |
448
- | --------------- | ---------------------------- |
449
448
  | 설정 파일 | `~/.kiwoom/config.toml` (도메인, 계좌만) |
450
449
  | appkey/secretkey | OS 키체인 (암호화 저장) |
451
450
  | 토큰 | OS 키체인 |
@@ -410,8 +410,6 @@ eval (env _KIWOOM_COMPLETE=fish_source kiwoom)
410
410
 
411
411
  | 항목 | 값 |
412
412
  | ---------------- | ---------------------------------------- |
413
- | 항목 | 값 |
414
- | --------------- | ---------------------------- |
415
413
  | 설정 파일 | `~/.kiwoom/config.toml` (도메인, 계좌만) |
416
414
  | appkey/secretkey | OS 키체인 (암호화 저장) |
417
415
  | 토큰 | OS 키체인 |
@@ -1,3 +1,3 @@
1
1
  """Kiwoom Securities REST API CLI."""
2
2
 
3
- __version__ = "0.6.3"
3
+ __version__ = "1.0.0"
@@ -0,0 +1,9 @@
1
+ """Shared lookup maps for CLI option value -> API value conversion."""
2
+
3
+ MARKET_ALL = {"all": "000", "kospi": "001", "kosdaq": "101"}
4
+ MARKET_TWO = {"kospi": "001", "kosdaq": "101"}
5
+ MARKET_KOSPI_KOSDAQ = {"kospi": "0", "kosdaq": "1"}
6
+ MARKET_PROGRAM = {"kospi": "P00101", "kosdaq": "P10102"}
7
+ MARKET_SEARCH = {"kospi": "0", "kosdaq": "10", "k-otc": "30", "konex": "50", "etf": "8", "elw": "3"}
8
+ EXCHANGE_TWO = {"KRX": "1", "NXT": "2"}
9
+ EXCHANGE_ALL = {"KRX": "1", "NXT": "2", "all": "3"}
@@ -8,6 +8,7 @@ import click
8
8
 
9
9
  from ..client import KiwoomClient
10
10
  from ..formatters import (
11
+ _find_list,
11
12
  print_account_eval,
12
13
  print_deposit,
13
14
  print_generic_table,
@@ -20,14 +21,6 @@ def _today() -> str:
20
21
  return datetime.now().strftime("%Y%m%d")
21
22
 
22
23
 
23
- def _find_list(data: dict) -> list | None:
24
- """Find the first list value in API response."""
25
- for k, v in data.items():
26
- if isinstance(v, list) and k not in ("return_code", "return_msg"):
27
- return v
28
- return None
29
-
30
-
31
24
  @click.group("account")
32
25
  def account():
33
26
  """계좌 정보 조회."""
@@ -11,6 +11,7 @@ from rich.text import Text
11
11
 
12
12
  from ..client import KiwoomClient, KiwoomAPIError
13
13
  from ..formatters import (
14
+ _calc_eval_pl,
14
15
  _fmt_number,
15
16
  _get_format,
16
17
  _sign_color,
@@ -32,18 +33,7 @@ def _build_account_panel(data: dict[str, Any]) -> Panel:
32
33
  t.add_row("예탁자산평가액", _fmt_number(data.get("aset_evlt_amt", "")))
33
34
 
34
35
  # 평가손익 = 유가잔고평가액 - 총매입금액
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")
36
+ _, eval_pl_str, eval_pl_rt_str, eval_color = _calc_eval_pl(data)
47
37
  t.add_row("평가손익", Text(eval_pl_str, style=eval_color))
48
38
  t.add_row("평가손익율", Text(eval_pl_rt_str + "%", style=eval_color))
49
39