Metadata-Version: 2.4
Name: edinetdb
Version: 0.1.0
Summary: Command-line interface for EDINET DB — Japanese listed company financial data API.
Project-URL: Homepage, https://edinetdb.jp
Project-URL: Documentation, https://edinetdb.jp/docs/api-reference
Project-URL: Repository, https://github.com/Cabocia/edinet-db
Project-URL: Issues, https://github.com/Cabocia/edinet-db/issues
Project-URL: Changelog, https://github.com/Cabocia/edinet-db/releases
Author-email: "Cabocia Inc." <edinetdb@cabocia.jp>
License: Apache-2.0
License-File: LICENSE
Keywords: cli,edinet,financial-data,japan,securities-report,xbrl
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: rich>=13.7
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-httpx>=0.30; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Description-Content-Type: text/markdown

# edinetdb — CLI for the EDINET DB API

Command-line interface for [EDINET DB](https://edinetdb.jp), a financial-data API
covering the ~3,850 Japanese listed companies filed through the FSA's EDINET
system (Electronic Disclosure for Investors' NETwork).

```bash
pip install edinetdb
edinetdb auth login    # paste your key from https://edinetdb.jp/developers
edinetdb search toyota
edinetdb financials E02144 --years 5
edinetdb screener -w 'roe:gte=15' -w 'equity_ratio:gte=50'
```

## Install

```bash
pip install edinetdb
```

Python 3.10+ is required. The only runtime dependencies are
[`typer`](https://typer.tiangolo.com/), [`httpx`](https://www.python-httpx.org/),
and [`rich`](https://rich.readthedocs.io/).

## Authenticate

All endpoints except `status` and `search` require an API key. Get a free key
at <https://edinetdb.jp/developers> and store it:

```bash
edinetdb auth login
# API key: ****************
# Saved credentials to /Users/you/.config/edinetdb/credentials
```

Alternatively, set the environment variable:

```bash
export EDINETDB_API_KEY=your_key_here
```

Resolution order: `--api-key` flag → `EDINETDB_API_KEY` env → stored credentials.

## Commands

| Command | What it does |
|---|---|
| `auth login / logout / whoami` | Manage stored credentials |
| `search <query>` | Find companies by name, EDINET code, or securities code |
| `company <E-code>` | Company details + latest financials |
| `financials <E-code>` | Financial time series (annual / quarterly) |
| `ratios <E-code>` | ROE, ROA, margins, CAGR, valuation ratios |
| `analysis <E-code>` | AI-generated health score + benchmark counts |
| `text-blocks <E-code>` | Business description, risks, MD&A |
| `text-analysis <E-code>` | Structured text (12 types: risks, dividends, governance, …) |
| `expenses <E-code>` | SGA expense breakdown (14 categories × 4 groups) |
| `segments <E-code>` | Segment-level revenue, OI, assets |
| `cross-shareholdings <E-code>` | Policy-holding securities detail |
| `real-estate <E-code>` | Real-estate note + land-price benchmarks |
| `facilities <E-code>` | Facility-level properties with book value |
| `earnings <E-code>` | TDNet earnings disclosure history |
| `calendar` | JPX earnings release calendar |
| `rankings <metric>` | Top companies by a financial metric |
| `screener` | 106-metric multi-condition screener |
| `shareholders get/search/history/activists` | Large shareholding reports |
| `industries list/get` | Industry averages and company listings |
| `watchlist list/add/remove` | Personal watchlist |
| `status` | API health + data freshness |

Run `edinetdb <command> --help` for per-command flags.

## Output

Every command supports `--format {json,table,csv}` (`-f`). Table is the default
for flat list results; company details default to JSON.

```bash
edinetdb rankings roe --limit 10 --format csv > roe_top10.csv
edinetdb financials E02144 --years 5 --format json | jq '.[].revenue'
```

Exit codes map to the error class:

| Code | Meaning |
|---|---|
| `0` | Success |
| `1` | Unclassified error |
| `2` | Authentication error (401/403) |
| `3` | Rate limit exceeded (429) |
| `4` | Not found (404) |
| `5` | Bad request / validation (400) |
| `6` | Server error (5xx) |

## Configuration

| Variable | Default |
|---|---|
| `EDINETDB_API_KEY` | (not set) |
| `EDINETDB_BASE_URL` | `https://edinetdb.jp/v1` |
| `EDINETDB_PROFILE` | `default` |
| `XDG_CONFIG_HOME` | `~/.config` (credentials stored in `$XDG_CONFIG_HOME/edinetdb/credentials`) |

Named profiles allow multiple keys (e.g. personal + team):

```bash
edinetdb auth login --profile team
edinetdb --profile team search softbank     # requires per-command flag, TBD
EDINETDB_PROFILE=team edinetdb search softbank
```

## Links

- API documentation & live Redoc UI: <https://edinetdb.jp/docs/api-reference>
- OpenAPI spec: <https://edinetdb.jp/v1/openapi.yaml>
- Get an API key: <https://edinetdb.jp/developers>
- Issues: <https://github.com/Cabocia/edinet-db/issues>

## License

Apache 2.0 © 2026 Cabocia Inc.
