Compare commits

..

7 Commits
dev ... main

Author SHA1 Message Date
ValueRaider
fa755363dc Version 1.1.0 2026-01-24 16:01:54 +00:00
ValueRaider
7874a45e3b Merge pull request #2682 from ranaroussi/dev
sync dev -> main
2026-01-24 15:57:45 +00:00
ValueRaider
9e6d00c674 Merge pull request #2683 from ctasada/ctasada/issue-2679
Upgrade to Pandas 3.0 (Fixes #2679)
2026-01-24 12:08:09 +00:00
Carlos-Tasada
04cd07eb6a Timestamp.now(tz) already exists in Pandas since 9 years ago, so there's no need to upgrade Pandas right now.
Keeping the change removes the deprecation warning, achieving the goal of this PR
2026-01-23 14:09:03 +01:00
Carlos-Tasada
25bf12cb92 Upgrade to Pandas 3.0 (Fixes #2679)
Pandas 3.0 introduced many changes. One of them is a noisy deprecation warning `Pandas4Warning: Timestamp.utcnow is deprecated and will be removed in a future version. Use Timestamp.now('UTC') instead.`

This PR upgrades YFinance to use the latest Pandas 3.0.0 version, removing the warning
2026-01-23 08:44:47 +01:00
ValueRaider
947cd4420c Merge pull request #2671 from sd416/main
Add GitHub Actions to Dependabot configuration
2026-01-20 19:18:43 +00:00
sd416
fd3965ad92 Add GitHub Actions to Dependabot configuration and updating actions
Add GitHub Actions to Dependabot configuration

Add GitHub Actions to Dependabot configuration

Bump actions/checkout from 2 to 6

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Bump actions/setup-python from 4 to 6

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Bump actions/github-script from 7 to 8

Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 8.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v8)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-20 05:04:51 +00:00
16 changed files with 60 additions and 99 deletions

View File

@@ -1,7 +1,13 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

View File

@@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check if issue uses custom template
uses: actions/github-script@v7
uses: actions/github-script@v8
with:
script: |
const issue = context.payload.issue;

View File

@@ -13,10 +13,10 @@ jobs:
steps:
- name: Check out the repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.x'

View File

@@ -13,10 +13,10 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
- name: Install dependencies
run: |

View File

@@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install dependencies

View File

@@ -9,7 +9,7 @@ jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: astral-sh/ruff-action@v3
with:
args: check --ignore E702 . --exclude yfinance/pricing_pb2.py

View File

@@ -1,6 +1,19 @@
Change Log
===========
1.1.0
-----
Features:
- New price repair: capital gains double-counting #2667
Fixes:
- Fix Saudi Arabia MIC Code #2665 @salsugair
- Add config to __all__ #2673 @kbluck
- Fix Python 3.9 compatibility regression in calendars.py #2674 @orionnelson
- Improve stock-split repair false-positives #2668
- Docs for capital-gains repair; Fix warnings in price-repair 27cb8aa
Already in main:
- Upgrade to Pandas 3.0 (Fixes #2679) #2683
1.0
---
yfinance been stable a long time now, time to grow up

View File

@@ -1,5 +1,5 @@
{% set name = "yfinance" %}
{% set version = "1.0" %}
{% set version = "1.1.0" %}
package:
name: "{{ name|lower }}"

View File

@@ -123,7 +123,7 @@ class TestPriceRepair(unittest.TestCase):
tkrs = ["BHP.AX", "IMP.JO", "BP.L", "PNL.L", "INTC"]
dt_now = _pd.Timestamp.utcnow()
dt_now = _pd.Timestamp.now('UTC')
td_60d = _dt.timedelta(days=60)
# Round time for 'requests_cache' reuse

View File

@@ -69,7 +69,7 @@ class TestPriceHistory(unittest.TestCase):
dat = yf.Ticker(tkr, session=self.session)
tz = dat._get_ticker_tz(timeout=None)
dt_utc = _pd.Timestamp.utcnow()
dt_utc = _pd.Timestamp.now('UTC')
dt = dt_utc.astimezone(_tz.timezone(tz))
start_d = dt.date() - _dt.timedelta(days=7)
df = dat.history(start=start_d, interval="1h")
@@ -89,7 +89,7 @@ class TestPriceHistory(unittest.TestCase):
dat = yf.Ticker(tkr, session=self.session)
tz = dat._get_ticker_tz(timeout=None)
dt_utc = _pd.Timestamp.utcnow()
dt_utc = _pd.Timestamp.now('UTC')
dt = dt_utc.astimezone(_tz.timezone(tz))
if dt.time() < _dt.time(17, 0):
continue

View File

@@ -480,7 +480,7 @@ class TickerBase:
# Process dates
tz = self._get_ticker_tz(timeout=10)
dt_now = pd.Timestamp.utcnow().tz_convert(tz)
dt_now = pd.Timestamp.now('UTC').tz_convert(tz)
if start is not None:
start = utils._parse_user_dt(start, tz)
if end is not None:

View File

@@ -399,10 +399,9 @@ def merge_two_level_dicts(dict1, dict2):
EQUITY_SCREENER_EQ_MAP = {
"exchange": {
'ae': {'DFM'},
'ar': {'BUE'},
'at': {'VIE'},
'au': {'ASX', 'CXA'},
'au': {'ASX'},
'be': {'BRU'},
'br': {'SAO'},
'ca': {'CNQ', 'NEO', 'TOR', 'VAN'},
@@ -411,14 +410,14 @@ EQUITY_SCREENER_EQ_MAP = {
'cn': {'SHH', 'SHZ'},
'co': {'BVC'},
'cz': {'PRA'},
'de': {'BER', 'DUS', 'EUX', 'FRA', 'HAM', 'HAN', 'GER', 'MUN', 'STU'},
'de': {'BER', 'DUS', 'FRA', 'HAM', 'GER', 'MUN', 'STU'},
'dk': {'CPH'},
'ee': {'TAL'},
'eg': {'CAI'},
'es': {'MAD', 'MCE'},
'es': {'MCE'},
'fi': {'HEL'},
'fr': {'ENX', 'PAR'},
'gb': {'AQS', 'CXE', 'IOB', 'LSE'},
'fr': {'PAR'},
'gb': {'AQS', 'IOB', 'LSE'},
'gr': {'ATH'},
'hk': {'HKG'},
'hu': {'BUD'},
@@ -427,36 +426,37 @@ EQUITY_SCREENER_EQ_MAP = {
'il': {'TLV'},
'in': {'BSE', 'NSI'},
'is': {'ICE'},
'it': {'MDD', 'MIL', 'TLO'},
'jp': {'FKA', 'JPX', 'OSA', 'SAP'},
'it': {'MIL'},
'jp': {'FKA', 'JPX', 'SAP'},
'kr': {'KOE', 'KSC'},
'kw': {'KUW'},
'lk': {'CSE'},
'lk': {},
'lt': {'LIT'},
'lv': {'RIS'},
'mx': {'MEX'},
'my': {'KLS'},
'nl': {'AMS', 'DXE'},
'nl': {'AMS'},
'no': {'OSL'},
'nz': {'NZE'},
'pe': {},
'ph': {'PHP', 'PHS'},
'pk': {'KAR'},
'pk': {},
'pl': {'WSE'},
'pt': {'LIS'},
'qa': {'DOH'},
'ro': {'BVB'},
'ru': {'MCX'},
'ru': {},
'sa': {'SAU'},
'se': {'STO'},
'sg': {'SES'},
'sr': {},
'sw': {'EBS'},
'th': {'SET'},
'tr': {'IST'},
'tw': {'TAI', 'TWO'},
'us': {'ASE', 'BTS', 'CXI', 'NAE', 'NCM', 'NGM', 'NMS', 'NYQ', 'OEM', 'OQB', 'OQX', 'PCX', 'PNK', 'YHD'},
'us': {'ASE', 'BTS', 'CXI', 'NCM', 'NGM', 'NMS', 'NYQ', 'OEM', 'OQB', 'OQX', 'PCX', 'PNK', 'YHD'},
've': {'CCS'},
'vn': {'VSE'},
'vn': {},
'za': {'JNB'}
},
"sector": {
@@ -576,65 +576,7 @@ ordered_keys = ['region'] + [k for k in EQUITY_SCREENER_EQ_MAP.keys() if k != 'r
EQUITY_SCREENER_EQ_MAP = {k:EQUITY_SCREENER_EQ_MAP[k] for k in ordered_keys}
FUND_SCREENER_EQ_MAP = {
"exchange": {
'ae': {'DFM'},
'ar': {'BUE'},
'at': {'VIE'},
'au': {'ASX','CXA'},
'be': {'BRU'},
'br': {'SAO'},
'ca': {'CNQ','NEO','TOR','VAN'},
'ch': {'EBS'},
'cl': {'SGO'},
'co': {'BVC'},
'cn': {'SHH','SHZ'},
'cz': {'PRA'},
'de': {'BER','DUS','EUX','FRA','GER','HAM','HAN','MUN','STU',},
'dk': {'CPH'},
'ee': {'TAL'},
'eg': {'CAI'},
'es': {'BAR','MAD','MCE'},
'fi': {'HEL'},
'fr': {'ENX','PAR'},
'gb': {'CXE','IOB','LSE'},
'gr': {'ATH'},
'hk': {'HKG'},
'hu': {'BUD'},
'id': {'JKT'},
'ie': {'ISE'},
'il': {'TLV'},
'in': {'BSE','NSI'},
'is': {'ICE'},
'it': {'MIL'},
'jp': {'FKA','JPX','OSA','SAP'},
'kr': {'KOE','KSC'},
'kw': {'KUW'},
'lk': {'CSE'},
'lt': {'LIT'},
'lv': {'RIS'},
'mx': {'MEX'},
'my': {'KLS'},
'nl': {'AMS'},
'no': {'OSL'},
'nz': {'NZE'},
'pe': {''},
'ph': {'PHP', 'PHS'},
'pk': {'KAR'},
'pl': {'WSE'},
'pt': {'LIS'},
'qa': {'DOH'},
'ro': {'BVB'},
'ru': {'MCX'},
'sa': {'SAU'},
'se': {'STO'},
'sg': {'SES'},
'sr': {''},
'th': {'SET'},
'tr': {'IST'},
'tw': {'TAI','TWO'},
'us': {'ASE','NAS','NCM','NGM','NMS','NYQ','OEM','OGM','OQB','PNK','WCB',},
've': {'CCS'},
'vn': {'VSE'},
'za': {'JNB'}
'us': {'NAS'}
}
}
COMMON_SCREENER_FIELDS = {

View File

@@ -117,7 +117,7 @@ class Financials:
url = ts_url_base + "&type=" + ",".join([timescale + k for k in keys])
# Yahoo returns maximum 4 years or 5 quarters, regardless of start_dt:
start_dt = datetime.datetime(2016, 12, 31)
end = pd.Timestamp.utcnow().ceil("D")
end = pd.Timestamp.now('UTC').ceil("D")
url += f"&period1={int(start_dt.timestamp())}&period2={int(end.timestamp())}"
# Step 3: fetch and reshape data

View File

@@ -101,9 +101,9 @@ class PriceHistory:
logger.error(err_msg)
return utils.empty_df()
if period == 'ytd':
start = _datetime.date(pd.Timestamp.utcnow().tz_convert(tz).year, 1, 1)
start = _datetime.date(pd.Timestamp.now('UTC').tz_convert(tz).year, 1, 1)
else:
start = pd.Timestamp.utcnow().tz_convert(tz).date()
start = pd.Timestamp.now('UTC').tz_convert(tz).date()
start -= utils._interval_to_timedelta(period)
start -= _datetime.timedelta(days=4)
period_user = period
@@ -141,7 +141,7 @@ class PriceHistory:
start_dt = end_dt - utils._interval_to_timedelta('1mo')
start = int(start_dt.timestamp())
elif not end:
end_dt = pd.Timestamp.utcnow().tz_convert(tz)
end_dt = pd.Timestamp.now('UTC').tz_convert(tz)
end = int(end_dt.timestamp())
else:
if period.lower() == "max":
@@ -198,7 +198,7 @@ class PriceHistory:
get_fn = self._data.get
if end is not None:
end_dt = pd.Timestamp(end, unit='s').tz_localize("UTC")
dt_now = pd.Timestamp.utcnow()
dt_now = pd.Timestamp.now('UTC')
data_delay = _datetime.timedelta(minutes=30)
if end_dt + data_delay <= dt_now:
# Date range in past so safe to fetch through cache:
@@ -677,7 +677,7 @@ class PriceHistory:
min_dt = None
else:
m -= _datetime.timedelta(days=1) # allow space for 1-day padding
min_dt = pd.Timestamp.utcnow() - m
min_dt = pd.Timestamp.now('UTC') - m
min_dt = min_dt.tz_convert(df.index.tz).ceil("D")
logger.debug(f"min_dt={min_dt} interval={interval} sub_interval={sub_interval}", extra=log_extras)
if min_dt is not None:
@@ -1024,7 +1024,7 @@ class PriceHistory:
return df, currency
last_row = df.iloc[np.where(f_volume)[0][-1]]
prices_in_subunits = True # usually is true
if last_row.name > (pd.Timestamp.utcnow() - _datetime.timedelta(days=30)):
if last_row.name > (pd.Timestamp.now('UTC') - _datetime.timedelta(days=30)):
try:
ratio = self._history_metadata['regularMarketPrice'] / last_row['Close']
if abs((ratio*m)-1) < 0.1:

View File

@@ -143,7 +143,7 @@ class FastInfo:
if self._prices_1y.empty:
return self._prices_1y
dnow = pd.Timestamp.utcnow().tz_convert(self.timezone).date()
dnow = pd.Timestamp.now('UTC').tz_convert(self.timezone).date()
d1 = dnow
d0 = (d1 + datetime.timedelta(days=1)) - utils._interval_to_timedelta("1y")
if fullDaysOnly and self._exchange_open_now():
@@ -170,7 +170,7 @@ class FastInfo:
return self._md
def _exchange_open_now(self):
t = pd.Timestamp.utcnow()
t = pd.Timestamp.now('UTC')
self._get_exchange_metadata()
# if self._today_open is None and self._today_close is None:
@@ -231,7 +231,7 @@ class FastInfo:
if self._shares is not None:
return self._shares
shares = self._tkr.get_shares_full(start=pd.Timestamp.utcnow().date()-pd.Timedelta(days=548))
shares = self._tkr.get_shares_full(start=pd.Timestamp.now('UTC').date()-pd.Timedelta(days=548))
# if shares is None:
# # Requesting 18 months failed, so fallback to shares which should include last year
# shares = self._tkr.get_shares()
@@ -699,9 +699,9 @@ class Quote:
for k in keys:
url += "&type=" + k
# Request 6 months of data
start = pd.Timestamp.utcnow().floor("D") - datetime.timedelta(days=365 // 2)
start = pd.Timestamp.now('UTC').floor("D") - datetime.timedelta(days=365 // 2)
start = int(start.timestamp())
end = pd.Timestamp.utcnow().ceil("D")
end = pd.Timestamp.now('UTC').ceil("D")
end = int(end.timestamp())
url += f"&period1={start}&period2={end}"

View File

@@ -1 +1 @@
version = "1.0"
version = "1.1.0"