From a4319a6dd55d403d3c3c18bec55e9cfea6899ea3 Mon Sep 17 00:00:00 2001 From: Emmanuel Ferdman Date: Fri, 23 May 2025 22:31:38 +0300 Subject: [PATCH] Resolve Python Datetime warnings (#7119) Signed-off-by: Emmanuel Ferdman Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com> --- .../yfinance/openbb_yfinance/models/share_statistics.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openbb_platform/providers/yfinance/openbb_yfinance/models/share_statistics.py b/openbb_platform/providers/yfinance/openbb_yfinance/models/share_statistics.py index 6b36e53cb15..724ccc2636d 100644 --- a/openbb_platform/providers/yfinance/openbb_yfinance/models/share_statistics.py +++ b/openbb_platform/providers/yfinance/openbb_yfinance/models/share_statistics.py @@ -5,6 +5,7 @@ from datetime import ( date as dateType, datetime, + timezone, ) from typing import Any, Dict, List, Optional from warnings import warn @@ -93,8 +94,8 @@ class YFinanceShareStatisticsData(ShareStatisticsData): ) @classmethod def validate_first_trade_date(cls, v): - """Convert dates from UTC timestamp.""" - return datetime.utcfromtimestamp(v).date() if v else None + """Convert dates from UTC timestamp.""" + return datetime.fromtimestamp(v, timezone.utc).date() if v else None class YFinanceShareStatisticsFetcher(