Commit Graph

54 Commits

Author SHA1 Message Date
ValueRaider 9ca1c55b12 Merge pull request #2802 from dokson/feature/optional-curl-cffi
Make curl_cffi optional with fallback to requests (closes #2692)
2026-05-20 21:34:45 +01:00
cloop-agent[bot] 628a417904 Merge pull request #2827 from ranaroussi/main
chore: merge main back into dev
2026-05-20 21:34:04 +01:00
Alessandro Colace 5d10c0c48e Make curl_cffi optional with graceful fallback to requests
Some platforms (e.g. older macOS, exotic Linux distros) cannot build the
curl-impersonate binary that backs curl_cffi, leaving yfinance unusable.
This change keeps curl_cffi as the preferred and default backend but no
longer hard-requires it at runtime.

- New `yfinance/_http.py` abstracts the HTTP backend. If `curl_cffi` is
  importable it is used as before; otherwise yfinance falls back to plain
  `requests` with a realistic Chrome User-Agent and logs a warning so the
  downgrade is explicit.
- `data.py`, `base.py`, `multi.py`, `scrapers/history.py` build sessions
  via `_http.new_session()`.
- Scrapers and screener catch `_http.HTTPError` instead of importing
  `curl_cffi.requests.exceptions.HTTPError` directly.
- `is_supported_session()` accepts either backend; `cookie_jar()` papers
  over the small API difference between curl_cffi (`cookies.jar`) and
  requests (`cookies` is itself the jar).
- New Advanced > Installation page documents the curl_cffi-free install
  recipe; README links to it just under the install instruction.

Empirically verified that plain `requests` with a Chrome UA does not hit
the 401-after-~10-requests issue that the earlier `curl_adapter` approach
ran into; 15/15 quoteSummary calls succeed without rate limiting.

`setup.py` is unchanged -- `curl_cffi>=0.15` remains the default install
requirement (CVE-pinned). The fallback only activates when the import
fails at runtime; moving curl_cffi to extras_require can be a follow-up
decision for the maintainer.
2026-05-20 14:17:02 +02:00
Alessandro Colace 97bdabe9dc Allow lang and region scoping for Ticker via YfConfig
Yahoo's v7 (`/v7/quote`) and v10 (`/quoteSummary`) endpoints accept
`lang` and `region` parameters and return localized fields (`longName`,
`shortName`, ...) when the ticker has been translated for that locale —
e.g. 1810.HK returns '小米集團-W' under `lang=zh-Hant-HK`, GAZP.ME
returns 'Публичное акционерное общество Газпром' under `lang=ru-RU`.
Previously these params were not exposed and `Ticker.info["longName"]`
always came back in U.S. English.

Surfaced as global config (`YfConfig.locale.lang` / `YfConfig.locale.region`)
rather than per-Ticker constructor params: a typical user wants the
same locale for every call in their session, and the config approach
also covers the v10 calendar/earnings endpoint in `_fetch_history_metadata`
without threading kwargs through three layers.

- Add `YfConfig.locale.lang` (default `"en-US"`) and `YfConfig.locale.region`
  (default `"US"`).
- `Quote._fetch` (v10/quoteSummary) and `Quote._fetch_additional_info`
  (v7/quote) read the locale from `YfConfig` on every call.
- `_fetch_history_metadata` (v1 calendar) reads the same locale, replacing
  a hardcoded `lang=en-US, region=US`.
- The `v8/chart` endpoint ignores `lang` server-side, so we don't forward
  there — would only generate noise.
- Verified live for Latin/diacritics (it-IT), CJK (zh-Hant-HK, ja-JP),
  Cyrillic (ru-RU); Apple under ja-JP correctly stays "Apple Inc." since
  it's a U.S. listing.

Closes #2582
2026-05-15 17:13:22 +02:00
Alessandro Colace ac1a7f65ca Allow region scoping for Sector and Industry
Yahoo's `/v1/finance/sectors/{key}` and `/industries/{key}` endpoints accept
an ISO 3166-1 alpha-2 `region` query parameter and return regional top
companies/ETFs/funds accordingly. The Domain base class hard-coded `region=US`,
so `Sector("technology").top_companies` always returned U.S. names regardless
of the user's interest.

- Add `region: str = "US"` to `Domain.__init__` and propagate through
  `Sector` and `Industry`.
- Normalize input via `.strip().upper()` so "us", " GB ", and "Fr" all work.
- Use `self._region` in the request params.
- Document and test the behavior.

Closes #2601
2026-05-09 17:55:05 +02:00
Alessandro Colace 90c267103a Validate Market region and stop returning misleading status data
Yahoo's markettime endpoint silently ignores the `market` parameter and
always returns U.S. data, so `Market("EUROPE").status` previously returned
U.S. status while pretending to be European. The summary endpoint does
honor the parameter and is unaffected.

- Introduce `MarketRegion(str, Enum)` as the single source of truth for
  the supported region values, exposed as `yfinance.MarketRegion`.
- Validate `Market(...)` input against the enum and raise `ValueError`
  on unknown regions.
- Detect the markettime mismatch: when a non-`US` region is requested
  but the response id is `us`, set `status` to `None` and log a warning
  rather than returning misleading data.
- Document the markettime limitation and add tests covering validation
  and the EUROPE/US fetch behavior.

Closes #2784
2026-05-09 13:33:50 +02:00
Ethan Balakumar 9a2999e340 Add Auth class for login 2026-04-27 21:14:25 -05:00
Gabriel Changamire 38ad379aa4 Fix Market API docs reference link 2026-04-26 13:57:44 -07:00
ValueRaider 6b01fb4fe9 Merge pull request #2749 from etbala/etfquery
Add ETFQuery
2026-04-16 20:23:14 +01:00
Ethan Balakumar 6a1e9d1e86 Add ETFQuery 2026-04-14 23:49:39 -05:00
ValueRaider eef8a3fd84 Merge pull request #2747 from ranaroussi/dev
sync dev -> main
2026-04-13 18:56:09 +01:00
tsinglua 7c41c76915 chore: remove repetitive word in multi_level_columns.rst
Signed-off-by: tsinglua <tsinglua@outlook.com>
2026-03-17 19:27:45 +08:00
Rahul Shah 3df4339f74 chore: minor doc fixes
This change fixes some stray documentation issues. The first fix addresses a broken link within the  file, while the second removes a line saying to go into the  directory before running the sphinx command to build the documentation.
2026-03-11 21:26:01 -05:00
karthickkrishnasaisha 255b448a64 Docs: clarify debug logging config and deprecate enable_debug_mode
Issue template: use yf.config.debug.logging instead of enable_debug_mode
2026-02-16 16:03:40 -08:00
ValueRaider 27cb8aa2a2 Docs for capital-gains repair; Fix warnings in price-repair 2026-01-22 19:36:37 +00:00
ValueRaider d1c69e1d38 Merge pull request #2637 from ranaroussi/dev
sync dev -> main
2025-12-22 18:06:49 +00:00
ValueRaider 4f38ecfea0 Redesign YfConfig + small fixes
Fixes:
- earnings_dates caching
- _resample on period=ytd

New deprecations:
- yf.set_config()
- move enable_debug_mode() to YfConfig

Complete deprecations:
- proxy arguments
- download(auto_adjust)

Small test fixes
2025-12-20 16:23:20 +00:00
ValueRaider 39c2f76c1a Merge pull request #2615 from ianmihura/feature/earnings-calendar
Feature: Earning Calendar (& other calendars)
2025-12-10 21:52:45 +00:00
Ian Mihura 428919b701 earning calendar and other calendars 2025-12-10 17:55:42 +01:00
aivibe ec5f1c2470 Add optional retry mechanism for transient network errors 2025-12-02 06:23:26 +07:00
ValueRaider 8cca819fd6 Merge pull request #2597 from ranaroussi/dev
dev -> main
2025-09-17 12:16:50 +01:00
ValueRaider bc67252d4b Screener: EquityQuery add industry field
And update docs to support
- fix duplication of class attributes in methods block
- repurpose 'SECTOR_INDUSTY_MAPPING' to back new EquityQuery field 'industry'
2025-09-17 12:02:43 +01:00
Robert Tidball bc40e84461 Update index.rst
Also removing duplicate markets in table of contents tree so that the navbar on the left does not contain duplicates
2025-08-21 14:27:10 +10:00
Robert Tidball ead4ed7ee7 Update index.rst - duplicate market reference
The market reference in the documentation (https://ranaroussi.github.io/yfinance/reference/api/yfinance.Market.html#) is duplicated.
2025-08-20 17:10:44 +10:00
ValueRaider b8ab067caa Add price repair to doc 2025-06-25 21:10:21 +01:00
ValueRaider 4ac5cd87b3 Docs: simplify dev guide 2025-05-13 20:48:33 +01:00
ValueRaider 68b7c16162 Merge pull request #2487 from ranaroussi/feature/deprecate-requests-cache
Deprecate using requests_cache etc, only curl_cffi works
2025-05-11 15:16:56 +01:00
ValueRaider 890026c862 Change docs trigger to main ; Improve contribute docs 2025-05-11 12:14:24 +01:00
ValueRaider 22e4219ec7 Remove 'Smarter Scraping' from docs 2025-05-11 11:07:53 +01:00
ValueRaider 2608f3660c Merge pull request #2445 from R5dan/contributing
Fix contributing.md
2025-05-05 14:19:47 +01:00
R5dan e614e6b8ff Fix contributing.md 2025-05-04 19:39:24 +01:00
Dhruvan Gnanadhandayuthapani fc5d29558b Add WebSocket support 2025-04-27 20:39:20 +02:00
ValueRaider d64777c6e7 Add new config to RST docs 2025-04-23 19:15:35 +01:00
ValueRaider b1bb75113c Merge pull request #2364 from dhruvan2006/feature/lookup
Feature: Ticker lookups
2025-03-30 21:26:57 +01:00
Dhruvan Gnanadhandayuthapani 8908724f3c Add Lookup module documentation and examples 2025-03-23 15:06:17 +01:00
ValueRaider 21a80ec719 Merge pull request #2372 from ranaroussi/dev
sync dev -> main
2025-03-20 20:27:45 +00:00
Jan Melen 102e266eab Direct TTM Financial Data Retrieval Feature
- Fetches the TTM values for cash flow and income statement from Yahoo.
- Added tests test_ttm_income_statement and test_ttm_cash_flow.
- When trailing 12 months income statement is fetched Yahoo returns
  income statement for last 5 quarters out of which only the latest is
  fully populated. Rest have NaN values and can be ignored.
- get_financials_time_series when called with timescale trailing removes
  from data frame the extra columns.
- Added quarterly_income_stmt to financials documentation
- Added ttm_income_stmt to financials documentation
- Added quarterly_cashflow to financials documentation
- Added ttm_cashflow to financials documentation
2025-02-27 18:33:32 +02:00
Ran Aroussi eeb2d483d3 Update conf.py 2025-02-22 22:21:27 +00:00
Ran Aroussi 9a6f147de5 Update conf.py 2025-02-22 22:17:21 +00:00
Ran Aroussi 7be3069b6f Added docs logo 2025-02-22 22:16:13 +00:00
Ran Aroussi 7709bc6ae3 yfinance "logo" 2025-02-22 19:06:11 +00:00
Ran Aroussi 9b33910a98 yfinance "logo" 2025-02-22 18:57:12 +00:00
ValueRaider 14c6d05854 Merge pull request #2253 from dhruvan2006/fix/doc-see-also-links
Fix: Broken "See also" links in documentation
2025-02-01 13:31:23 +00:00
R5dan e09f77eb06 Fix 2025-01-31 22:45:08 +00:00
R5dan 7db798e900 Fix docs 2025-01-31 22:45:08 +00:00
Dhruvan Gnanadhandayuthapani b729bcb1df Fix broken 'See also' links in docs 2025-01-31 15:12:36 +01:00
ValueRaider 00a44a8132 Fix dead links in docs API index.rst 2025-01-18 16:28:23 +00:00
ValueRaider fed35b175f Fix typo in screener RST doc file 2025-01-18 16:08:48 +00:00
ValueRaider dee9a55e43 Simplify Screener & improve its docs
- screener now just a function, not a class
- add 'FundQuery' query class
- add 'IS-IN' operator
- fix 'GTE' & 'LTE' operators
- more exchanges
Predefined tweaks:
- convert predefined query strings to use EquityQuery (better docs)
- send predefined queries to Yahoo's predefined endpoint
- expose PREDEFINED_SCREENER_QUERIES via __init__.py
- screen() argument defaults don't apply to predefineds
2025-01-17 22:15:18 +00:00
Dhruvan Gnanadhandayuthapani e3aae8a8ba Expand Search test suite 2025-01-03 00:35:53 +01:00