kabukit 0.7.6__py3-none-any.whl → 0.8.0__py3-none-any.whl

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.
kabukit/__init__.py CHANGED
@@ -1,17 +1,15 @@
1
+ from .core.documents import Documents
1
2
  from .core.info import Info
2
- from .core.list import List
3
3
  from .core.prices import Prices
4
- from .core.reports import Reports
5
4
  from .core.statements import Statements
6
5
  from .edinet.client import EdinetClient
7
6
  from .jquants.client import JQuantsClient
8
7
 
9
8
  __all__ = [
9
+ "Documents",
10
10
  "EdinetClient",
11
11
  "Info",
12
12
  "JQuantsClient",
13
- "List",
14
13
  "Prices",
15
- "Reports",
16
14
  "Statements",
17
15
  ]
kabukit/cli/auth.py CHANGED
@@ -78,7 +78,7 @@ def show() -> None:
78
78
  from kabukit.utils.config import get_dotenv_path
79
79
 
80
80
  path = get_dotenv_path()
81
- typer.echo(f"Configuration file: {path}")
81
+ typer.echo(f"設定ファイル: {path}")
82
82
 
83
83
  if path.exists():
84
84
  config = dotenv_values(path)
kabukit/cli/cache.py CHANGED
@@ -23,7 +23,9 @@ def add_to_tree(tree: Tree, path: Path) -> None:
23
23
  branch = tree.add(p.name)
24
24
  add_to_tree(branch, p)
25
25
  else:
26
- tree.add(p.name)
26
+ size = p.stat().st_size
27
+ formatted_size = format_size(size)
28
+ tree.add(f"{p.name} ({formatted_size})")
27
29
 
28
30
 
29
31
  @app.command()
@@ -59,3 +61,13 @@ def clean() -> None:
59
61
  msg += "エラーが発生しました。"
60
62
  typer.secho(msg, fg=typer.colors.RED, bold=True)
61
63
  raise typer.Exit(1) from None
64
+
65
+
66
+ def format_size(size_in_bytes: int) -> str:
67
+ if size_in_bytes < 1024:
68
+ return f"{size_in_bytes} B"
69
+
70
+ if size_in_bytes < 1024 * 1024:
71
+ return f"{size_in_bytes / 1024:.1f} KB"
72
+
73
+ return f"{size_in_bytes / (1024 * 1024):.1f} MB"
kabukit/cli/get.py CHANGED
@@ -3,12 +3,15 @@ from __future__ import annotations
3
3
  from typing import TYPE_CHECKING, Annotated, Any
4
4
 
5
5
  import typer
6
- from async_typer import AsyncTyper # pyright: ignore[reportMissingTypeStubs]
7
- from typer import Argument
6
+ from async_typer import AsyncTyper
7
+ from typer import Argument, Option
8
8
 
9
9
  if TYPE_CHECKING:
10
10
  from kabukit.core.base import Base
11
11
 
12
+ # pyright: reportMissingTypeStubs=false
13
+ # pyright: reportUnknownMemberType=false
14
+
12
15
  app = AsyncTyper(
13
16
  add_completion=False,
14
17
  help="J-Quantsからデータを取得します。",
@@ -18,9 +21,13 @@ Code = Annotated[
18
21
  str | None,
19
22
  Argument(help="銘柄コード。指定しない場合は全銘柄の情報を取得します。"),
20
23
  ]
24
+ Quiet = Annotated[
25
+ bool,
26
+ Option("--quiet", "-q", help="プログレスバーを表示しません。"),
27
+ ]
21
28
 
22
29
 
23
- @app.async_command() # pyright: ignore[reportUnknownMemberType]
30
+ @app.async_command()
24
31
  async def info(code: Code = None) -> None:
25
32
  """上場銘柄一覧を取得します。"""
26
33
  from kabukit.core.info import Info
@@ -42,6 +49,8 @@ async def _fetch(
42
49
  cls: type[Base],
43
50
  fetch_func_name: str,
44
51
  message: str,
52
+ *,
53
+ quiet: bool = False,
45
54
  **kwargs: Any,
46
55
  ) -> None:
47
56
  """財務情報・株価情報を取得するための共通処理"""
@@ -57,8 +66,10 @@ async def _fetch(
57
66
 
58
67
  from kabukit.jquants.concurrent import fetch_all
59
68
 
69
+ progress = None if quiet else tqdm.asyncio.tqdm
70
+
60
71
  try:
61
- df = await fetch_all(target, progress=tqdm.asyncio.tqdm, **kwargs)
72
+ df = await fetch_all(target, progress=progress, **kwargs)
62
73
  except KeyboardInterrupt:
63
74
  typer.echo("中断しました。")
64
75
  raise typer.Exit(1) from None
@@ -68,8 +79,8 @@ async def _fetch(
68
79
  typer.echo(f"全銘柄の{message}を '{path}' に保存しました。")
69
80
 
70
81
 
71
- @app.async_command() # pyright: ignore[reportUnknownMemberType]
72
- async def statements(code: Code = None) -> None:
82
+ @app.async_command()
83
+ async def statements(code: Code = None, *, quiet: Quiet = False) -> None:
73
84
  """財務情報を取得します。"""
74
85
  from kabukit.core.statements import Statements
75
86
 
@@ -79,12 +90,13 @@ async def statements(code: Code = None) -> None:
79
90
  cls=Statements,
80
91
  fetch_func_name="get_statements",
81
92
  message="財務情報",
93
+ quiet=quiet,
82
94
  )
83
95
 
84
96
 
85
- @app.async_command() # pyright: ignore[reportUnknownMemberType]
86
- async def prices(code: Code = None) -> None:
87
- """株価を取得します。"""
97
+ @app.async_command()
98
+ async def prices(code: Code = None, *, quiet: Quiet = False) -> None:
99
+ """株価情報を取得します。"""
88
100
  from kabukit.core.prices import Prices
89
101
 
90
102
  await _fetch(
@@ -93,77 +105,47 @@ async def prices(code: Code = None) -> None:
93
105
  cls=Prices,
94
106
  fetch_func_name="get_prices",
95
107
  message="株価情報",
108
+ quiet=quiet,
96
109
  max_concurrency=8,
97
110
  )
98
111
 
99
112
 
100
- @app.async_command(name="list") # pyright: ignore[reportUnknownMemberType]
101
- async def list_() -> None:
102
- """報告書一覧を取得します。"""
113
+ @app.async_command()
114
+ async def documents(*, quiet: Quiet = False) -> None:
115
+ """書類一覧を取得します。"""
103
116
  import tqdm.asyncio
104
117
 
105
- from kabukit.core.list import List
106
- from kabukit.edinet.concurrent import fetch_list
118
+ from kabukit.core.documents import Documents
119
+ from kabukit.edinet.concurrent import fetch_documents
107
120
 
108
- try:
109
- df = await fetch_list(years=10, progress=tqdm.asyncio.tqdm)
110
- except (KeyboardInterrupt, RuntimeError):
111
- typer.echo("中断しました。")
112
- raise typer.Exit(1) from None
113
-
114
- typer.echo(df)
115
- path = List(df).write()
116
- typer.echo(f"報告書一覧を '{path}' に保存しました。")
117
-
118
-
119
- @app.async_command() # pyright: ignore[reportUnknownMemberType]
120
- async def reports() -> None:
121
- """報告書を取得します。"""
122
- import polars as pl
123
- import tqdm.asyncio
124
-
125
- from kabukit.core.list import List
126
- from kabukit.core.reports import Reports
127
- from kabukit.edinet.concurrent import fetch_csv
121
+ progress = None if quiet else tqdm.asyncio.tqdm
128
122
 
129
123
  try:
130
- df = List.read().data
131
- except FileNotFoundError:
132
- await list_()
133
- df = List.read().data
134
-
135
- lst = df.filter(pl.col("csvFlag"), pl.col("secCode").is_not_null())
136
- doc_ids = lst["docID"].unique()
137
-
138
- try:
139
- df = await fetch_csv(doc_ids, limit=1000, progress=tqdm.asyncio.tqdm)
124
+ df = await fetch_documents(years=10, progress=progress)
140
125
  except (KeyboardInterrupt, RuntimeError):
141
126
  typer.echo("中断しました。")
142
127
  raise typer.Exit(1) from None
143
128
 
144
129
  typer.echo(df)
145
- path = Reports(df).write()
146
- typer.echo(f"報告書を '{path}' に保存しました。")
130
+ path = Documents(df).write()
131
+ typer.echo(f"書類一覧を '{path}' に保存しました。")
147
132
 
148
133
 
149
- @app.async_command(name="all") # pyright: ignore[reportUnknownMemberType]
150
- async def all_(code: Code = None) -> None:
151
- """上場銘柄一覧、財務情報、株価、報告書を連続して取得します。"""
134
+ @app.async_command(name="all")
135
+ async def all_(code: Code = None, *, quiet: Quiet = False) -> None:
136
+ """上場銘柄一覧、財務情報、株価情報、書類一覧を連続して取得します。"""
152
137
  typer.echo("上場銘柄一覧を取得します。")
153
138
  await info(code)
154
139
 
155
140
  typer.echo("---")
156
141
  typer.echo("財務情報を取得します。")
157
- await statements(code)
142
+ await statements(code, quiet=quiet)
158
143
 
159
144
  typer.echo("---")
160
- typer.echo("株価を取得します。")
161
- await prices(code)
145
+ typer.echo("株価情報を取得します。")
146
+ await prices(code, quiet=quiet)
162
147
 
163
148
  if code is None:
164
149
  typer.echo("---")
165
- typer.echo("報告書一覧を取得します。")
166
- await list_()
167
- typer.echo("---")
168
- typer.echo("報告書を取得します。")
169
- await reports()
150
+ typer.echo("書類一覧を取得します。")
151
+ await documents(quiet=quiet)
@@ -3,5 +3,5 @@ from __future__ import annotations
3
3
  from .base import Base
4
4
 
5
5
 
6
- class List(Base):
6
+ class Documents(Base):
7
7
  pass
@@ -1,3 +1,3 @@
1
- from .concurrent import fetch, fetch_csv, fetch_list
1
+ from .concurrent import fetch, fetch_csv, fetch_documents
2
2
 
3
- __all__ = ["fetch", "fetch_csv", "fetch_list"]
3
+ __all__ = ["fetch", "fetch_csv", "fetch_documents"]
kabukit/edinet/client.py CHANGED
@@ -14,7 +14,7 @@ from kabukit.core.client import Client
14
14
  from kabukit.utils.config import load_dotenv
15
15
  from kabukit.utils.params import get_params
16
16
 
17
- from .doc import clean_csv, clean_list, read_csv
17
+ from .doc import clean_csv, clean_documents, read_csv
18
18
 
19
19
  if TYPE_CHECKING:
20
20
  import datetime
@@ -62,6 +62,15 @@ class EdinetClient(Client):
62
62
  return resp
63
63
 
64
64
  async def get_count(self, date: str | datetime.date) -> int:
65
+ """書類一覧 API を使い、特定の日付の提出書類数を取得する。
66
+
67
+ Args:
68
+ date (str | datetime.date): 取得対象の日付 (YYYY-MM-DD)
69
+
70
+ Returns:
71
+ int: 書類数
72
+
73
+ """
65
74
  params = get_params(date=date, type=1)
66
75
  resp = await self.get("/documents.json", params)
67
76
  data = resp.json()
@@ -72,7 +81,15 @@ class EdinetClient(Client):
72
81
 
73
82
  return metadata["resultset"]["count"]
74
83
 
75
- async def get_list(self, date: str | datetime.date) -> DataFrame:
84
+ async def get_documents(self, date: str | datetime.date) -> DataFrame:
85
+ """書類一覧 API を使い、特定の日付の提出書類一覧を取得する。
86
+
87
+ Args:
88
+ date (str | datetime.date): 取得対象の日付 (YYYY-MM-DD)
89
+
90
+ Returns:
91
+ DataFrame: 提出書類一覧を格納した DataFrame
92
+ """
76
93
  params = get_params(date=date, type=2)
77
94
  resp = await self.get("/documents.json", params)
78
95
  data = resp.json()
@@ -85,7 +102,7 @@ class EdinetClient(Client):
85
102
  if df.is_empty():
86
103
  return df
87
104
 
88
- return clean_list(df, date)
105
+ return clean_documents(df, date)
89
106
 
90
107
  async def get_document(self, doc_id: str, doc_type: int) -> Response:
91
108
  params = get_params(type=doc_type)
@@ -52,7 +52,7 @@ async def fetch(
52
52
  )
53
53
 
54
54
 
55
- async def fetch_list(
55
+ async def fetch_documents(
56
56
  days: int | None = None,
57
57
  years: int | None = None,
58
58
  limit: int | None = None,
@@ -60,11 +60,11 @@ async def fetch_list(
60
60
  progress: Progress | None = None,
61
61
  callback: Callback | None = None,
62
62
  ) -> DataFrame:
63
- """過去days日またはyears年の文書一覧を取得し、単一のDataFrameにまとめて返す。
63
+ """過去 days 日または years 年の文書一覧を取得し、単一の DataFrame にまとめて返す。
64
64
 
65
65
  Args:
66
- days (int | None): 過去days日の日付リストを取得する。
67
- years (int | None): 過去years年の日付リストを取得する。
66
+ days (int | None): 過去 days 日の日付リストを取得する。
67
+ years (int | None): 過去 years 年の日付リストを取得する。
68
68
  daysが指定されている場合は無視される。
69
69
  max_concurrency (int | None, optional): 同時に実行するリクエストの最大数。
70
70
  指定しないときはデフォルト値が使用される。
@@ -84,13 +84,13 @@ async def fetch_list(
84
84
  dates = dates[:limit]
85
85
 
86
86
  df = await fetch(
87
- "list",
87
+ "documents",
88
88
  dates,
89
89
  max_concurrency=max_concurrency,
90
90
  progress=progress,
91
91
  callback=callback,
92
92
  )
93
- return df.sort("Date")
93
+ return df.sort("Date", "Code")
94
94
 
95
95
 
96
96
  async def fetch_csv(
kabukit/edinet/doc.py CHANGED
@@ -10,7 +10,7 @@ if TYPE_CHECKING:
10
10
  from polars import DataFrame
11
11
 
12
12
 
13
- def clean_list(df: DataFrame, date: str | datetime.date) -> DataFrame:
13
+ def clean_documents(df: DataFrame, date: str | datetime.date) -> DataFrame:
14
14
  if isinstance(date, str):
15
15
  date = (
16
16
  datetime.datetime.strptime(date, "%Y-%m-%d")
@@ -35,7 +35,8 @@ def clean_list(df: DataFrame, date: str | datetime.date) -> DataFrame:
35
35
  pl.col("^.+Flag$").cast(pl.Int8).cast(pl.Boolean),
36
36
  pl.col("^.+Code$").cast(pl.String),
37
37
  )
38
- .select("Date", pl.exclude("Date"))
38
+ .rename({"secCode": "Code"})
39
+ .select("Date", "Code", pl.exclude("Date", "Code"))
39
40
  )
40
41
 
41
42
 
kabukit/jquants/info.py CHANGED
@@ -15,6 +15,7 @@ async def get_target_codes() -> list[str]:
15
15
  """分析対象となる銘柄コードのリストを返す。
16
16
 
17
17
  以下の条件を満たす銘柄は対象外とする。
18
+
18
19
  - 市場: TOKYO PRO MARKET
19
20
  - 業種: その他 -- (投資信託など)
20
21
  - 優先株式
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.3
2
+ Name: kabukit
3
+ Version: 0.8.0
4
+ Summary: A Python toolkit for Japanese financial market data, supporting J-Quants and EDINET APIs.
5
+ Keywords: J-Quants,EDINET,financial data,stock market,investment,toolkit,finance,trading,data analysis,polars
6
+ Author: daizutabi
7
+ Author-email: daizutabi <daizutabi@gmail.com>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2025 Daizu
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ Classifier: Development Status :: 4 - Beta
30
+ Classifier: Programming Language :: Python
31
+ Classifier: Programming Language :: Python :: 3 :: Only
32
+ Classifier: Programming Language :: Python :: 3.13
33
+ Classifier: Programming Language :: Python :: 3.14
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Operating System :: OS Independent
36
+ Classifier: Intended Audience :: Developers
37
+ Classifier: Intended Audience :: Financial and Insurance Industry
38
+ Classifier: Intended Audience :: Science/Research
39
+ Classifier: Topic :: Office/Business :: Financial
40
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
41
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
42
+ Classifier: Topic :: Utilities
43
+ Requires-Dist: async-typer>=0.1.10
44
+ Requires-Dist: httpx>=0.28.1
45
+ Requires-Dist: platformdirs>=4.5.0
46
+ Requires-Dist: polars>=1.34.0
47
+ Requires-Dist: python-dotenv>=1.1.1
48
+ Requires-Dist: rich>=14.2.0
49
+ Requires-Dist: tenacity>=9.1.2
50
+ Requires-Dist: tqdm>=4.67.1
51
+ Requires-Dist: typer>=0.19.2
52
+ Requires-Dist: tzdata ; sys_platform == 'win32'
53
+ Requires-Python: >=3.13
54
+ Project-URL: Changelog, https://github.com/daizutabi/kabukit/releases
55
+ Project-URL: Documentation, https://daizutabi.github.io/kabukit/
56
+ Project-URL: Homepage, https://daizutabi.github.io/kabukit/
57
+ Project-URL: Issues, https://github.com/daizutabi/kabukit/issues
58
+ Project-URL: Source, https://github.com/daizutabi/kabukit
59
+ Description-Content-Type: text/markdown
60
+
61
+ # kabukit
62
+
63
+ [![PyPI Version][pypi-v-image]][pypi-v-link]
64
+ [![Python Version][python-v-image]][python-v-link]
65
+ [![Build Status][GHAction-image]][GHAction-link]
66
+ [![Coverage Status][codecov-image]][codecov-link]
67
+ [![Documentation Status][docs-image]][docs-link]
68
+
69
+ A Python toolkit for Japanese financial market data,
70
+ supporting J-Quants and EDINET APIs.
71
+
72
+ kabukit は、 [J-Quants API](https://jpx-jquants.com/) および [EDINET API](https://disclosure2dl.edinet-fsa.go.jp/guide/static/disclosure/WZEK0110.html) から、効率的に日本の金融市場データを取得するツールキットです。
73
+
74
+ 高速なデータ処理ライブラリである [Polars](https://pola.rs/) と、モダンな非同期 HTTP クライアントである [httpx](https://www.python-httpx.org/) を基盤として構築されており、パフォーマンスを重視しています。
75
+
76
+ ## インストール
77
+
78
+ `pip` または `uv` を使ってインストールします。Python バージョンは 3.13 以上が必要です。
79
+
80
+ ```bash
81
+ pip install kabukit
82
+ ```
83
+
84
+ ## コマンドラインから使う
85
+
86
+ kabukit は、 [J-Quants API](https://jpx-jquants.com/) および [EDINET API](https://disclosure2dl.edinet-fsa.go.jp/guide/static/disclosure/WZEK0110.html) からデータを取得するための便利なコマンドラインインターフェース(CLI)を提供します。
87
+
88
+ 詳しい使い方は、[**コマンドラインインターフェースの使い方**](https://daizutabi.github.io/kabukit/guides/cli/)を参照してください。
89
+
90
+ ## ノートブックから使う
91
+
92
+ kabukit は、コマンドラインだけでなく、Python コードからも API として利用できます。httpx を使って非同期でデータを取得するため、[Jupyter](https://jupyter.org/) や [marimo](https://marimo.io/) のような非同期処理を直接扱えるノートブック環境と非常に相性が良いです。
93
+
94
+ 具体的な使い方は、以下の利用ガイドを参照してください。
95
+
96
+ - [**J-Quants API 利用ガイド**](https://daizutabi.github.io/kabukit/guides/jquants/)
97
+ - [**EDINET API 利用ガイド**](https://daizutabi.github.io/kabukit/guides/edinet/)
98
+
99
+ <!-- Badges -->
100
+
101
+ [pypi-v-image]: https://img.shields.io/pypi/v/kabukit.svg
102
+ [pypi-v-link]: https://pypi.org/project/kabukit/
103
+ [python-v-image]: https://img.shields.io/pypi/pyversions/kabukit.svg
104
+ [python-v-link]: https://pypi.org/project/kabukit
105
+ [GHAction-image]: https://github.com/daizutabi/kabukit/actions/workflows/ci.yaml/badge.svg?branch=main&event=push
106
+ [GHAction-link]: https://github.com/daizutabi/kabukit/actions?query=event%3Apush+branch%3Amain
107
+ [codecov-image]: https://codecov.io/github/daizutabi/kabukit/graph/badge.svg?token=Yu6lAdVVnd
108
+ [codecov-link]: https://codecov.io/github/daizutabi/kabukit?branch=main
109
+ [docs-image]: https://img.shields.io/badge/docs-latest-blue.svg
110
+ [docs-link]: https://daizutabi.github.io/kabukit/
@@ -1,4 +1,4 @@
1
- kabukit/__init__.py,sha256=zO4BQg4wvNkK8fqDfMwd22KTIPAgXb79iNDldKfTWf4,371
1
+ kabukit/__init__.py,sha256=NuirQbbIVxtysXgZYBtjOdYL_7KEmSZgP4a67MIU_1Y,337
2
2
  kabukit/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  kabukit/analysis/indicators.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  kabukit/analysis/preprocess.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -8,26 +8,25 @@ kabukit/analysis/visualization/market.py,sha256=M45dPi7BUsYxl8JEy_aE_uIi4r7Y6Hv8
8
8
  kabukit/analysis/visualization/prices.py,sha256=VS9WXBKcdOYsnVe-OR3cWP_nru3Oa-rBOK5SUwsxfyQ,1857
9
9
  kabukit/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  kabukit/cli/app.py,sha256=B5aiSWDTmouiz4aagBbHL67z4bdTqUDGGGQkDxlaCyU,577
11
- kabukit/cli/auth.py,sha256=4RQvUlisW3KyAuQIRW5aCcCtnoKXAU_6mHIQkMIjYUQ,2694
12
- kabukit/cli/cache.py,sha256=cHjpNPi1BnaPwXXIFEpbmjCA8Cvtov9yNcbRm12109M,1745
13
- kabukit/cli/get.py,sha256=z_bo1EdABkO0T4Mpdmb0qSIMVdWRWyopN7IX9VoTxxE,4815
11
+ kabukit/cli/auth.py,sha256=KOGFDA0xRMkhlv8jrsuncYh0mgG_c5rO8Pn5XSs5NUc,2694
12
+ kabukit/cli/cache.py,sha256=2hBG9wxvdfhNihlLs9CqKeqio6E24K3TPooYzli_xmQ,2102
13
+ kabukit/cli/get.py,sha256=vVc11tvuMfyl758Grw1i4zjxQVUIKMKCQjCxO4KgwiM,4098
14
14
  kabukit/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  kabukit/core/base.py,sha256=WVFvv70n99GTqLkhkRnibLRgYP-eMh6lYY3R__q_YXY,1725
16
16
  kabukit/core/client.py,sha256=tVq1r3zpOfjmOtnRI1KPZHgTgBZYIpJzfw15i2kAM48,676
17
+ kabukit/core/documents.py,sha256=xbVXblZPhEFk3L-4cywJ2koNxIWoPu-gIa6bRZL17GE,93
17
18
  kabukit/core/info.py,sha256=knL0rX18RNfra7iBhMK9H0GuaIapzYbxMeizkfuM1QM,88
18
- kabukit/core/list.py,sha256=JQHE6aoYreE2Oik_LJ9x0xE7nmkGsx688XYASaVqooE,88
19
19
  kabukit/core/prices.py,sha256=dPNgCTFf-eE7-C-e_2vy9uqVZT7O55k2JKUNG1CPFX0,17728
20
- kabukit/core/reports.py,sha256=G7p8IcUOHDopZJMxMLnYhss9hIq4gCKEXFixINQI_7w,91
21
20
  kabukit/core/statements.py,sha256=_n4-8G284e6y_MwhvUq4xBK4bapQHk-Zmwu09C_r7wU,2790
22
- kabukit/edinet/__init__.py,sha256=PKa4D-jVpeoOkdVp9NwwpgAiGEBjqvmJLmpzF-9SlVk,101
23
- kabukit/edinet/client.py,sha256=HbxUvl6vKmfJ4-quIwCGspVOuHTMFbSolZXbhfG891U,3760
24
- kabukit/edinet/concurrent.py,sha256=2YPzIFuuOB8-gL3CnHIlP486QH5d21qjKNKGCFK7Hzk,4707
25
- kabukit/edinet/doc.py,sha256=plxJ-o5-8NzllHY7Sn0M8KbyIenDAfh5XISLfpq27Ag,1410
21
+ kabukit/edinet/__init__.py,sha256=PV9uXRNkvoJG93Ma_2rJMR9B6LZuLO8aMTpjMCG1ayA,111
22
+ kabukit/edinet/client.py,sha256=8ZrP25NFrrTmXR595Sk7CB4H3b_3Dpp6RVZArufLlAI,4297
23
+ kabukit/edinet/concurrent.py,sha256=f4S6-OOXWHagwJAKgJoC-ALG8W5eY-wMujn_c_w7H_o,4735
24
+ kabukit/edinet/doc.py,sha256=zjoghrG_Zy8lGHm69oCtMMpuiY1tmWH_kBuxhEVxhqw,1468
26
25
  kabukit/jquants/__init__.py,sha256=xY0H6x4_51ZBqbrT2TdmGGFbTD-hosZiDzVIz4UXPv0,112
27
26
  kabukit/jquants/calendar.py,sha256=Vz4Degedgx8qENHWri2MTkIbkuIRfO28CXRq7bZaHGE,333
28
27
  kabukit/jquants/client.py,sha256=HYJ41CzifVUTad49oEMpml4KFb26bTyd8nbx1FLrVz8,14183
29
28
  kabukit/jquants/concurrent.py,sha256=86xYD_zPLnR24xZhfSS0mAcUM-dvUvpozzyKASSHiwo,3345
30
- kabukit/jquants/info.py,sha256=MZbtg0L-YIkegWnCd3AvTs1AopV3z58ImgOnxgJgJbw,997
29
+ kabukit/jquants/info.py,sha256=u7yQ1uMcxH_dbCGkzewmsgdtgrYizGWvNohVBuPfvwc,998
31
30
  kabukit/jquants/prices.py,sha256=oApQpdgzHwPw11XHpdg8ccZS7kybGtV8APZlpD2L3Yw,882
32
31
  kabukit/jquants/schema.py,sha256=aILl9cp9JDOaT2o3UlfavPGQC5s7n0ZkVBGKiTzdogs,9768
33
32
  kabukit/jquants/statements.py,sha256=CHJKwM44-TAUPMrieA1VVwHT89KpcXxEfJcbh9y-dWI,2752
@@ -38,7 +37,7 @@ kabukit/utils/concurrent.py,sha256=qR3gvhUBYOjwtVT_Hluy1g-XaaFL9ysHvZz3WUE8G1k,4
38
37
  kabukit/utils/config.py,sha256=fqUdlhVjgiWEcsLFmPckp-dXUleVz8Ypdy_NnrMIBfY,708
39
38
  kabukit/utils/date.py,sha256=eB5ONCkqnvOiAg1Hvg1pN4OkrxLR47urvOAD5BF5yL0,982
40
39
  kabukit/utils/params.py,sha256=qcaJbf6CWPUoZAZsYDTaZSnBUWeAersbWnR_iiYW9GM,1108
41
- kabukit-0.7.6.dist-info/WHEEL,sha256=X16MKk8bp2DRsAuyteHJ-9qOjzmnY0x1aj0P1ftqqWA,78
42
- kabukit-0.7.6.dist-info/entry_points.txt,sha256=vvX771TemoM-35vVizW3JJ70HvRXnd2tX4P1Btzyoxs,46
43
- kabukit-0.7.6.dist-info/METADATA,sha256=eVhMPfupAUIvBO1n03KN8jWHEizq4zBV9FvpHZ9yW-A,10170
44
- kabukit-0.7.6.dist-info/RECORD,,
40
+ kabukit-0.8.0.dist-info/WHEEL,sha256=X16MKk8bp2DRsAuyteHJ-9qOjzmnY0x1aj0P1ftqqWA,78
41
+ kabukit-0.8.0.dist-info/entry_points.txt,sha256=vvX771TemoM-35vVizW3JJ70HvRXnd2tX4P1Btzyoxs,46
42
+ kabukit-0.8.0.dist-info/METADATA,sha256=hOWt_F-KpcmaaAnbpfYQ0cTMbJdt6fFrbRyaaQC-9-g,5918
43
+ kabukit-0.8.0.dist-info/RECORD,,
kabukit/core/reports.py DELETED
@@ -1,7 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from .base import Base
4
-
5
-
6
- class Reports(Base):
7
- pass
@@ -1,260 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: kabukit
3
- Version: 0.7.6
4
- Summary: A Python toolkit for Japanese financial market data, supporting J-Quants and EDINET APIs.
5
- Keywords: J-Quants,EDINET,financial data,stock market,investment,toolkit,finance,trading,data analysis,polars
6
- Author: daizutabi
7
- Author-email: daizutabi <daizutabi@gmail.com>
8
- License: MIT License
9
-
10
- Copyright (c) 2025 Daizu
11
-
12
- Permission is hereby granted, free of charge, to any person obtaining a copy
13
- of this software and associated documentation files (the "Software"), to deal
14
- in the Software without restriction, including without limitation the rights
15
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- copies of the Software, and to permit persons to whom the Software is
17
- furnished to do so, subject to the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included in all
20
- copies or substantial portions of the Software.
21
-
22
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- SOFTWARE.
29
- Classifier: Development Status :: 4 - Beta
30
- Classifier: Programming Language :: Python
31
- Classifier: Programming Language :: Python :: 3 :: Only
32
- Classifier: Programming Language :: Python :: 3.13
33
- Classifier: Programming Language :: Python :: 3.14
34
- Classifier: License :: OSI Approved :: MIT License
35
- Classifier: Operating System :: OS Independent
36
- Classifier: Intended Audience :: Developers
37
- Classifier: Intended Audience :: Financial and Insurance Industry
38
- Classifier: Intended Audience :: Science/Research
39
- Classifier: Topic :: Office/Business :: Financial
40
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
41
- Classifier: Topic :: Scientific/Engineering :: Information Analysis
42
- Classifier: Topic :: Utilities
43
- Requires-Dist: async-typer>=0.1.10
44
- Requires-Dist: httpx>=0.28.1
45
- Requires-Dist: platformdirs>=4.5.0
46
- Requires-Dist: polars>=1.34.0
47
- Requires-Dist: python-dotenv>=1.1.1
48
- Requires-Dist: rich>=14.2.0
49
- Requires-Dist: tenacity>=9.1.2
50
- Requires-Dist: tqdm>=4.67.1
51
- Requires-Dist: typer>=0.19.2
52
- Requires-Dist: tzdata ; sys_platform == 'win32'
53
- Requires-Python: >=3.13
54
- Project-URL: Changelog, https://github.com/daizutabi/kabukit/releases
55
- Project-URL: Documentation, https://daizutabi.github.io/kabukit/
56
- Project-URL: Homepage, https://daizutabi.github.io/kabukit/
57
- Project-URL: Issues, https://github.com/daizutabi/kabukit/issues
58
- Project-URL: Source, https://github.com/daizutabi/kabukit
59
- Description-Content-Type: text/markdown
60
-
61
- # kabukit
62
-
63
- A Python toolkit for Japanese financial market data, supporting J-Quants and EDINET APIs.
64
-
65
- [![PyPI Version][pypi-v-image]][pypi-v-link]
66
- [![Python Version][python-v-image]][python-v-link]
67
- [![Build Status][GHAction-image]][GHAction-link]
68
- [![Coverage Status][codecov-image]][codecov-link]
69
- [![Documentation Status][docs-image]][docs-link]
70
-
71
- kabukitは、高速なデータ処理ライブラリである [Polars](https://pola.rs/) と、モダンな非同期HTTPクライアントである [httpx](https://www.python-httpx.org/) を基盤として構築されており、パフォーマンスを重視しています。
72
-
73
- ## インストール
74
-
75
- `uv` または `pip` を使って、[Python Package Index (PyPI)](https://pypi.org/) からインストールします。Pythonバージョンは3.13以上が必要です。
76
-
77
- ```bash
78
- uv pip install kabukit
79
- ```
80
-
81
- ## コマンドラインから使う
82
-
83
- kabukitは、 [J-Quants](https://jpx-jquants.com/) および [EDINET](https://disclosure2.edinet-fsa.go.jp/) からデータを取得するための便利なコマンドラインインターフェース(CLI)を提供します。
84
-
85
- コマンド名は `kabu` です。
86
-
87
- ### 認証
88
-
89
- #### J-Quants
90
-
91
- J-Quants APIを利用するには、事前にユーザー登録が必要です。`auth jquants` サブコマンドを使い、登録したメールアドレスとパスワードで認証し、IDトークンを取得します。IDトークンはユーザーの設定ディレクトリに保存されます。
92
-
93
- ```bash
94
- ❯ kabu auth jquants
95
- Mailaddress: your_email@example.com
96
- Password: your_password
97
- J-QuantsのIDトークンを保存しました。
98
- ```
99
-
100
- #### EDINET
101
-
102
- EDINET APIを利用するには、事前にAPIキーの取得が必要です。`auth edinet` サブコマンド使い、取得したAPIキーをユーザーの設定ディレクトリに保存します。
103
-
104
- ```bash
105
- ❯ kabu auth edinet
106
- Api key: your_api_key
107
- EDINETのAPIキーを保存しました。
108
- ```
109
-
110
- #### 認証データで確認
111
-
112
- 認証データの保存先と内容は、`auth show` サブコマンドで確認できます。
113
-
114
- ```bash
115
- ❯ kabu auth show
116
- Configuration file: /home/your_name/.config/kabukit/.env
117
- JQUANTS_ID_TOKEN: ******
118
- EDINET_API_KEY: ******
119
- ```
120
-
121
- ### データ取得
122
-
123
- `get` サブコマンドは、J-QuantsおよびEDINETから各種データを取得します。以下に、一例を示します。
124
-
125
- #### 銘柄情報
126
-
127
- ```bash
128
- ❯ kabu get info 7203
129
- shape: (1, 8)
130
- ┌────────────┬───────┬──────────────┬──────────────────┬─
131
- │ Date ┆ Code ┆ CompanyName ┆ Sector17CodeName ┆
132
- │ --- ┆ --- ┆ --- ┆ --- ┆
133
- │ date ┆ str ┆ str ┆ cat ┆
134
- ╞════════════╪═══════╪══════════════╪══════════════════╪═
135
- │ 2025-10-14 ┆ 72030 ┆ トヨタ自動車 ┆ 自動車・輸送機 ┆
136
- └────────────┴───────┴──────────────┴──────────────────┴─
137
- ```
138
-
139
- #### 財務情報
140
-
141
- ```bash
142
- ❯ kabu get statements 7203
143
- shape: (41, 105)
144
- (略)
145
- ```
146
-
147
- #### 株価情報
148
-
149
- ```bash
150
- ❯ kabu get prices 7203
151
- shape: (2_444, 16)
152
- (略)
153
- ```
154
-
155
- #### 全銘柄のデータ一括取得
156
-
157
- 各コマンドで銘柄コードを省力すると、全銘柄のデータを一度に取得できます。財務情報の場合は以下の通りです。
158
-
159
- ```bash
160
- > kabu get statements
161
- 100%|███████████████████████████| 3787/3787 [01:18<00:00, 48.24it/s]
162
- shape: (165_891, 105)
163
- (略)
164
- ```
165
-
166
- `get all` サブコマンドを使うと、全銘柄の各種データを一度に取得できます。
167
-
168
- ```bash
169
- > kabu get all
170
- ```
171
-
172
- これらのデータはキャッシュディレクトリに保存され、後で再利用できます。キャッシュデータを確認するには、`cache tree` サブコマンドを使います。
173
-
174
- ```bash
175
- > kabu cache tree
176
- /home/your_name/.cache/kabukit
177
- ├── info
178
- │ └── 20251011.parquet
179
- ├── list
180
- │ └── 20251011.parquet
181
- ├── prices
182
- │ └── 20251011.parquet
183
- ├── reports
184
- │ └── 20251011.parquet
185
- └── statements
186
- └── 20251011.parquet
187
- ```
188
-
189
- キャッシュデータは、`cache clean` サブコマンドで消去できます。
190
-
191
- ## ノートブックから使う
192
-
193
- kabukitは、コマンドラインだけでなく、PythonコードからもAPIとして利用できます。httpxを使って非同期でデータを取得するため、[Jupyter](https://jupyter.org/) や [marimo](https://marimo.io/) のような非同期処理を直接扱えるノートブック環境と非常に相性が良いです。
194
-
195
- ### データ取得
196
-
197
- J-Quantsの例を示します。まず、`JQuantsClient`のインスタンスを作成します。事前に、コマンドラインで認証を済ませてください。
198
-
199
- ```python
200
- from kabukit import JQuantsClient
201
-
202
- client = JQuantsClient()
203
- ```
204
-
205
- #### 銘柄情報
206
-
207
- ```python
208
- info = await client.get_info("7203")
209
- ```
210
-
211
- #### 財務情報
212
-
213
- ```python
214
- statements = await client.get_statements("7203")
215
- ```
216
-
217
- #### 株価情報
218
-
219
- ```python
220
- prices = await client.get_prices("7203")
221
- ```
222
-
223
- #### 全銘柄のデータ一括取得
224
-
225
- `fetch_all`関数を使うと、全銘柄のデータを一度に取得できます。marimoノートブックを使っていれば、プログレスバーを簡単に表示できます。財務情報の場合は以下の通りです。
226
-
227
- ```python
228
- import marimo as mo
229
- from kabukit.jquants import fetch_all
230
-
231
- statements = await fetch_all("statements", progress=mo.status.progress_bar)
232
- ```
233
-
234
- 株価情報の場合は、上記の `"statements"` を `"prices"` に変更してください。
235
-
236
- ### キャッシュデータの利用
237
-
238
- コマンドラインで事前に保存しておいたキャッシュデータを再利用できます。ノートブックの起動ごとに、APIアクセスを行ってデータをダウンロードする必要がなくなります。
239
-
240
- ```python
241
- from kabukit import Info, Statements, Prices
242
-
243
- # data属性で、Polars DataFrameを取得できます。
244
- info = Info.read().data
245
- statements = Statements.read().data
246
- prices = Prices.read().data
247
- ```
248
-
249
- <!-- Badges -->
250
-
251
- [pypi-v-image]: https://img.shields.io/pypi/v/kabukit.svg
252
- [pypi-v-link]: https://pypi.org/project/kabukit/
253
- [python-v-image]: https://img.shields.io/pypi/pyversions/kabukit.svg
254
- [python-v-link]: https://pypi.org/project/kabukit
255
- [GHAction-image]: https://github.com/daizutabi/kabukit/actions/workflows/ci.yaml/badge.svg?branch=main&event=push
256
- [GHAction-link]: https://github.com/daizutabi/kabukit/actions?query=event%3Apush+branch%3Amain
257
- [codecov-image]: https://codecov.io/github/daizutabi/kabukit/graph/badge.svg?token=Yu6lAdVVnd
258
- [codecov-link]: https://codecov.io/github/daizutabi/kabukit?branch=main
259
- [docs-image]: https://img.shields.io/badge/docs-latest-blue.svg
260
- [docs-link]: https://daizutabi.github.io/kabukit/