Ticker
Stock ticker for kabutan.jp data.
Provides lazy-loaded access to stock information, price history, news, financials, and shareholder data.
Example
ticker = Ticker("7203") print(ticker.profile.name) # トヨタ自動車 df = ticker.history(period="30d")
profile
property
Stock profile information (lazy loaded, cached).
Returns:
| Type | Description |
|---|---|
Profile
|
Profile object with name, market, industry, stats, etc. |
Raises:
| Type | Description |
|---|---|
TickerNotFoundError
|
If the code doesn't exist on kabutan.jp. |
ScrapingError
|
If the page structure changed and can't be parsed. |
__init__(code)
Initialize ticker with stock code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
Stock code (e.g., "7203" for Toyota, "135A" for newer listings) |
required |
Note
No HTTP request is made until data is accessed (lazy loading).
financials()
Get financial statements from the finance page.
Returns:
| Type | Description |
|---|---|
dict[str, DataFrame]
|
Dict of DataFrames keyed by statement (present when kabutan |
dict[str, DataFrame]
|
publishes them): "annual", "interim", "quarterly", "cashflow", |
dict[str, DataFrame]
|
"profitability", "financial_position", "records". |
dict[str, DataFrame]
|
Money values are in 百万円 (millions of yen) as published. |
Raises:
| Type | Description |
|---|---|
ScrapingError
|
If no statement tables can be located. |
history(period='30d', interval='day', start=None, end=None)
Get price history (OHLC data).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
period
|
str | None
|
Calendar period back from today (e.g. "30d", "6mo", "1y"). Ignored if start is provided. |
'30d'
|
interval
|
str
|
Data interval — "day", "week", "month", "year" (or "1d", "1w", "1mo", "1y") |
'day'
|
start
|
str | None
|
Start date (YYYY-MM-DD) |
None
|
end
|
str | None
|
End date (YYYY-MM-DD) |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame indexed by ascending date with numeric columns: |
DataFrame
|
open, high, low, close, change, percent_change, volume. |
Raises:
| Type | Description |
|---|---|
ValueError
|
For an unknown interval or unparseable period. |
ScrapingError
|
If the price table can't be located/parsed. |
holders(period=0)
Get shareholder information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
period
|
int
|
Reporting period (0=latest, 1=previous, ...) |
0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: date, name, change, ratio_percent, shares. |
Raises:
| Type | Description |
|---|---|
ScrapingError
|
If the shareholders table can't be located. |
news(mode='earnings')
Get stock news.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
str
|
News type — "all", "material", "earnings", "disclosure" |
'earnings'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: datetime, news_type, title. |
DataFrame
|
Empty when the stock has no news for the mode. |
Raises:
| Type | Description |
|---|---|
ValueError
|
For an unknown mode. |
refresh()
Clear cached data to force a fresh fetch on next access.
similar_stocks()
Get similar stocks listed on the main page.
Returns:
| Type | Description |
|---|---|
list[Ticker]
|
List of Ticker objects (empty if the section is absent). |