Commit Graph

1809 Commits

Author SHA1 Message Date
ValueRaider 80e7cbda97 Merge pull request #2805 from dokson/fix/download-thread-safety
Make yf.download() reentrant by removing shared module globals
2026-05-14 22:14:29 +01:00
ValueRaider 3cfd9c0118 Merge pull request #2803 from dokson/feature/sector-market-scope
Allow region scoping for Sector and Industry (closes #2601)
2026-05-10 19:32:49 +01:00
Alessandro Colace a710ba8340 Make yf.download() reentrant by removing shared module globals
`download()` used module-level dicts in `yfinance.shared` (`_DFS`,
`_ERRORS`, `_TRACEBACKS`, `_ISINS`) as scratch space. Concurrent calls
trampled each other; the previous fix wrapped the whole call in
`shared._LOCK`, which silently serialized parallel downloads — hiding
the race instead of removing it, and defeating the parallelism users
reach for `download()` to get.

- Introduce `_DownloadCtx` per call holding `dfs/errors/tracebacks/isins`
  plus a fine-grained lock for thread workers.
- `_download_one`, `_download_one_threaded`, `_realign_dfs` take the ctx
  explicitly and write into it.
- Drop the call-wide `shared._LOCK.acquire()`; concurrent `download()`
  calls now actually run in parallel. The polling loop on the threaded
  path reads `len(ctx.dfs)` under the ctx lock.
- `PriceHistory` records soft errors (delisted, missing tz, repair
  failure) in `self._last_error` instead of `shared._ERRORS`; the
  download loop reads it after `Ticker.history()` returns.
- `yfinance.shared` is left in place for import-compat with code that
  may still import it, but yfinance no longer reads or writes it.
- Update existing test_multi to the new `_download_one(ctx, ...)`
  signature and add regression tests covering result separation,
  no-raise on concurrent calls, and a sentinel proving `shared._DFS`
  is no longer used as scratch space.
2026-05-09 18:47:53 +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
ValueRaider 570e02f7b0 Merge pull request #2801 from dokson/fix/market-region-validation
Fix #2784: validate Market region and stop returning misleading status
2026-05-09 16:05:16 +01: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
ValueRaider c8c3754ccd Merge pull request #2797 from ranaroussi/fix/unlisted-tkr-dividends-error
Fix dividends error on unlisted tickers
2026-05-05 22:17:21 +01:00
ValueRaider 7cd4735e0d Fix dividends error on unlisted tickers 2026-05-05 22:04:58 +01:00
ValueRaider a766e8f662 Merge pull request #2752 from ranaroussi/dependabot/github_actions/astral-sh/ruff-action-4.0.0
Bump astral-sh/ruff-action from 3.6.1 to 4.0.0
2026-04-30 21:12:02 +01:00
ValueRaider 75ed99686d Merge pull request #2754 from ranaroussi/dependabot/github_actions/zizmorcore/zizmor-action-0.5.3
Bump zizmorcore/zizmor-action from 0.5.2 to 0.5.3
2026-04-30 21:11:28 +01:00
ValueRaider 803893a419 Merge pull request #2753 from ranaroussi/dependabot/github_actions/actions/github-script-9.0.0
Bump actions/github-script from 8.0.0 to 9.0.0
2026-04-30 21:10:30 +01:00
ValueRaider 65b8b6ba19 Merge pull request #2792 from etbala/fix-tests
Fix Failing Tests
2026-04-30 21:09:21 +01:00
ValueRaider 2eb70a2ca9 Merge pull request #2794 from Jaypatel1511/fix/chart-none-guard
Fix TypeError when data['chart'] is None in history.py (#2670)
2026-04-30 21:07:38 +01:00
etbala 866db49d34 fix failing tests 2026-04-29 18:04:01 -05:00
Jaypatel1511 212a5eaf3a Move chart-None regression test into test_prices.py (#2670)
Use yf.Ticker().history() convention consistent with the rest of test_prices.py.
Remove standalone test_chart_none_guard.py file.
2026-04-29 17:06:37 -05:00
Jaypatel1511 2378a5fc09 Fix NoneType crash when data['chart'] is None (issue #2670)
Guard both chart-error and chart-result checks against data['chart']
being None, which previously raised TypeError instead of the expected
YFPricesMissingError.

- history.py L270: add 'data["chart"]' truthiness check before accessing ['error']
- history.py L274: add 'not data["chart"]' short-circuit before accessing ['result']
- Add regression test covering chart=None, result=None, missing key, and error payload
2026-04-29 16:57:17 -05:00
ValueRaider 9d989d89a6 Merge pull request #2761 from etbala/login
Add Auth class for Logging In
2026-04-29 21:09:56 +01:00
Ethan Balakumar 9a2999e340 Add Auth class for login 2026-04-27 21:14:25 -05:00
ValueRaider a497d4f5a2 Merge pull request #2789 from gabrielchangamire-arch/fix-market-api-docs-reference-link
Fix Market API docs reference link
2026-04-27 19:50:18 +01:00
Gabriel Changamire 38ad379aa4 Fix Market API docs reference link 2026-04-26 13:57:44 -07:00
ValueRaider af8faa0ced Merge pull request #2780 from gottostartsomewhere/fix/dts-same-interval-1mo-year
Fix: _dts_in_same_interval("1mo") ignored year
2026-04-25 17:00:49 +01:00
ValueRaider dd7862b2cc Merge pull request #2779 from gottostartsomewhere/chore/fix-typos-providing-response
chore: fix typos (prividing -> providing, Reponse -> Response)
2026-04-25 16:59:45 +01:00
ValueRaider b70b589c71 Merge pull request #2778 from a-drenaline/noneType_protections
Adding try block for added protection to "meta" data
2026-04-25 16:58:52 +01:00
gottostartsomewhere 040e617041 Fix: _dts_in_same_interval("1mo") ignored year, treating same-month in different years as the same interval
The "1mo" branch compared only `dt1.month == dt2.month`, so e.g.
(2024-12-15, 2025-12-15) returned True. The "3mo" branch already
handles year differences via `year_diff`; mirror that by also
requiring `dt1.year == dt2.year`.

Added a test (`test_same_month_different_year`) that fails on the
old logic and passes on the fix. All existing tests still pass.
2026-04-24 11:24:16 +05:30
gottostartsomewhere 093ae6f864 chore: fix typos in warning message and docstring
- calendars.py: "prividing" -> "providing" (3 user-visible UserWarning messages)
- data.py: "Reponse" -> "Response" (docstring)
2026-04-24 10:32:12 +05:30
adrenaline fc53661e9a adding try block for added protection 2026-04-23 18:47:55 -05:00
ValueRaider 2d60fc5516 Merge pull request #2777 from ranaroussi/feature/history-metadata-repair
Add 'repair' to get_history_metadata()
2026-04-23 20:50:11 +01:00
ValueRaider 9b79ef76bf Add 'repair' to get_history_metadata() 2026-04-23 20:47:45 +01:00
ValueRaider 4c544ca200 Dependabot: disable no-reason version updates 2026-04-22 20:11:36 +01:00
ValueRaider a17e8b19a6 Version 1.3.0 2026-04-16 20:49:11 +01:00
ValueRaider d6afeebc35 Merge pull request #2757 from ranaroussi/dev
sync dev -> main
2026-04-16 20:48:40 +01:00
ValueRaider b23433f826 Fix 'Ticker.dividends' type to be Series - fixes for tests 2026-04-16 20:46:18 +01:00
ValueRaider 6b01fb4fe9 Merge pull request #2749 from etbala/etfquery
Add ETFQuery
2026-04-16 20:23:14 +01:00
ValueRaider 20b675c02e Merge pull request #2756 from ranaroussi/fix/dividends-type
Fix 'Ticker.dividends' type to be Series
2026-04-16 20:19:49 +01:00
ValueRaider 2dfd727c8e Fix 'Ticker.dividends' type to be Series 2026-04-16 20:17:40 +01:00
ValueRaider fbceea958d Merge pull request #2755 from ranaroussi/main
sync main -> dev
2026-04-16 20:08:09 +01:00
dependabot[bot] 6cebd2346a Bump zizmorcore/zizmor-action from 0.5.2 to 0.5.3
Bumps [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) from 0.5.2 to 0.5.3.
- [Release notes](https://github.com/zizmorcore/zizmor-action/releases)
- [Commits](https://github.com/zizmorcore/zizmor-action/compare/71321a20a9ded102f6e9ce5718a2fcec2c4f70d8...b1d7e1fb5de872772f31590499237e7cce841e8e)

---
updated-dependencies:
- dependency-name: zizmorcore/zizmor-action
  dependency-version: 0.5.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-16 11:25:32 +00:00
dependabot[bot] a07bf327d6 Bump actions/github-script from 8.0.0 to 9.0.0
Bumps [actions/github-script](https://github.com/actions/github-script) from 8.0.0 to 9.0.0.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/ed597411d8f924073f98dfc5c65a23a2325f34cd...3a2844b7e9c422d3c10d287c895573f7108da1b3)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: 9.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-16 11:25:29 +00:00
dependabot[bot] cb9884c283 Bump astral-sh/ruff-action from 3.6.1 to 4.0.0
Bumps [astral-sh/ruff-action](https://github.com/astral-sh/ruff-action) from 3.6.1 to 4.0.0.
- [Release notes](https://github.com/astral-sh/ruff-action/releases)
- [Commits](https://github.com/astral-sh/ruff-action/compare/4919ec5cf1f49eff0871dbcea0da843445b837e6...0ce1b0bf8b818ef400413f810f8a11cdbda0034b)

---
updated-dependencies:
- dependency-name: astral-sh/ruff-action
  dependency-version: 4.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-16 11:25:26 +00:00
Ethan Balakumar 6a1e9d1e86 Add ETFQuery 2026-04-14 23:49:39 -05:00
ValueRaider b1899b0e74 Merge pull request #2742 from etbala/valuation_measures
Add Valuation Measures Table from Statistics Page
2026-04-14 23:57:40 +01:00
Ethan Balakumar eac7f2ffa9 Add valuation measures 2026-04-13 20:16:16 -05:00
ValueRaider b1ed233f61 Version 1.2.2 2026-04-13 18:59:59 +01:00
ValueRaider eef8a3fd84 Merge pull request #2747 from ranaroussi/dev
sync dev -> main
2026-04-13 18:56:09 +01:00
ValueRaider 1aac9aea29 Merge pull request #2739 from etbala/forecast-currency
Add Currency to Analysis Data
2026-04-12 14:23:00 +01:00
ValueRaider 88072cf835 Version 1.2.1 2026-04-07 19:26:13 +01:00
ValueRaider 8ba755a11f Merge pull request #2743 from ranaroussi/fix/curl_cffi_cve
Force curl_cffi>=0.15, because CVE
2026-04-07 19:21:55 +01:00
ValueRaider 3b45e37f3e Force curl_cffi>=0.15, because CVE 2026-04-07 19:19:34 +01:00
ValueRaider 621cc07a86 Merge pull request #2735 from ranaroussi/supply-chain-hardening
Github actions: supply-chain hardening
2026-04-07 19:14:29 +01:00
Ethan Balakumar aeaa0f7ce3 Add currency column to analysis tables 2026-04-06 16:22:45 -05:00