Configuration
Settings are global and apply for the life of the process.
Settings
config
jfinance.configSettings object, the same one yfinance uses.
| Setting | Type | Default | Description |
|---|---|---|---|
config.locale.lang | str | "en-US" | "ja-JP" returns company and industry names in Japanese |
config.locale.region | str | "US" | Region |
config.network.proxy | str | None | HTTP proxy |
config.network.retries | int | 0 | Retries on a failed request |
config.debug.logging | bool | False | Log requests and responses |
config.debug.hide_exceptions | bool | True | Swallow exceptions inside attribute access |
jf.config.locale.lang = "ja-JP"
jf.Ticker("7203.T").info["shortName"] # 'トヨタ自動車株式会社'Values with no English original — business descriptions, and the names of officers and shareholders — are returned in Japanese under either setting.
set_base_url
jfinance.set_base_url(url) -> None
jfinance.get_base_url() -> strPoints the client at a different server. The default is jfinance.DEFAULT_BASE_URL, which is
https://query1.jfnc.org.
Parameters
| Name | Type | Description |
|---|---|---|
url | str | Base URL, as in "http://localhost:8080" |
jf.set_base_url("http://localhost:8080")enable_debug_mode
jfinance.enable_debug_mode() -> NoneLogs every request and response. Equivalent to setting config.debug.logging.
Exceptions
Exception names are kept as they are in yfinance, YF prefix included, so that code written
against yfinance runs unchanged.
| Exception | Base | Raised when |
|---|---|---|
YFException | Exception | Base class for the rest |
YFRateLimitError | YFException | The rate limit was hit (HTTP 429). Retry after the seconds given in the Retry-After header |
YFDataException | YFException | The response is not in the expected shape |
YFTickerMissingError | YFException | The symbol does not exist |
YFNotImplementedError | NotImplementedError | The method exists for compatibility but has no EDINET source |
from jfinance.exceptions import YFRateLimitError
try:
t.info
except YFRateLimitError:
...requests.HTTPError propagates for other HTTP errors. Rate limits are described under
Terms of use.
Notices
jfinance.NOTICE_CORRECTIONSA string stating that amendments to filings past their EDINET public inspection period cannot
be retrieved and may therefore not be reflected. The same text is returned in the
X-JF-Notice header of every HTTP response. See
Data notes.