Skip to main content

pykabutan

A clean, beginner-friendly Python library for scraping kabutan.jp (Japanese stock information site).

PyPI version Python versions License Documentation Open In Colab

Installation

pip install pykabutan

Quick Start

import pykabutan as pk

# Get stock information
ticker = pk.Ticker("7203")  # Toyota
print(ticker.profile.name)      # トヨタ自動車
print(ticker.profile.market)    # 東証P
print(ticker.profile.per)       # 10.5

# Get price history (yfinance-style), indexed by date
df = ticker.history(period="30d")
print(df)

# Get financial statements (dict of DataFrames, values in 百万円)
financials = ticker.financials()
print(financials["annual"])

# Search by industry
results = pk.search_by_industry("電気機器")
for t in results[:5]:
    print(t.code, t.profile.name)

# Search by theme (Japanese terms only)
results = pk.search_by_theme("人工知能")

Features

  • Simple, yfinance-style API
  • Lazy loading for performance
  • Works out of the box with sensible defaults
  • No Selenium dependency (lightweight)

What's New in 0.2.0

  • Real financials(): parses the finance page into a dict of DataFrames (annual, interim, quarterly, cashflow, profitability, financial_position, records), values in 百万円 (millions of yen).
  • Calendar-accurate history() periods: period="30d" / "6mo" / "1y" now mean actual calendar time, not a row count.
  • Connection reuse + retries: HTTP requests share a pooled requests session with automatic retries on transient errors (429/500/502/503).
  • ScrapingError: raised (with a .what attribute) when kabutan.jp's page structure changes and a page can't be parsed.

Development

# Install dependencies
uv sync

# Run tests
uv run pytest

# Run integration tests (real HTTP)
uv run pytest -m integration

# Format code
uv run ruff format .

# Lint
uv run ruff check .

License

MIT

Metadata

Release files for pykabutan 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pykabutan 0.2.0
File Size Uploaded Provenance
pykabutan-0.2.0.tar.gz 435.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pykabutan 0.2.0
File Interpreter ABI Platform
pykabutan-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 457.2 kB

Release files / pykabutan-0.2.0.tar.gz

Download URL pykabutan-0.2.0.tar.gz
Size 435.8 kB
Tags Source
SHA-256 checksum
How to use checksums
496da5ee3e435b0b50600f48b45d450546d4e6cac0890eeb5911fa744aa2a4b1
BLAKE2b-256 checksum
How to use checksums
3227093b6490cb21ef643b6820941e6feab8fb525a57c89335ccd8a2bcf62205
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release files / pykabutan-0.2.0-py3-none-any.whl

Download URL pykabutan-0.2.0-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f9d0014092e9c96cf490e7f2dc45a9b3c114b2cd5e39f3946f37afc347eaa91
BLAKE2b-256 checksum
How to use checksums
9ab97eab4fb05eb0f437d46dd418421b704b47be46386f1cbf60a48a0e65a6c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Security for pykabutan 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page