kis-trader 0.1.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 (378) hide show
  1. kis_trader-0.1.0/.agents/plugins/marketplace.json +14 -0
  2. kis_trader-0.1.0/.claude-plugin/marketplace.json +18 -0
  3. kis_trader-0.1.0/.github/workflows/check.yml +24 -0
  4. kis_trader-0.1.0/.github/workflows/publish.yml +71 -0
  5. kis_trader-0.1.0/.github/workflows/reusable-check.yml +108 -0
  6. kis_trader-0.1.0/.gitignore +36 -0
  7. kis_trader-0.1.0/CHANGELOG.md +19 -0
  8. kis_trader-0.1.0/LICENSE +21 -0
  9. kis_trader-0.1.0/Makefile +13 -0
  10. kis_trader-0.1.0/PKG-INFO +160 -0
  11. kis_trader-0.1.0/README.en.md +135 -0
  12. kis_trader-0.1.0/README.md +136 -0
  13. kis_trader-0.1.0/docs/.gitignore +1 -0
  14. kis_trader-0.1.0/docs/_head.html +49 -0
  15. kis_trader-0.1.0/docs/_quarto.yml +75 -0
  16. kis_trader-0.1.0/docs/account.md +161 -0
  17. kis_trader-0.1.0/docs/appkey.md +66 -0
  18. kis_trader-0.1.0/docs/bonds.md +49 -0
  19. kis_trader-0.1.0/docs/claude-skill.md +52 -0
  20. kis_trader-0.1.0/docs/claude.xml +24 -0
  21. kis_trader-0.1.0/docs/cli.md +244 -0
  22. kis_trader-0.1.0/docs/codex-skill.md +39 -0
  23. kis_trader-0.1.0/docs/configuration.md +247 -0
  24. kis_trader-0.1.0/docs/corporate-actions.md +26 -0
  25. kis_trader-0.1.0/docs/custom.scss +171 -0
  26. kis_trader-0.1.0/docs/derivatives.md +114 -0
  27. kis_trader-0.1.0/docs/elw.md +38 -0
  28. kis_trader-0.1.0/docs/etf.md +19 -0
  29. kis_trader-0.1.0/docs/favicon.svg +15 -0
  30. kis_trader-0.1.0/docs/financials.md +26 -0
  31. kis_trader-0.1.0/docs/flows.md +35 -0
  32. kis_trader-0.1.0/docs/img/kis-appkey-1-portal.png +0 -0
  33. kis_trader-0.1.0/docs/img/kis-appkey-2-phone-auth.png +0 -0
  34. kis_trader-0.1.0/docs/img/kis-appkey-3-info.png +0 -0
  35. kis_trader-0.1.0/docs/img/kis-appkey-4-notes.png +0 -0
  36. kis_trader-0.1.0/docs/img/kis-appkey-5-account.png +0 -0
  37. kis_trader-0.1.0/docs/img/kis-appkey-6-group.png +0 -0
  38. kis_trader-0.1.0/docs/img/kis-appkey-7-keys.png +0 -0
  39. kis_trader-0.1.0/docs/index.md +52 -0
  40. kis_trader-0.1.0/docs/limits.md +25 -0
  41. kis_trader-0.1.0/docs/market.md +78 -0
  42. kis_trader-0.1.0/docs/mcp.md +287 -0
  43. kis_trader-0.1.0/docs/orders.md +339 -0
  44. kis_trader-0.1.0/docs/overseas.md +178 -0
  45. kis_trader-0.1.0/docs/pension.md +22 -0
  46. kis_trader-0.1.0/docs/quickstart.md +76 -0
  47. kis_trader-0.1.0/docs/quotes.md +104 -0
  48. kis_trader-0.1.0/docs/realtime.md +144 -0
  49. kis_trader-0.1.0/docs/screening.md +102 -0
  50. kis_trader-0.1.0/docs/taxonomy.md +405 -0
  51. kis_trader-0.1.0/plugins/kis-trader/.claude-plugin/plugin.json +11 -0
  52. kis_trader-0.1.0/plugins/kis-trader/.codex-plugin/plugin.json +16 -0
  53. kis_trader-0.1.0/plugins/kis-trader/skills/kis-trader/SKILL.md +189 -0
  54. kis_trader-0.1.0/pyproject.toml +63 -0
  55. kis_trader-0.1.0/src/kis_trader/__init__.py +596 -0
  56. kis_trader-0.1.0/src/kis_trader/_bars.py +131 -0
  57. kis_trader-0.1.0/src/kis_trader/_depth.py +35 -0
  58. kis_trader-0.1.0/src/kis_trader/_internal/__init__.py +7 -0
  59. kis_trader-0.1.0/src/kis_trader/_internal/_auth.py +201 -0
  60. kis_trader-0.1.0/src/kis_trader/_internal/_datetime.py +117 -0
  61. kis_trader-0.1.0/src/kis_trader/_internal/_endpoints.py +28 -0
  62. kis_trader-0.1.0/src/kis_trader/_internal/_freeze.py +39 -0
  63. kis_trader-0.1.0/src/kis_trader/_internal/_fsutil.py +87 -0
  64. kis_trader-0.1.0/src/kis_trader/_internal/_http.py +219 -0
  65. kis_trader-0.1.0/src/kis_trader/_internal/_masters.py +410 -0
  66. kis_trader-0.1.0/src/kis_trader/_internal/_ratelimit.py +115 -0
  67. kis_trader-0.1.0/src/kis_trader/_internal/_response.py +150 -0
  68. kis_trader-0.1.0/src/kis_trader/_internal/_wire.py +141 -0
  69. kis_trader-0.1.0/src/kis_trader/_literals.py +86 -0
  70. kis_trader-0.1.0/src/kis_trader/_order_engine.py +395 -0
  71. kis_trader-0.1.0/src/kis_trader/_stock_base.py +97 -0
  72. kis_trader-0.1.0/src/kis_trader/account.py +91 -0
  73. kis_trader-0.1.0/src/kis_trader/bar.py +43 -0
  74. kis_trader-0.1.0/src/kis_trader/cli/__init__.py +9 -0
  75. kis_trader-0.1.0/src/kis_trader/cli/__main__.py +7 -0
  76. kis_trader-0.1.0/src/kis_trader/cli/app.py +326 -0
  77. kis_trader-0.1.0/src/kis_trader/cli/commands/__init__.py +1 -0
  78. kis_trader-0.1.0/src/kis_trader/cli/commands/account.py +321 -0
  79. kis_trader-0.1.0/src/kis_trader/cli/commands/market.py +29 -0
  80. kis_trader-0.1.0/src/kis_trader/cli/commands/order.py +468 -0
  81. kis_trader-0.1.0/src/kis_trader/cli/commands/stock.py +52 -0
  82. kis_trader-0.1.0/src/kis_trader/cli/context.py +68 -0
  83. kis_trader-0.1.0/src/kis_trader/cli/errors.py +96 -0
  84. kis_trader-0.1.0/src/kis_trader/cli/output.py +231 -0
  85. kis_trader-0.1.0/src/kis_trader/client.py +499 -0
  86. kis_trader-0.1.0/src/kis_trader/config.py +483 -0
  87. kis_trader-0.1.0/src/kis_trader/domestic/__init__.py +0 -0
  88. kis_trader-0.1.0/src/kis_trader/domestic/_engine/__init__.py +6 -0
  89. kis_trader-0.1.0/src/kis_trader/domestic/_engine/_parse.py +21 -0
  90. kis_trader-0.1.0/src/kis_trader/domestic/_engine/account.py +947 -0
  91. kis_trader-0.1.0/src/kis_trader/domestic/_engine/analysis.py +581 -0
  92. kis_trader-0.1.0/src/kis_trader/domestic/_engine/bond_orders.py +164 -0
  93. kis_trader-0.1.0/src/kis_trader/domestic/_engine/bonds.py +814 -0
  94. kis_trader-0.1.0/src/kis_trader/domestic/_engine/derivative_account.py +865 -0
  95. kis_trader-0.1.0/src/kis_trader/domestic/_engine/derivative_orders.py +771 -0
  96. kis_trader-0.1.0/src/kis_trader/domestic/_engine/derivatives.py +646 -0
  97. kis_trader-0.1.0/src/kis_trader/domestic/_engine/elw.py +797 -0
  98. kis_trader-0.1.0/src/kis_trader/domestic/_engine/etf.py +426 -0
  99. kis_trader-0.1.0/src/kis_trader/domestic/_engine/finance.py +242 -0
  100. kis_trader-0.1.0/src/kis_trader/domestic/_engine/index.py +638 -0
  101. kis_trader-0.1.0/src/kis_trader/domestic/_engine/ksd.py +525 -0
  102. kis_trader-0.1.0/src/kis_trader/domestic/_engine/market_analysis.py +961 -0
  103. kis_trader-0.1.0/src/kis_trader/domestic/_engine/market_data.py +1271 -0
  104. kis_trader-0.1.0/src/kis_trader/domestic/_engine/orders.py +779 -0
  105. kis_trader-0.1.0/src/kis_trader/domestic/_engine/product.py +64 -0
  106. kis_trader-0.1.0/src/kis_trader/domestic/_engine/ranking.py +1043 -0
  107. kis_trader-0.1.0/src/kis_trader/domestic/_engine/reserved_orders.py +536 -0
  108. kis_trader-0.1.0/src/kis_trader/domestic/_engine/saved_screen.py +179 -0
  109. kis_trader-0.1.0/src/kis_trader/domestic/bond.py +146 -0
  110. kis_trader-0.1.0/src/kis_trader/domestic/bond_account.py +86 -0
  111. kis_trader-0.1.0/src/kis_trader/domestic/calendar.py +145 -0
  112. kis_trader-0.1.0/src/kis_trader/domestic/derivative.py +223 -0
  113. kis_trader-0.1.0/src/kis_trader/domestic/derivative_account.py +171 -0
  114. kis_trader-0.1.0/src/kis_trader/domestic/elw.py +83 -0
  115. kis_trader-0.1.0/src/kis_trader/domestic/elw_ranking.py +114 -0
  116. kis_trader-0.1.0/src/kis_trader/domestic/elw_screener.py +88 -0
  117. kis_trader-0.1.0/src/kis_trader/domestic/entities/__init__.py +0 -0
  118. kis_trader-0.1.0/src/kis_trader/domestic/entities/account_reports.py +113 -0
  119. kis_trader-0.1.0/src/kis_trader/domestic/entities/account_right.py +57 -0
  120. kis_trader-0.1.0/src/kis_trader/domestic/entities/after_hours.py +95 -0
  121. kis_trader-0.1.0/src/kis_trader/domestic/entities/analysis.py +381 -0
  122. kis_trader-0.1.0/src/kis_trader/domestic/entities/balance.py +111 -0
  123. kis_trader-0.1.0/src/kis_trader/domestic/entities/bond.py +167 -0
  124. kis_trader-0.1.0/src/kis_trader/domestic/entities/bond_account.py +156 -0
  125. kis_trader-0.1.0/src/kis_trader/domestic/entities/broker.py +99 -0
  126. kis_trader-0.1.0/src/kis_trader/domestic/entities/calendar.py +297 -0
  127. kis_trader-0.1.0/src/kis_trader/domestic/entities/derivative.py +239 -0
  128. kis_trader-0.1.0/src/kis_trader/domestic/entities/derivative_account.py +476 -0
  129. kis_trader-0.1.0/src/kis_trader/domestic/entities/elw.py +250 -0
  130. kis_trader-0.1.0/src/kis_trader/domestic/entities/etf.py +224 -0
  131. kis_trader-0.1.0/src/kis_trader/domestic/entities/financials.py +177 -0
  132. kis_trader-0.1.0/src/kis_trader/domestic/entities/index.py +210 -0
  133. kis_trader-0.1.0/src/kis_trader/domestic/entities/investor.py +125 -0
  134. kis_trader-0.1.0/src/kis_trader/domestic/entities/market.py +411 -0
  135. kis_trader-0.1.0/src/kis_trader/domestic/entities/product.py +43 -0
  136. kis_trader-0.1.0/src/kis_trader/domestic/entities/program.py +83 -0
  137. kis_trader-0.1.0/src/kis_trader/domestic/entities/ranking.py +231 -0
  138. kis_trader-0.1.0/src/kis_trader/domestic/entities/saved_screen.py +121 -0
  139. kis_trader-0.1.0/src/kis_trader/domestic/entities/stock_fills.py +77 -0
  140. kis_trader-0.1.0/src/kis_trader/domestic/entities/stock_info.py +95 -0
  141. kis_trader-0.1.0/src/kis_trader/domestic/entities/trade_profit.py +120 -0
  142. kis_trader-0.1.0/src/kis_trader/domestic/index.py +148 -0
  143. kis_trader-0.1.0/src/kis_trader/domestic/market.py +186 -0
  144. kis_trader-0.1.0/src/kis_trader/domestic/namespace.py +369 -0
  145. kis_trader-0.1.0/src/kis_trader/domestic/ranking.py +284 -0
  146. kis_trader-0.1.0/src/kis_trader/domestic/stock.py +601 -0
  147. kis_trader-0.1.0/src/kis_trader/errors.py +123 -0
  148. kis_trader-0.1.0/src/kis_trader/execution/__init__.py +23 -0
  149. kis_trader-0.1.0/src/kis_trader/execution/runner.py +157 -0
  150. kis_trader-0.1.0/src/kis_trader/execution/schedule.py +118 -0
  151. kis_trader-0.1.0/src/kis_trader/instrument.py +55 -0
  152. kis_trader-0.1.0/src/kis_trader/integrated.py +104 -0
  153. kis_trader-0.1.0/src/kis_trader/mcp/__init__.py +21 -0
  154. kis_trader-0.1.0/src/kis_trader/mcp/_elicit.py +48 -0
  155. kis_trader-0.1.0/src/kis_trader/mcp/_guardrails.py +156 -0
  156. kis_trader-0.1.0/src/kis_trader/mcp/_http_auth.py +51 -0
  157. kis_trader-0.1.0/src/kis_trader/mcp/handlers.py +192 -0
  158. kis_trader-0.1.0/src/kis_trader/mcp/server.py +372 -0
  159. kis_trader-0.1.0/src/kis_trader/money.py +21 -0
  160. kis_trader-0.1.0/src/kis_trader/news.py +40 -0
  161. kis_trader-0.1.0/src/kis_trader/open_order.py +52 -0
  162. kis_trader-0.1.0/src/kis_trader/open_orders.py +35 -0
  163. kis_trader-0.1.0/src/kis_trader/order.py +888 -0
  164. kis_trader-0.1.0/src/kis_trader/order_book.py +49 -0
  165. kis_trader-0.1.0/src/kis_trader/orderable.py +59 -0
  166. kis_trader-0.1.0/src/kis_trader/overseas/__init__.py +0 -0
  167. kis_trader-0.1.0/src/kis_trader/overseas/_engine/__init__.py +5 -0
  168. kis_trader-0.1.0/src/kis_trader/overseas/_engine/_parse.py +61 -0
  169. kis_trader-0.1.0/src/kis_trader/overseas/_engine/account.py +569 -0
  170. kis_trader-0.1.0/src/kis_trader/overseas/_engine/derivative_account.py +686 -0
  171. kis_trader-0.1.0/src/kis_trader/overseas/_engine/derivative_orders.py +179 -0
  172. kis_trader-0.1.0/src/kis_trader/overseas/_engine/derivatives.py +623 -0
  173. kis_trader-0.1.0/src/kis_trader/overseas/_engine/index.py +174 -0
  174. kis_trader-0.1.0/src/kis_trader/overseas/_engine/market_data.py +675 -0
  175. kis_trader-0.1.0/src/kis_trader/overseas/_engine/orders.py +635 -0
  176. kis_trader-0.1.0/src/kis_trader/overseas/_engine/ranking.py +186 -0
  177. kis_trader-0.1.0/src/kis_trader/overseas/_engine/reference.py +346 -0
  178. kis_trader-0.1.0/src/kis_trader/overseas/_engine/reserved_orders.py +702 -0
  179. kis_trader-0.1.0/src/kis_trader/overseas/derivative.py +136 -0
  180. kis_trader-0.1.0/src/kis_trader/overseas/derivative_account.py +187 -0
  181. kis_trader-0.1.0/src/kis_trader/overseas/entities/__init__.py +0 -0
  182. kis_trader-0.1.0/src/kis_trader/overseas/entities/account.py +162 -0
  183. kis_trader-0.1.0/src/kis_trader/overseas/entities/balance.py +164 -0
  184. kis_trader-0.1.0/src/kis_trader/overseas/entities/collateral.py +72 -0
  185. kis_trader-0.1.0/src/kis_trader/overseas/entities/corporate_action.py +67 -0
  186. kis_trader-0.1.0/src/kis_trader/overseas/entities/derivative.py +155 -0
  187. kis_trader-0.1.0/src/kis_trader/overseas/entities/derivative_account.py +354 -0
  188. kis_trader-0.1.0/src/kis_trader/overseas/entities/industry.py +53 -0
  189. kis_trader-0.1.0/src/kis_trader/overseas/entities/news.py +36 -0
  190. kis_trader-0.1.0/src/kis_trader/overseas/entities/orders.py +114 -0
  191. kis_trader-0.1.0/src/kis_trader/overseas/entities/product.py +41 -0
  192. kis_trader-0.1.0/src/kis_trader/overseas/entities/quote.py +36 -0
  193. kis_trader-0.1.0/src/kis_trader/overseas/entities/ranking.py +44 -0
  194. kis_trader-0.1.0/src/kis_trader/overseas/entities/search.py +58 -0
  195. kis_trader-0.1.0/src/kis_trader/overseas/entities/settlement.py +34 -0
  196. kis_trader-0.1.0/src/kis_trader/overseas/index.py +53 -0
  197. kis_trader-0.1.0/src/kis_trader/overseas/namespace.py +439 -0
  198. kis_trader-0.1.0/src/kis_trader/overseas/ranking.py +80 -0
  199. kis_trader-0.1.0/src/kis_trader/overseas/stock.py +213 -0
  200. kis_trader-0.1.0/src/kis_trader/pension/__init__.py +0 -0
  201. kis_trader-0.1.0/src/kis_trader/pension/_engine.py +278 -0
  202. kis_trader-0.1.0/src/kis_trader/pension/account.py +74 -0
  203. kis_trader-0.1.0/src/kis_trader/pension/entities.py +140 -0
  204. kis_trader-0.1.0/src/kis_trader/py.typed +0 -0
  205. kis_trader-0.1.0/src/kis_trader/quote.py +49 -0
  206. kis_trader-0.1.0/src/kis_trader/realtime/__init__.py +74 -0
  207. kis_trader-0.1.0/src/kis_trader/realtime/_approval.py +45 -0
  208. kis_trader-0.1.0/src/kis_trader/realtime/_connection.py +293 -0
  209. kis_trader-0.1.0/src/kis_trader/realtime/_protocol.py +159 -0
  210. kis_trader-0.1.0/src/kis_trader/realtime/_registry.py +43 -0
  211. kis_trader-0.1.0/src/kis_trader/realtime/client.py +458 -0
  212. kis_trader-0.1.0/src/kis_trader/realtime/domestic_namespace.py +326 -0
  213. kis_trader-0.1.0/src/kis_trader/realtime/messages.py +47 -0
  214. kis_trader-0.1.0/src/kis_trader/realtime/overseas_namespace.py +166 -0
  215. kis_trader-0.1.0/src/kis_trader/realtime/parsers/__init__.py +12 -0
  216. kis_trader-0.1.0/src/kis_trader/realtime/parsers/bond.py +210 -0
  217. kis_trader-0.1.0/src/kis_trader/realtime/parsers/derivatives.py +600 -0
  218. kis_trader-0.1.0/src/kis_trader/realtime/parsers/domestic_stock.py +685 -0
  219. kis_trader-0.1.0/src/kis_trader/realtime/parsers/elw.py +351 -0
  220. kis_trader-0.1.0/src/kis_trader/realtime/parsers/index.py +209 -0
  221. kis_trader-0.1.0/src/kis_trader/realtime/parsers/overseas.py +554 -0
  222. kis_trader-0.1.0/src/kis_trader/realtime/subscription.py +120 -0
  223. kis_trader-0.1.0/src/kis_trader/report.py +93 -0
  224. kis_trader-0.1.0/src/kis_trader/reserved_order.py +52 -0
  225. kis_trader-0.1.0/src/kis_trader/risk.py +182 -0
  226. kis_trader-0.1.0/src/kis_trader/store.py +463 -0
  227. kis_trader-0.1.0/src/kis_trader/trade.py +41 -0
  228. kis_trader-0.1.0/src/kis_trader/transport.py +89 -0
  229. kis_trader-0.1.0/tests/test_account_facade.py +83 -0
  230. kis_trader-0.1.0/tests/test_auth_token.py +216 -0
  231. kis_trader-0.1.0/tests/test_bars.py +70 -0
  232. kis_trader-0.1.0/tests/test_bond_account.py +466 -0
  233. kis_trader-0.1.0/tests/test_bond_orders.py +487 -0
  234. kis_trader-0.1.0/tests/test_cli.py +2346 -0
  235. kis_trader-0.1.0/tests/test_client_account.py +373 -0
  236. kis_trader-0.1.0/tests/test_client_account_assets.py +114 -0
  237. kis_trader-0.1.0/tests/test_client_account_reports.py +184 -0
  238. kis_trader-0.1.0/tests/test_client_account_rights.py +141 -0
  239. kis_trader-0.1.0/tests/test_client_after_hours.py +194 -0
  240. kis_trader-0.1.0/tests/test_client_analyst_opinions.py +80 -0
  241. kis_trader-0.1.0/tests/test_client_bond_info.py +186 -0
  242. kis_trader-0.1.0/tests/test_client_bonds.py +357 -0
  243. kis_trader-0.1.0/tests/test_client_broker_activity.py +138 -0
  244. kis_trader-0.1.0/tests/test_client_calendar.py +458 -0
  245. kis_trader-0.1.0/tests/test_client_concurrency.py +56 -0
  246. kis_trader-0.1.0/tests/test_client_credit_buyable.py +129 -0
  247. kis_trader-0.1.0/tests/test_client_credit_orders.py +396 -0
  248. kis_trader-0.1.0/tests/test_client_credit_short.py +268 -0
  249. kis_trader-0.1.0/tests/test_client_daily_profits.py +132 -0
  250. kis_trader-0.1.0/tests/test_client_derivatives.py +440 -0
  251. kis_trader-0.1.0/tests/test_client_elw.py +408 -0
  252. kis_trader-0.1.0/tests/test_client_elw_ranking.py +144 -0
  253. kis_trader-0.1.0/tests/test_client_elw_screener.py +218 -0
  254. kis_trader-0.1.0/tests/test_client_etf.py +344 -0
  255. kis_trader-0.1.0/tests/test_client_financials.py +308 -0
  256. kis_trader-0.1.0/tests/test_client_foreign_broker.py +67 -0
  257. kis_trader-0.1.0/tests/test_client_index.py +612 -0
  258. kis_trader-0.1.0/tests/test_client_instrument.py +94 -0
  259. kis_trader-0.1.0/tests/test_client_investor_flows.py +183 -0
  260. kis_trader-0.1.0/tests/test_client_limit_stocks.py +83 -0
  261. kis_trader-0.1.0/tests/test_client_market.py +526 -0
  262. kis_trader-0.1.0/tests/test_client_minute_bars.py +204 -0
  263. kis_trader-0.1.0/tests/test_client_multi_quotes.py +151 -0
  264. kis_trader-0.1.0/tests/test_client_news.py +64 -0
  265. kis_trader-0.1.0/tests/test_client_open_orders.py +172 -0
  266. kis_trader-0.1.0/tests/test_client_option_board.py +111 -0
  267. kis_trader-0.1.0/tests/test_client_orders.py +1553 -0
  268. kis_trader-0.1.0/tests/test_client_overnight_orders.py +243 -0
  269. kis_trader-0.1.0/tests/test_client_overseas_algo.py +157 -0
  270. kis_trader-0.1.0/tests/test_client_overseas_algo_orders.py +276 -0
  271. kis_trader-0.1.0/tests/test_client_overseas_bars.py +153 -0
  272. kis_trader-0.1.0/tests/test_client_overseas_buyable.py +143 -0
  273. kis_trader-0.1.0/tests/test_client_overseas_collateral.py +66 -0
  274. kis_trader-0.1.0/tests/test_client_overseas_deriv_detail.py +144 -0
  275. kis_trader-0.1.0/tests/test_client_overseas_deriv_market_hours.py +137 -0
  276. kis_trader-0.1.0/tests/test_client_overseas_deriv_order_book.py +111 -0
  277. kis_trader-0.1.0/tests/test_client_overseas_derivatives.py +301 -0
  278. kis_trader-0.1.0/tests/test_client_overseas_foreign_margin.py +123 -0
  279. kis_trader-0.1.0/tests/test_client_overseas_index.py +178 -0
  280. kis_trader-0.1.0/tests/test_client_overseas_industries.py +176 -0
  281. kis_trader-0.1.0/tests/test_client_overseas_news.py +51 -0
  282. kis_trader-0.1.0/tests/test_client_overseas_order_book.py +90 -0
  283. kis_trader-0.1.0/tests/test_client_overseas_orders.py +366 -0
  284. kis_trader-0.1.0/tests/test_client_overseas_positions.py +247 -0
  285. kis_trader-0.1.0/tests/test_client_overseas_product.py +91 -0
  286. kis_trader-0.1.0/tests/test_client_overseas_quote.py +163 -0
  287. kis_trader-0.1.0/tests/test_client_overseas_ranking.py +167 -0
  288. kis_trader-0.1.0/tests/test_client_overseas_reports.py +214 -0
  289. kis_trader-0.1.0/tests/test_client_overseas_reserved.py +164 -0
  290. kis_trader-0.1.0/tests/test_client_overseas_reserved_cancel.py +122 -0
  291. kis_trader-0.1.0/tests/test_client_overseas_reserved_place.py +325 -0
  292. kis_trader-0.1.0/tests/test_client_overseas_rights.py +65 -0
  293. kis_trader-0.1.0/tests/test_client_overseas_search.py +99 -0
  294. kis_trader-0.1.0/tests/test_client_overseas_settlement_dates.py +109 -0
  295. kis_trader-0.1.0/tests/test_client_overseas_trades.py +77 -0
  296. kis_trader-0.1.0/tests/test_client_overseas_transactions.py +155 -0
  297. kis_trader-0.1.0/tests/test_client_pension_balance.py +256 -0
  298. kis_trader-0.1.0/tests/test_client_pension_cash.py +142 -0
  299. kis_trader-0.1.0/tests/test_client_product.py +68 -0
  300. kis_trader-0.1.0/tests/test_client_program_flow.py +69 -0
  301. kis_trader-0.1.0/tests/test_client_program_investor.py +132 -0
  302. kis_trader-0.1.0/tests/test_client_quote.py +541 -0
  303. kis_trader-0.1.0/tests/test_client_ranking.py +585 -0
  304. kis_trader-0.1.0/tests/test_client_ranking_overtime.py +239 -0
  305. kis_trader-0.1.0/tests/test_client_reserved_change.py +227 -0
  306. kis_trader-0.1.0/tests/test_client_reserved_orders.py +180 -0
  307. kis_trader-0.1.0/tests/test_client_reserved_place.py +395 -0
  308. kis_trader-0.1.0/tests/test_client_risk.py +381 -0
  309. kis_trader-0.1.0/tests/test_client_saved_screen.py +169 -0
  310. kis_trader-0.1.0/tests/test_client_stock_info.py +68 -0
  311. kis_trader-0.1.0/tests/test_client_trade_profits.py +158 -0
  312. kis_trader-0.1.0/tests/test_client_trades.py +94 -0
  313. kis_trader-0.1.0/tests/test_client_trading_calendar.py +105 -0
  314. kis_trader-0.1.0/tests/test_client_vi.py +87 -0
  315. kis_trader-0.1.0/tests/test_client_volume_profile.py +137 -0
  316. kis_trader-0.1.0/tests/test_config.py +536 -0
  317. kis_trader-0.1.0/tests/test_datetime.py +64 -0
  318. kis_trader-0.1.0/tests/test_derivative_account.py +960 -0
  319. kis_trader-0.1.0/tests/test_derivative_change.py +209 -0
  320. kis_trader-0.1.0/tests/test_derivative_fingerprint.py +67 -0
  321. kis_trader-0.1.0/tests/test_derivative_handles.py +167 -0
  322. kis_trader-0.1.0/tests/test_derivative_margin_rates.py +136 -0
  323. kis_trader-0.1.0/tests/test_derivative_night.py +560 -0
  324. kis_trader-0.1.0/tests/test_derivative_orderable.py +159 -0
  325. kis_trader-0.1.0/tests/test_derivative_orders.py +200 -0
  326. kis_trader-0.1.0/tests/test_derivative_reconcile.py +271 -0
  327. kis_trader-0.1.0/tests/test_domestic_search.py +226 -0
  328. kis_trader-0.1.0/tests/test_exchange_set_sync.py +35 -0
  329. kis_trader-0.1.0/tests/test_http_transport.py +376 -0
  330. kis_trader-0.1.0/tests/test_instrument.py +52 -0
  331. kis_trader-0.1.0/tests/test_integrated_balance.py +192 -0
  332. kis_trader-0.1.0/tests/test_kernel_hardening.py +103 -0
  333. kis_trader-0.1.0/tests/test_masters.py +276 -0
  334. kis_trader-0.1.0/tests/test_mcp.py +389 -0
  335. kis_trader-0.1.0/tests/test_mcp_orders.py +445 -0
  336. kis_trader-0.1.0/tests/test_namespaces.py +179 -0
  337. kis_trader-0.1.0/tests/test_order_fingerprint_determinism.py +34 -0
  338. kis_trader-0.1.0/tests/test_order_kernel_redesign.py +311 -0
  339. kis_trader-0.1.0/tests/test_order_live_findings.py +202 -0
  340. kis_trader-0.1.0/tests/test_orders_open.py +93 -0
  341. kis_trader-0.1.0/tests/test_overseas_derivative_account.py +1076 -0
  342. kis_trader-0.1.0/tests/test_overseas_derivative_orders.py +419 -0
  343. kis_trader-0.1.0/tests/test_overseas_market_auto.py +79 -0
  344. kis_trader-0.1.0/tests/test_overseas_order_request.py +80 -0
  345. kis_trader-0.1.0/tests/test_overseas_reserved_asia.py +568 -0
  346. kis_trader-0.1.0/tests/test_public_exports.py +35 -0
  347. kis_trader-0.1.0/tests/test_ratelimit.py +180 -0
  348. kis_trader-0.1.0/tests/test_realtime_approval.py +60 -0
  349. kis_trader-0.1.0/tests/test_realtime_bond.py +179 -0
  350. kis_trader-0.1.0/tests/test_realtime_client.py +343 -0
  351. kis_trader-0.1.0/tests/test_realtime_client_routing.py +110 -0
  352. kis_trader-0.1.0/tests/test_realtime_connection.py +277 -0
  353. kis_trader-0.1.0/tests/test_realtime_derivatives.py +407 -0
  354. kis_trader-0.1.0/tests/test_realtime_domestic_extended.py +88 -0
  355. kis_trader-0.1.0/tests/test_realtime_domestic_stock.py +455 -0
  356. kis_trader-0.1.0/tests/test_realtime_elw.py +311 -0
  357. kis_trader-0.1.0/tests/test_realtime_index.py +141 -0
  358. kis_trader-0.1.0/tests/test_realtime_namespace.py +133 -0
  359. kis_trader-0.1.0/tests/test_realtime_overseas.py +500 -0
  360. kis_trader-0.1.0/tests/test_realtime_overseas_surface.py +160 -0
  361. kis_trader-0.1.0/tests/test_realtime_parsers.py +153 -0
  362. kis_trader-0.1.0/tests/test_realtime_protocol.py +140 -0
  363. kis_trader-0.1.0/tests/test_realtime_subscription.py +71 -0
  364. kis_trader-0.1.0/tests/test_reconcile_variant_guard.py +86 -0
  365. kis_trader-0.1.0/tests/test_reserved_fingerprint.py +68 -0
  366. kis_trader-0.1.0/tests/test_reserved_terms_parity.py +128 -0
  367. kis_trader-0.1.0/tests/test_response_pagination.py +114 -0
  368. kis_trader-0.1.0/tests/test_result_immutability.py +124 -0
  369. kis_trader-0.1.0/tests/test_side_from_code.py +30 -0
  370. kis_trader-0.1.0/tests/test_stock_fills.py +171 -0
  371. kis_trader-0.1.0/tests/test_store_v10.py +64 -0
  372. kis_trader-0.1.0/tests/test_store_v8.py +55 -0
  373. kis_trader-0.1.0/tests/test_store_v9.py +75 -0
  374. kis_trader-0.1.0/tests/test_twap_runner.py +224 -0
  375. kis_trader-0.1.0/tests/test_twap_schedule.py +124 -0
  376. kis_trader-0.1.0/tests/test_twap_stock_handle.py +38 -0
  377. kis_trader-0.1.0/tests/test_wire.py +135 -0
  378. kis_trader-0.1.0/tests/typing/check_account_pension.py +17 -0
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "kis-trader",
3
+ "interface": { "displayName": "KIS Trader" },
4
+ "plugins": [
5
+ {
6
+ "name": "kis-trader",
7
+ "version": "0.0.0",
8
+ "description": "Playbook skill for driving the kis_trader KIS Open API client under its safety-kernel discipline.",
9
+ "source": { "source": "local", "path": "./plugins/kis-trader" },
10
+ "policy": { "installation": "AVAILABLE", "authentication": "ON_INSTALL" },
11
+ "category": "Productivity"
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "version": "1",
3
+ "name": "kis-trader",
4
+ "owner": { "name": "seokhoonj" },
5
+ "description": "Drive the kis_trader Korea Investment & Securities (KIS) Open API client under its safety-kernel discipline",
6
+ "plugins": [
7
+ {
8
+ "name": "kis-trader",
9
+ "displayName": "KIS Trader",
10
+ "source": "./plugins/kis-trader",
11
+ "description": "Playbook skill for driving the kis_trader KIS Open API client under its safety-kernel discipline (search-before-trade, ticket confirmation, reconcile-not-resend).",
12
+ "author": { "name": "seokhoonj" },
13
+ "homepage": "https://github.com/seokhoonj/kis-trader",
14
+ "category": "Productivity",
15
+ "keywords": ["kis", "korea-investment", "trading", "stocks", "open-api", "korean-stocks"]
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,24 @@
1
+ name: check
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches: [main]
7
+ pull_request:
8
+
9
+ # A newer push to the same branch or PR makes the older run's result obsolete,
10
+ # so cancel it rather than let both run to completion.
11
+ concurrency:
12
+ group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
13
+ cancel-in-progress: true
14
+
15
+ # The check only reads the code to lint, type, and test it -- it never writes to the
16
+ # repo -- so it runs with the least privilege that still allows a checkout.
17
+ permissions:
18
+ contents: read
19
+
20
+ jobs:
21
+ check:
22
+ # The full check lives in reusable-check.yml so the release gate in
23
+ # publish.yml runs the identical job on the release commit.
24
+ uses: ./.github/workflows/reusable-check.yml
@@ -0,0 +1,71 @@
1
+ name: publish
2
+
3
+ # Publish to PyPI on a GitHub Release, via PyPI Trusted Publishing (OIDC): no API
4
+ # token or password is stored anywhere -- GitHub mints a short-lived identity token
5
+ # that PyPI verifies against the publisher registered for this repo (owner seokhoonj
6
+ # / repo kis-trader / this workflow / environment "pypi").
7
+ #
8
+ # Three jobs. `gate` runs the same reusable check that check.yml runs, on the
9
+ # release commit, so a red build (a lint/type error, a broken test, a lost py.typed
10
+ # or console script) cannot reach an upload. `build` builds the sdist and wheel and
11
+ # hands them to `publish` as an artifact. `publish` -- the only job holding the OIDC
12
+ # token -- downloads that artifact and uploads it, and checks out no source, so the
13
+ # privileged step runs the least code.
14
+
15
+ on:
16
+ release:
17
+ types: [published]
18
+
19
+ # Workflow-level floor: any job without its own `permissions:` block still gets a
20
+ # read-only token, so a job added later cannot silently inherit a write-capable
21
+ # default. The build and publish jobs narrow it further below.
22
+ permissions:
23
+ contents: read
24
+
25
+ jobs:
26
+ gate:
27
+ uses: ./.github/workflows/reusable-check.yml
28
+
29
+ build:
30
+ needs: gate
31
+ runs-on: ubuntu-latest
32
+ timeout-minutes: 15
33
+ permissions:
34
+ contents: read
35
+ steps:
36
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
37
+ with:
38
+ persist-credentials: false
39
+ - name: Assert the release tag matches the package version
40
+ # A release tagged v0.2.0 while pyproject still says 0.1.0 would publish the wrong
41
+ # version -- and a PyPI version number can never be reused. Fail before the build.
42
+ # The tag is passed through env, never interpolated into the script, so a crafted
43
+ # tag name cannot inject shell.
44
+ env:
45
+ TAG: ${{ github.event.release.tag_name }}
46
+ run: |
47
+ version=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
48
+ test "${TAG#v}" = "$version" || { echo "release tag '$TAG' does not match package version '$version'"; exit 1; }
49
+ - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
50
+ - name: Build sdist and wheel, then check the metadata
51
+ run: |
52
+ uv build
53
+ uvx twine check dist/*
54
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
55
+ with:
56
+ name: dist
57
+ path: dist/
58
+
59
+ publish:
60
+ needs: build
61
+ runs-on: ubuntu-latest
62
+ timeout-minutes: 15
63
+ environment: pypi
64
+ permissions:
65
+ id-token: write # OIDC; this is what replaces a stored token
66
+ steps:
67
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
68
+ with:
69
+ name: dist
70
+ path: dist/
71
+ - uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1
@@ -0,0 +1,108 @@
1
+ name: reusable check
2
+
3
+ # The full check -- tests, lint, types, and the packaging assertions -- factored
4
+ # into one reusable job so both `check.yml` (on push / PR) and the release gate in
5
+ # `publish.yml` run the *identical* thing. One definition is what makes "publish
6
+ # gates on the full check" true; a second hand-maintained copy would drift, and a
7
+ # check added here silently would not gate releases.
8
+
9
+ on:
10
+ workflow_call:
11
+
12
+ # The floor lives on the shared body, not only on `check.yml`: `publish.yml`'s gate
13
+ # calls this same workflow, and if the floor were only on `check.yml` the gate would
14
+ # run this check with the repo-default (possibly write) token. Declared here, the
15
+ # check is read-only from every caller. A reusable workflow can only downscope from
16
+ # the caller, so this never widens anyone's token.
17
+ permissions:
18
+ contents: read
19
+
20
+ jobs:
21
+ check:
22
+ runs-on: ubuntu-latest
23
+ timeout-minutes: 15
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ # Every version the unbounded requires-python (>=3.11) actually claims, through
28
+ # the current stable release. 3.11 is the floor that claim has to hold on.
29
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
30
+
31
+ steps:
32
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
33
+ with:
34
+ persist-credentials: false
35
+ - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
36
+
37
+ - name: Install
38
+ # A venv per matrix version, not `uv pip --system`: the runner's system
39
+ # Python is externally managed and is one fixed version whatever the matrix
40
+ # says. This is also what the docs tell a person to run.
41
+ run: |
42
+ uv venv --python ${{ matrix.python-version }}
43
+ uv pip install -e ".[dev]"
44
+ .venv/bin/python -c "import sys; print('testing on', sys.version)"
45
+
46
+ - name: Test
47
+ run: .venv/bin/pytest -q
48
+
49
+ - name: Lint
50
+ run: .venv/bin/ruff check src tests
51
+
52
+ - name: Type check
53
+ run: .venv/bin/mypy
54
+
55
+ - name: Type check narrowing fixtures
56
+ run: .venv/bin/mypy --strict tests/typing
57
+
58
+ - name: Confirm the runtime dependencies are exactly the declared three
59
+ # The three-dependency claim is documented in the pyproject comment; a claim
60
+ # nothing checks quietly stops being true. Installed into a bare environment,
61
+ # kis_trader must import with nothing beyond requests, websockets, and
62
+ # cryptography present.
63
+ run: |
64
+ uv venv /tmp/bare --python ${{ matrix.python-version }}
65
+ uv pip install --python /tmp/bare/bin/python .
66
+ /tmp/bare/bin/python -c "
67
+ import re
68
+ import importlib.metadata as md
69
+ requires = md.requires('kis-trader') or []
70
+ runtime = [r for r in requires if 'extra ==' not in r]
71
+ # Extract each requirement's bare name (before any version/marker/extra) and
72
+ # normalize to PEP 503 form; the runtime set must be exactly the declared
73
+ # three, so a fourth dependency slipping in fails here.
74
+ names = sorted(re.split(r'[<>=!~;\[\s]', r, 1)[0].replace('_', '-').lower() for r in runtime)
75
+ assert names == ['cryptography', 'requests', 'websockets'], f'unexpected runtime dependencies: {runtime}'
76
+ import kis_trader
77
+ print('kis_trader imports with only the declared runtime dependencies present')
78
+ "
79
+ # The console script runs, and its top-level --version prints (not shoved
80
+ # into a required subcommand).
81
+ /tmp/bare/bin/kis --version
82
+
83
+ - name: Confirm a user's type checker can see the hints
84
+ # Every hint in this package is invisible to a user unless py.typed ships
85
+ # alongside it (PEP 561), and the source cannot answer whether it did:
86
+ # src/kis_trader/py.typed can sit in git while the built wheel omits it. So ask
87
+ # it the way a user does -- install the built package into a clean environment
88
+ # and run their checker over their code.
89
+ run: |
90
+ uv venv /tmp/typed --python ${{ matrix.python-version }}
91
+ uv pip install --python /tmp/typed/bin/python . mypy
92
+ cat > /tmp/user_code.py <<'PY'
93
+ from kis_trader import KISClient
94
+
95
+ # profile is str | None; an int is neither, so a checker that can see the
96
+ # shipped hints must reject it and name the expected type.
97
+ KISClient(profile=123)
98
+ PY
99
+ # The checker MUST reject the call (a pass would mean it saw no hints); then
100
+ # assert the specific arg-type diagnostic, not just any line containing "str".
101
+ if /tmp/typed/bin/mypy /tmp/user_code.py > /tmp/mypy_out 2>&1; then
102
+ cat /tmp/mypy_out
103
+ echo "mypy accepted KISClient(profile=123) -- shipped hints are not visible"
104
+ exit 1
105
+ fi
106
+ cat /tmp/mypy_out
107
+ grep -Fq 'Argument "profile" to "KISClient" has incompatible type "int"' /tmp/mypy_out
108
+ grep -Fq '[arg-type]' /tmp/mypy_out
@@ -0,0 +1,36 @@
1
+ # AI coding agents
2
+ CLAUDE.md
3
+ .claude/
4
+ AGENTS.md
5
+ AGENT.md
6
+ .codex/
7
+ GEMINI.md
8
+ .gemini/
9
+
10
+ dev/
11
+ refs/
12
+
13
+ # Local reference clones and tooling (not part of the package)
14
+ python-kis/
15
+ kis-agent/
16
+ kis-ai-ext/
17
+
18
+ # Python
19
+ __pycache__/
20
+ *.py[cod]
21
+ *.egg-info/
22
+ .venv/
23
+ .mypy_cache/
24
+ .ruff_cache/
25
+ .pytest_cache/
26
+ dist/
27
+ build/
28
+ uv.lock
29
+
30
+ # Docs build output (Quarto)
31
+ docs/_site/
32
+ docs/.quarto/
33
+ docs/objects.json
34
+ docs/reference/
35
+
36
+ .superpowers/
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
4
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+
6
+ ## 0.1.0 — 2026-10-02
7
+
8
+ First public release.
9
+
10
+ - Typed Python client for the Korea Investment & Securities (KIS) Open API —
11
+ domestic and overseas quotes, orders, and account views (`kis.domestic`,
12
+ `kis.overseas`, `kis.account`, `kis.orders`).
13
+ - Order safety core: an idempotent order store (dedup by client order id and
14
+ fingerprint), fail-closed `RiskLimits`, and a `reconcile` path for orders whose
15
+ outcome is unclear.
16
+ - Real-time WebSocket subscriptions for quotes, order books, and fills.
17
+ - Optional MCP server (`pip install 'kis-trader[mcp]'`, console script `kis-mcp`)
18
+ exposing the safe read surface plus a dry-run order preview and reconcile.
19
+ - English public identifiers with Korean docstrings; ships `py.typed`.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Seokhoon Joo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,13 @@
1
+ # Run the standard CI checks (test, lint, types) locally. Dev extras: uv pip install -e ".[dev]"
2
+ .PHONY: check test lint types
3
+
4
+ check: test lint types
5
+
6
+ test:
7
+ pytest -q
8
+
9
+ lint:
10
+ ruff check src tests
11
+
12
+ types:
13
+ mypy
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.4
2
+ Name: kis-trader
3
+ Version: 0.1.0
4
+ Summary: A clean Python client for the Korea Investment & Securities (KIS) Open API (English identifiers, Korean docstrings for KIS users)
5
+ Author-email: Seokhoon Joo <seokhoonj@gmail.com>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Classifier: Programming Language :: Python :: 3.11
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Classifier: Programming Language :: Python :: 3.14
12
+ Requires-Python: >=3.11
13
+ Requires-Dist: cryptography>=42
14
+ Requires-Dist: requests>=2.31
15
+ Requires-Dist: websockets>=12
16
+ Provides-Extra: dev
17
+ Requires-Dist: mcp>=2; extra == 'dev'
18
+ Requires-Dist: mypy>=1.11; extra == 'dev'
19
+ Requires-Dist: pytest>=8.0; extra == 'dev'
20
+ Requires-Dist: ruff>=0.6; extra == 'dev'
21
+ Provides-Extra: mcp
22
+ Requires-Dist: mcp>=2; extra == 'mcp'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # kis-trader
26
+
27
+ [![check](https://github.com/seokhoonj/kis-trader/actions/workflows/check.yml/badge.svg)](https://github.com/seokhoonj/kis-trader/actions/workflows/check.yml)
28
+ [![PyPI](https://img.shields.io/pypi/v/kis-trader)](https://pypi.org/project/kis-trader/)
29
+ [![Python](https://img.shields.io/pypi/pyversions/kis-trader)](https://pypi.org/project/kis-trader/)
30
+ [![License](https://img.shields.io/pypi/l/kis-trader)](https://github.com/seokhoonj/kis-trader/blob/main/LICENSE)
31
+
32
+ **한국어** | [English](README.en.md)
33
+
34
+ 한국투자증권 **KIS Open API**의 비공식 파이썬 클라이언트.
35
+
36
+ 국내·해외 주식과 지수, ETF·ETN, ELW, 선물·옵션, 채권의 시세와 재무·수급, 계좌 잔고와 손익,
37
+ 순위·조건검색, 시장·일정, 퇴직연금, 그리고 매수·매도·정정·취소 주문까지 다룹니다. 실시간
38
+ 시세·체결통보(WebSocket)와 터미널 명령 `kis` 도 함께 제공합니다.
39
+
40
+ ## 1. 설치
41
+
42
+ ```bash
43
+ pip install kis-trader
44
+ ```
45
+
46
+ 파이썬 3.11 이상이 필요합니다. 소스에서 개발 설치하려면 `uv pip install -e .` 를 쓰세요.
47
+
48
+ ## 2. 빠른 시작
49
+
50
+ ```python
51
+ from kis_trader import KISClient
52
+
53
+ kis = KISClient(app_key="…", app_secret="…", account="12345678-01")
54
+
55
+ kis.domestic.stock("005930").quote() # 삼성전자 현재가
56
+ kis.overseas.stock("AAPL").quote() # 애플 (거래소 자동 판별)
57
+ kis.domestic.ranking.by_change(direction="gainers") # 오늘 상승률 순위
58
+ ```
59
+
60
+ 앱키와 계좌는 환경변수나 `KISConfig(...).save()` 로 한 번 저장해 두면 이후 인자 없이 열 수
61
+ 있습니다. 발급과 저장은 [자격증명과 프로필](https://seokhoonj.github.io/kis-trader/configuration.html)
62
+ 문서를 참고하세요.
63
+
64
+ ## 3. 구조
65
+
66
+ `KISClient` 아래로 자산군과 주문이 네임스페이스로 나뉩니다.
67
+
68
+ ```python
69
+ kis.domestic # 국내: 주식·지수·ETF·ELW·선물옵션·채권·계좌·순위·시장·일정
70
+ kis.overseas # 해외: 주식·지수·선물옵션·계좌·순위
71
+ kis.account # 계좌 조회 (상품코드 자동 분기; IRP는 .pension 퇴직연금 조회)
72
+ kis.orders # 접수한 주문의 조회(미체결)·확인·정정·취소
73
+ ```
74
+
75
+ 종목과 계약은 핸들로 잡아 시세 조회부터 주문까지 이어갑니다.
76
+
77
+ ```python
78
+ kis.domestic.stock("005930") # 국내 주식 -- 현재가·차트·호가·매수·매도
79
+ kis.overseas.stock("AAPL") # 해외 주식 -- 거래소 자동 판별
80
+ kis.domestic.futures("101W09") # 지수선물
81
+ kis.domestic.option("201W09") # 지수옵션
82
+ ```
83
+
84
+ ## 4. 주문
85
+
86
+ ```python
87
+ r = kis.domestic.stock("005930").buy(quantity=10, limit_price=70000) # 10주 매수
88
+ kis.orders.reconcile(r.client_order_id) # 실제 접수 여부를 증권사에 재확인
89
+ kis.orders.cancel(r.client_order_id) # 취소
90
+ ```
91
+
92
+ 주문은 되돌릴 수 없습니다. 중복 주문을 막는 안전장치가 기본으로 동작하고(신용거래는 기본
93
+ 차단), 자세한 규칙은 [주문 문서](https://seokhoonj.github.io/kis-trader/orders.html)에 있습니다.
94
+
95
+ ## 5. 명령줄 (`kis`)
96
+
97
+ 설치하면 터미널 명령 `kis` 가 함께 깔립니다. 파이썬을 짜지 않고도 조회와 주문을 할 수 있습니다.
98
+ 주문은 `--execute` 를 붙이기 전까지 실제로 전송되지 않는 실행 안 함(dry-run) 상태입니다.
99
+
100
+ ```bash
101
+ kis stock quote 005930
102
+ kis search 삼성전자
103
+ kis ranking change --direction gainers
104
+ kis account balance
105
+ kis order buy 005930 10 --limit-price 70000 # 실행 안 함(dry-run)
106
+ kis order buy 005930 10 --limit-price 70000 --execute paper --yes # 모의투자로 실제 전송
107
+ kis account balance --asset bond # 채권 lot 목록(buy_date/buy_sequence 컬럼)
108
+ kis order buy KR6449111CB8 100 --asset bond --limit-price 10125 # 채권 매수(dry-run)
109
+ # 채권 매도는 목록의 buy_sequence 컬럼을 --buy-seq 로, buy_date 를 --buy-date 로 지목한다:
110
+ kis order sell KR6449111CB8 100 --asset bond --limit-price 10130 --buy-date 20260814 --buy-seq 1
111
+ kis account orders --asset bond --date 20260814 # 채권 미체결 확인(주문 타임아웃 후)
112
+ kis account fills --start 20240101 --end 20240131 # 국내주식 체결내역(기간)
113
+ kis account profits --start 20240101 --end 20240131 # 국내 종목별 실현손익
114
+ kis account transactions --venue overseas --start 20240101 --end 20240131 # 해외 거래·입출금내역
115
+ kis --profile futures account balance # 선물옵션 계좌(프로필 03/08)
116
+ kis --profile futures account deposit # 선물옵션 예수금현황
117
+ kis account fills --asset bond --start 20240101 --end 20240131 # 채권 체결내역(기간)
118
+ kis order buy 005930 10 --limit-price 70000 --reserve --end-date 20260901 # 예약매수(실전전용)
119
+ kis account reserved --start 20260101 --end 20260901 # 예약주문 목록
120
+ kis order cancel-reserved <순번> --order-date 20260901 # 예약 취소
121
+ kis order modify-reserved <순번> --symbol 005930 --side buy --quantity 10 --limit-price 71000 # 예약 정정(전체 재지정; 단가 생략 시 시장가)
122
+ kis order twap 005930 --side buy --quantity 100 --over 30m --slices 3 # 국내 TWAP 분할(30분간 3회 시장가; dry-run)
123
+ kis order buy 00700 100 --venue overseas --reserve --limit-price 350 --exchange HKS --currency HKD # 해외 예약매수(지정가 필수; 통화는 홍콩 전용; 모의 허용)
124
+ kis account reserved --venue overseas --start 20260101 --end 20260901 # 해외 예약주문 목록(미국+아시아)
125
+ kis order cancel-reserved US123 --venue overseas --receipt-date 20260901 # 해외 예약 취소(미국 전용; 아시아는 kis order cancel)
126
+ kis order buy AAPL 10 --venue overseas --limit-price 150 --algo twap --execute real --yes # 미국 algo 분할(twap/vwap; 실전·최소 10주)
127
+ kis order buy 101W09 1 --asset futures --limit-price 350.5 # 국내 선물 지정가
128
+ kis order buy 201S07 1 --asset option --right call --limit-price 5.2 # 국내 옵션
129
+ kis order buy <sym> 1 --asset futures --venue overseas --limit-price 100 # 해외 선물
130
+ ```
131
+
132
+ ## 6. AI 코딩 에이전트에서 사용
133
+
134
+ Claude Code·Codex 같은 AI 도구로 계좌를 다루려면 `plugins/kis-trader/skills/kis-trader/` 스킬을 씁니다.
135
+ [Claude 스킬](https://seokhoonj.github.io/kis-trader/claude-skill.html) ·
136
+ [Codex 스킬](https://seokhoonj.github.io/kis-trader/codex-skill.html) 문서를 참고하세요.
137
+
138
+ MCP 호환 에이전트(Claude Desktop 등)에는 `kis_trader.mcp` 서버(`pip install 'kis-trader[mcp]'` 후
139
+ `kis-mcp`)로 계좌 조회·주문 미리보기 도구를 열 수 있습니다(실주문 전송은 노출하지 않음).
140
+ [MCP 서버](https://seokhoonj.github.io/kis-trader/mcp.html) 문서를 참고하세요.
141
+
142
+ ## 7. 문서
143
+
144
+ 전체 문서는 **<https://seokhoonj.github.io/kis-trader/>** 에 있습니다(소스: `docs/`).
145
+
146
+ | 파트 | 장 |
147
+ |------|----|
148
+ | **시작하기** | [빠른 시작](https://seokhoonj.github.io/kis-trader/quickstart.html) · [앱키 발급](https://seokhoonj.github.io/kis-trader/appkey.html) · [자격증명과 프로필](https://seokhoonj.github.io/kis-trader/configuration.html) |
149
+ | **국내 주식** | [시세](https://seokhoonj.github.io/kis-trader/quotes.html) · [재무·실적](https://seokhoonj.github.io/kis-trader/financials.html) · [종목 수급](https://seokhoonj.github.io/kis-trader/flows.html) · [계좌·손익](https://seokhoonj.github.io/kis-trader/account.html) · [주문](https://seokhoonj.github.io/kis-trader/orders.html) |
150
+ | **시장·검색** | [순위·조건검색](https://seokhoonj.github.io/kis-trader/screening.html) · [시장·지수](https://seokhoonj.github.io/kis-trader/market.html) · [기업행위·일정](https://seokhoonj.github.io/kis-trader/corporate-actions.html) |
151
+ | **해외·연금** | [해외주식](https://seokhoonj.github.io/kis-trader/overseas.html) · [퇴직연금](https://seokhoonj.github.io/kis-trader/pension.html) |
152
+ | **다른 상품** | [ETF·ETN](https://seokhoonj.github.io/kis-trader/etf.html) · [ELW](https://seokhoonj.github.io/kis-trader/elw.html) · [선물·옵션](https://seokhoonj.github.io/kis-trader/derivatives.html) · [채권](https://seokhoonj.github.io/kis-trader/bonds.html) |
153
+ | **명령줄·에이전트** | [Command Line](https://seokhoonj.github.io/kis-trader/cli.html) · [Claude Skill](https://seokhoonj.github.io/kis-trader/claude-skill.html) · [Codex Skill](https://seokhoonj.github.io/kis-trader/codex-skill.html) · [MCP Server](https://seokhoonj.github.io/kis-trader/mcp.html) |
154
+ | **참고** | [실시간(WebSocket)](https://seokhoonj.github.io/kis-trader/realtime.html) · [한계·미구현](https://seokhoonj.github.io/kis-trader/limits.html) |
155
+
156
+ 각 메서드의 인자와 반환값은 `help(그_메서드)` 로 바로 볼 수 있습니다.
157
+
158
+ ## 8. 라이선스
159
+
160
+ [MIT](LICENSE)
@@ -0,0 +1,135 @@
1
+ # kis-trader
2
+
3
+ [![check](https://github.com/seokhoonj/kis-trader/actions/workflows/check.yml/badge.svg)](https://github.com/seokhoonj/kis-trader/actions/workflows/check.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/kis-trader)](https://pypi.org/project/kis-trader/)
5
+ [![Python](https://img.shields.io/pypi/pyversions/kis-trader)](https://pypi.org/project/kis-trader/)
6
+ [![License](https://img.shields.io/pypi/l/kis-trader)](https://github.com/seokhoonj/kis-trader/blob/main/LICENSE)
7
+
8
+ [한국어](README.md) | **English**
9
+
10
+ An unofficial Python client for the Korea Investment & Securities (KIS) **Open API**.
11
+
12
+ Domestic and overseas stocks and indices, ETFs and ETNs, ELWs, futures and options, and bonds —
13
+ their quotes, financials and flows, account balances and profit, rankings and conditional
14
+ screens, market data and calendars, retirement pensions, and buy/sell/modify/cancel orders. Live
15
+ quotes and execution notices (WebSocket) and a terminal command `kis` come with it.
16
+
17
+ ## 1. Install
18
+
19
+ ```bash
20
+ pip install kis-trader
21
+ ```
22
+
23
+ Requires Python 3.11+. For a development install from source, use `uv pip install -e .`.
24
+
25
+ ## 2. Quickstart
26
+
27
+ ```python
28
+ from kis_trader import KISClient
29
+
30
+ kis = KISClient(app_key="…", app_secret="…", account="12345678-01")
31
+
32
+ kis.domestic.stock("005930").quote() # Samsung Electronics quote
33
+ kis.overseas.stock("AAPL").quote() # Apple (exchange resolved automatically)
34
+ kis.domestic.ranking.by_change(direction="gainers") # today's top gainers
35
+ ```
36
+
37
+ Save the app key and account once as environment variables or with `KISConfig(...).save()`, and
38
+ later calls open without arguments. For issuing and storing credentials, see the
39
+ [Credentials and profiles](https://seokhoonj.github.io/kis-trader/configuration.html) chapter.
40
+
41
+ ## 3. Structure
42
+
43
+ Under `KISClient`, asset classes and orders split into namespaces.
44
+
45
+ ```python
46
+ kis.domestic # domestic: stocks, indices, ETFs, ELWs, futures/options, bonds, account, rankings, market, calendar
47
+ kis.overseas # overseas: stocks, indices, futures/options, account, rankings
48
+ kis.account # account queries (dispatched by product code; IRP adds .pension)
49
+ kis.orders # list (open), check, modify, and cancel submitted orders
50
+ ```
51
+
52
+ Reach a symbol or contract through a handle, then read quotes and place orders from it.
53
+
54
+ ```python
55
+ kis.domestic.stock("005930") # domestic stock -- quote, chart, order book, buy, sell
56
+ kis.overseas.stock("AAPL") # overseas stock -- exchange resolved automatically
57
+ kis.domestic.futures("101W09") # index futures
58
+ kis.domestic.option("201W09") # index options
59
+ ```
60
+
61
+ ## 4. Orders
62
+
63
+ ```python
64
+ r = kis.domestic.stock("005930").buy(quantity=10, limit_price=70000) # buy 10 shares
65
+ kis.orders.reconcile(r.client_order_id) # re-check with the broker whether it was actually accepted
66
+ kis.orders.cancel(r.client_order_id) # cancel
67
+ ```
68
+
69
+ Orders cannot be undone. A duplicate-order safeguard is on by default (credit trading is blocked
70
+ by default); the full rules are in the [Orders](https://seokhoonj.github.io/kis-trader/orders.html)
71
+ chapter.
72
+
73
+ ## 5. Command line (`kis`)
74
+
75
+ Installing also adds the terminal command `kis`, so you can query and order without writing
76
+ Python. An order is not actually sent until you add `--execute` — until then it is a dry run.
77
+
78
+ ```bash
79
+ kis stock quote 005930
80
+ kis search 삼성전자
81
+ kis ranking change --direction gainers
82
+ kis account balance
83
+ kis order buy 005930 10 --limit-price 70000 # dry run, not sent
84
+ kis order buy 005930 10 --limit-price 70000 --execute paper --yes # sent to paper trading
85
+ kis account balance --asset bond # list bond lots (buy_date/buy_sequence columns)
86
+ kis order buy KR6449111CB8 100 --asset bond --limit-price 10125 # bond buy (dry run)
87
+ # bond sell targets a lot: pass the buy_sequence column as --buy-seq, buy_date as --buy-date:
88
+ kis order sell KR6449111CB8 100 --asset bond --limit-price 10130 --buy-date 20260814 --buy-seq 1
89
+ kis account orders --asset bond --date 20260814 # bond open orders (after an order timeout)
90
+ kis account fills --start 20240101 --end 20240131 # domestic stock fills history (range)
91
+ kis account profits --start 20240101 --end 20240131 # domestic realized P&L by symbol
92
+ kis account transactions --venue overseas --start 20240101 --end 20240131 # overseas transactions/cash ledger
93
+ kis --profile futures account balance # futures/options account (03/08 profile)
94
+ kis --profile futures account deposit # futures/options deposit snapshot
95
+ kis account fills --asset bond --start 20240101 --end 20240131 # bond fills history (range)
96
+ kis order buy 005930 10 --limit-price 70000 --reserve --end-date 20260901 # reserved buy (real only)
97
+ kis account reserved --start 20260101 --end 20260901 # reserved orders list
98
+ kis order cancel-reserved <seq> --order-date 20260901 # cancel a reservation
99
+ kis order modify-reserved <seq> --symbol 005930 --side buy --quantity 10 --limit-price 71000 # modify a reservation (full re-specify; omit price -> market)
100
+ kis order twap 005930 --side buy --quantity 100 --over 30m --slices 3 # domestic TWAP split (3 market slices over 30m; dry run)
101
+ kis order buy 00700 100 --venue overseas --reserve --limit-price 350 --exchange HKS --currency HKD # overseas reserved buy (limit only; currency is HK-only; paper allowed)
102
+ kis account reserved --venue overseas --start 20260101 --end 20260901 # overseas reserved orders (US + Asia)
103
+ kis order cancel-reserved US123 --venue overseas --receipt-date 20260901 # cancel overseas reservation (US only; Asia via kis order cancel)
104
+ kis order buy AAPL 10 --venue overseas --limit-price 150 --algo twap --execute real --yes # US server-side algo split (twap/vwap; real, min 10 shares)
105
+ kis order buy 101W09 1 --asset futures --limit-price 350.5 # domestic futures (limit)
106
+ kis order buy 201S07 1 --asset option --right call --limit-price 5.2 # domestic option
107
+ kis order buy <sym> 1 --asset futures --venue overseas --limit-price 100 # overseas futures
108
+ ```
109
+
110
+ ## 6. Use it from an AI coding agent
111
+
112
+ To manage an account through an AI tool such as Claude Code or Codex, use the
113
+ `plugins/kis-trader/skills/kis-trader/` skill. See the
114
+ [Claude skill](https://seokhoonj.github.io/kis-trader/claude-skill.html) and
115
+ [Codex skill](https://seokhoonj.github.io/kis-trader/codex-skill.html) chapters.
116
+
117
+ ## 7. Documentation
118
+
119
+ The full documentation lives at **<https://seokhoonj.github.io/kis-trader/>** (source: `docs/`).
120
+
121
+ | Part | Chapters |
122
+ |------|----------|
123
+ | **Getting started** | [Quickstart](https://seokhoonj.github.io/kis-trader/quickstart.html) · [Issue an app key](https://seokhoonj.github.io/kis-trader/appkey.html) · [Credentials and profiles](https://seokhoonj.github.io/kis-trader/configuration.html) |
124
+ | **Domestic stocks** | [Quotes](https://seokhoonj.github.io/kis-trader/quotes.html) · [Financials](https://seokhoonj.github.io/kis-trader/financials.html) · [Flows](https://seokhoonj.github.io/kis-trader/flows.html) · [Account & profit](https://seokhoonj.github.io/kis-trader/account.html) · [Orders](https://seokhoonj.github.io/kis-trader/orders.html) |
125
+ | **Market & search** | [Rankings & screens](https://seokhoonj.github.io/kis-trader/screening.html) · [Market & indices](https://seokhoonj.github.io/kis-trader/market.html) · [Corporate actions & calendar](https://seokhoonj.github.io/kis-trader/corporate-actions.html) |
126
+ | **Overseas & pension** | [Overseas stocks](https://seokhoonj.github.io/kis-trader/overseas.html) · [Retirement pension](https://seokhoonj.github.io/kis-trader/pension.html) |
127
+ | **Other products** | [ETF & ETN](https://seokhoonj.github.io/kis-trader/etf.html) · [ELW](https://seokhoonj.github.io/kis-trader/elw.html) · [Futures & options](https://seokhoonj.github.io/kis-trader/derivatives.html) · [Bonds](https://seokhoonj.github.io/kis-trader/bonds.html) |
128
+ | **CLI & agents** | [Command Line](https://seokhoonj.github.io/kis-trader/cli.html) · [Claude Skill](https://seokhoonj.github.io/kis-trader/claude-skill.html) · [Codex Skill](https://seokhoonj.github.io/kis-trader/codex-skill.html) |
129
+ | **Reference** | [Realtime (WebSocket)](https://seokhoonj.github.io/kis-trader/realtime.html) · [Limits & gaps](https://seokhoonj.github.io/kis-trader/limits.html) |
130
+
131
+ The arguments and return value of each method are available through `help(the_method)`.
132
+
133
+ ## 8. License
134
+
135
+ [MIT](LICENSE)