kabukit 0.4.0__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kabukit-0.4.0 → kabukit-0.5.1}/PKG-INFO +7 -7
- {kabukit-0.4.0 → kabukit-0.5.1}/pyproject.toml +14 -14
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/core/prices.py +24 -9
- kabukit-0.5.1/src/kabukit/core/statements.py +41 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/jquants/concurrent.py +2 -1
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/jquants/schema.py +1 -1
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/jquants/statements.py +2 -2
- kabukit-0.4.0/src/kabukit/core/statements.py +0 -24
- {kabukit-0.4.0 → kabukit-0.5.1}/LICENSE +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/README.md +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/__init__.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/analysis/__init__.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/analysis/indicators.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/analysis/preprocess.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/analysis/screener.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/analysis/visualization.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/cli/__init__.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/cli/app.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/cli/auth.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/cli/get.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/core/__init__.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/core/base.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/core/client.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/core/info.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/core/list.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/core/reports.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/edinet/__init__.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/edinet/client.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/edinet/concurrent.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/edinet/doc.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/jquants/__init__.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/jquants/client.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/jquants/info.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/jquants/prices.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/py.typed +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/utils/__init__.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/utils/concurrent.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/utils/config.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/utils/date.py +0 -0
- {kabukit-0.4.0 → kabukit-0.5.1}/src/kabukit/utils/params.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: kabukit
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.5.1
|
4
4
|
Summary: A Python toolkit for Japanese financial market data, supporting J-Quants and EDINET APIs.
|
5
5
|
Author: daizutabi
|
6
6
|
Author-email: daizutabi <daizutabi@gmail.com>
|
@@ -28,13 +28,13 @@ License: MIT License
|
|
28
28
|
Classifier: Development Status :: 4 - Beta
|
29
29
|
Classifier: Programming Language :: Python
|
30
30
|
Classifier: Programming Language :: Python :: 3.13
|
31
|
-
Requires-Dist: async-typer>=0.1
|
31
|
+
Requires-Dist: async-typer>=0.1.10
|
32
32
|
Requires-Dist: holidays>=0.81
|
33
|
-
Requires-Dist: httpx>=0.28
|
34
|
-
Requires-Dist: platformdirs>=4
|
35
|
-
Requires-Dist: polars>=1
|
36
|
-
Requires-Dist: python-dotenv>=1
|
37
|
-
Requires-Dist: typer>=0.19
|
33
|
+
Requires-Dist: httpx>=0.28.1
|
34
|
+
Requires-Dist: platformdirs>=4.4.0
|
35
|
+
Requires-Dist: polars>=1.34.0
|
36
|
+
Requires-Dist: python-dotenv>=1.1.1
|
37
|
+
Requires-Dist: typer>=0.19.2
|
38
38
|
Requires-Python: >=3.13
|
39
39
|
Project-URL: Documentation, https://daizutabi.github.io/kabukit/
|
40
40
|
Project-URL: Issues, https://github.com/daizutabi/kabukit/issues
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "kabukit"
|
7
|
-
version = "0.
|
7
|
+
version = "0.5.1"
|
8
8
|
description = "A Python toolkit for Japanese financial market data, supporting J-Quants and EDINET APIs."
|
9
9
|
readme = "README.md"
|
10
10
|
license = { file = "LICENSE" }
|
@@ -16,13 +16,13 @@ classifiers = [
|
|
16
16
|
]
|
17
17
|
requires-python = ">=3.13"
|
18
18
|
dependencies = [
|
19
|
-
"async-typer>=0.1",
|
19
|
+
"async-typer>=0.1.10",
|
20
20
|
"holidays>=0.81",
|
21
|
-
"httpx>=0.28",
|
22
|
-
"platformdirs>=4",
|
23
|
-
"polars>=1",
|
24
|
-
"python-dotenv>=1",
|
25
|
-
"typer>=0.19",
|
21
|
+
"httpx>=0.28.1",
|
22
|
+
"platformdirs>=4.4.0",
|
23
|
+
"polars>=1.34.0",
|
24
|
+
"python-dotenv>=1.1.1",
|
25
|
+
"typer>=0.19.2",
|
26
26
|
]
|
27
27
|
|
28
28
|
[project.scripts]
|
@@ -35,10 +35,10 @@ Issues = "https://github.com/daizutabi/kabukit/issues"
|
|
35
35
|
|
36
36
|
[dependency-groups]
|
37
37
|
dev = [
|
38
|
-
"altair>=5",
|
39
|
-
"basedpyright>=1.31.
|
40
|
-
"marimo[lsp]>=0.16",
|
41
|
-
"numpy>=2.3.3",
|
38
|
+
"altair>=5.5.0",
|
39
|
+
"basedpyright>=1.31.6",
|
40
|
+
"marimo[lsp]>=0.16.5",
|
41
|
+
"numpy>=2.3.3", # polars 1.33 type hinting workaround,
|
42
42
|
"pytest-asyncio>=1.2.0",
|
43
43
|
"pytest-clarity>=1.0.1",
|
44
44
|
"pytest-cov>=7.0.0",
|
@@ -47,9 +47,9 @@ dev = [
|
|
47
47
|
"pytest-xdist>=3.8.0",
|
48
48
|
"rich>=14.1.0",
|
49
49
|
"tqdm>=4.67.1",
|
50
|
-
"vegafusion-python-embed>=1.6",
|
51
|
-
"vegafusion>=2",
|
52
|
-
"vl-convert-python>=1.8",
|
50
|
+
"vegafusion-python-embed>=1.6.9",
|
51
|
+
"vegafusion>=2.0.3",
|
52
|
+
"vl-convert-python>=1.8.0",
|
53
53
|
]
|
54
54
|
docs = ["mkapi>=4.4", "mkdocs-marimo", "mkdocs-material"]
|
55
55
|
|
@@ -41,10 +41,10 @@ class Prices(Base):
|
|
41
41
|
(`AdjustmentFactor`) を用いて補正し、日次ベースの時系列データとして
|
42
42
|
提供します。これにより、日々の時価総額計算などが正確に行えるようになります。
|
43
43
|
|
44
|
-
具体的には、`statements`から`
|
44
|
+
具体的には、`statements`から`IssuedShares`(発行済株式総数)と
|
45
45
|
`TreasuryShares`(自己株式数)を取得し、それぞれを調整します。
|
46
46
|
計算結果は、元の列名との混同を避けるため、接頭辞`Adjusted`を付与した
|
47
|
-
新しい列(`
|
47
|
+
新しい列(`AdjustedIssuedShares`, `AdjustedTreasuryShares`)として
|
48
48
|
追加されます。
|
49
49
|
|
50
50
|
.. note::
|
@@ -54,11 +54,10 @@ class Prices(Base):
|
|
54
54
|
反映されないイベントによる株式数の変動は考慮されません。
|
55
55
|
|
56
56
|
Args:
|
57
|
-
statements (Statements):
|
58
|
-
株式数データを提供できる`Statements`オブジェクト。
|
57
|
+
statements (Statements): 財務データを提供する`Statements`オブジェクト。
|
59
58
|
|
60
59
|
Returns:
|
61
|
-
Self: `
|
60
|
+
Self: `AdjustedIssuedShares`および`AdjustedTreasuryShares`列が
|
62
61
|
追加された、新しいPricesオブジェクト。
|
63
62
|
"""
|
64
63
|
shares = statements.number_of_shares().rename({"Date": "ReportDate"})
|
@@ -77,16 +76,32 @@ class Prices(Base):
|
|
77
76
|
.over("Code", "ReportDate")
|
78
77
|
.alias("CumulativeRatio"),
|
79
78
|
)
|
80
|
-
.
|
81
|
-
"
|
82
|
-
"Code",
|
83
|
-
(pl.col("TotalShares", "TreasuryShares") * pl.col("CumulativeRatio"))
|
79
|
+
.with_columns(
|
80
|
+
(pl.col("IssuedShares", "TreasuryShares") * pl.col("CumulativeRatio"))
|
84
81
|
.round(0)
|
85
82
|
.cast(pl.Int64)
|
86
83
|
.name.prefix("Adjusted"),
|
87
84
|
)
|
85
|
+
.select("Date", "Code", "AdjustedIssuedShares", "AdjustedTreasuryShares")
|
88
86
|
)
|
89
87
|
|
90
88
|
data = self.data.join(adjusted, on=["Date", "Code"], how="left")
|
91
89
|
|
92
90
|
return self.__class__(data)
|
91
|
+
|
92
|
+
def with_forecast_profit(self, statements: Statements) -> Self:
|
93
|
+
"""時系列の予想純利益を列として追加する。
|
94
|
+
|
95
|
+
Args:
|
96
|
+
statements (Statements): 財務データを提供する`Statements`オブジェクト。
|
97
|
+
|
98
|
+
Returns:
|
99
|
+
Self: `ForecastProfit` 列が追加された、新しいPricesオブジェクト。
|
100
|
+
"""
|
101
|
+
data = self.data.join_asof(
|
102
|
+
statements.forecast_profit(),
|
103
|
+
on="Date",
|
104
|
+
by="Code",
|
105
|
+
check_sortedness=False,
|
106
|
+
)
|
107
|
+
return self.__class__(data)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import TYPE_CHECKING
|
4
|
+
|
5
|
+
import polars as pl
|
6
|
+
|
7
|
+
from .base import Base
|
8
|
+
|
9
|
+
if TYPE_CHECKING:
|
10
|
+
from polars import DataFrame
|
11
|
+
|
12
|
+
|
13
|
+
class Statements(Base):
|
14
|
+
def number_of_shares(self) -> DataFrame:
|
15
|
+
"""発行済株式数を取得する。"""
|
16
|
+
return self.data.filter(
|
17
|
+
pl.col("IssuedShares").is_not_null(),
|
18
|
+
).select(
|
19
|
+
"Date",
|
20
|
+
"Code",
|
21
|
+
"IssuedShares",
|
22
|
+
"TreasuryShares",
|
23
|
+
"AverageOutstandingShares",
|
24
|
+
)
|
25
|
+
|
26
|
+
def forecast_profit(self) -> DataFrame:
|
27
|
+
"""予想純利益を抽出する。
|
28
|
+
|
29
|
+
Returns:
|
30
|
+
DataFrame: Date, Code, ForecastProfit を含むDataFrame
|
31
|
+
"""
|
32
|
+
return (
|
33
|
+
self.data.with_columns(
|
34
|
+
pl.when(pl.col("TypeOfDocument").str.starts_with("FY"))
|
35
|
+
.then(pl.col("NextYearForecastProfit"))
|
36
|
+
.otherwise(pl.col("ForecastProfit"))
|
37
|
+
.alias("ForecastProfit"),
|
38
|
+
)
|
39
|
+
.filter(pl.col("ForecastProfit").is_not_null())
|
40
|
+
.select("Date", "Code", "ForecastProfit")
|
41
|
+
)
|
@@ -41,7 +41,7 @@ async def fetch(
|
|
41
41
|
DataFrame:
|
42
42
|
すべての銘柄の財務情報を含む単一のDataFrame。
|
43
43
|
"""
|
44
|
-
|
44
|
+
data = await concurrent.fetch(
|
45
45
|
JQuantsClient,
|
46
46
|
resource,
|
47
47
|
codes,
|
@@ -49,6 +49,7 @@ async def fetch(
|
|
49
49
|
progress=progress,
|
50
50
|
callback=callback,
|
51
51
|
)
|
52
|
+
return data.sort("Code", "Date")
|
52
53
|
|
53
54
|
|
54
55
|
async def fetch_all(
|
@@ -130,7 +130,7 @@ class StatementColumns(BaseColumns):
|
|
130
130
|
ChangesInAccountingEstimates = "会計上の見積りの変更"
|
131
131
|
RetrospectiveRestatement = "修正再表示"
|
132
132
|
|
133
|
-
|
133
|
+
IssuedShares = "期末発行済株式数" # 自己株式を含む (NumberOfIssuedAndOutstandingSharesAtTheEndOfFiscalYearIncludingTreasuryStock)
|
134
134
|
TreasuryShares = "期末自己株式数" # (NumberOfTreasuryStockAtTheEndOfFiscalYear)
|
135
135
|
AverageOutstandingShares = "期中平均株式数" # 自己株式を除く。EPSなどの計算に使用される (AverageNumberOfShares)
|
136
136
|
|
@@ -17,7 +17,7 @@ def clean(df: DataFrame) -> DataFrame:
|
|
17
17
|
.rename(
|
18
18
|
{
|
19
19
|
"LocalCode": "Code",
|
20
|
-
"NumberOfIssuedAndOutstandingSharesAtTheEndOfFiscalYearIncludingTreasuryStock": "
|
20
|
+
"NumberOfIssuedAndOutstandingSharesAtTheEndOfFiscalYearIncludingTreasuryStock": "IssuedShares", # noqa: E501
|
21
21
|
"NumberOfTreasuryStockAtTheEndOfFiscalYear": "TreasuryShares",
|
22
22
|
"AverageNumberOfShares": "AverageOutstandingShares",
|
23
23
|
},
|
@@ -49,7 +49,7 @@ def _cast_float(df: DataFrame) -> DataFrame:
|
|
49
49
|
]
|
50
50
|
).with_columns(
|
51
51
|
pl.col(
|
52
|
-
"
|
52
|
+
"IssuedShares",
|
53
53
|
"TreasuryShares",
|
54
54
|
).cast(pl.Int64, strict=False),
|
55
55
|
pl.col(
|
@@ -1,24 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
from typing import TYPE_CHECKING
|
4
|
-
|
5
|
-
import polars as pl
|
6
|
-
|
7
|
-
from .base import Base
|
8
|
-
|
9
|
-
if TYPE_CHECKING:
|
10
|
-
from polars import DataFrame
|
11
|
-
|
12
|
-
|
13
|
-
class Statements(Base):
|
14
|
-
def number_of_shares(self) -> DataFrame:
|
15
|
-
"""発行済株式数を取得する。"""
|
16
|
-
return self.data.filter(
|
17
|
-
pl.col("TotalShares").is_not_null(),
|
18
|
-
).select(
|
19
|
-
"Date",
|
20
|
-
"Code",
|
21
|
-
"TotalShares",
|
22
|
-
"TreasuryShares",
|
23
|
-
"AverageOutstandingShares",
|
24
|
-
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|