Spaces:
Sleeping
Sleeping
Commit ·
49019e5
1
Parent(s): ea13f4d
Fix AttributeError: remove invalid yf.utils.Cache reference in backend utils
Browse files
backend/app/utils/yfinance_utils.py
CHANGED
|
@@ -18,21 +18,9 @@ import yfinance as yf
|
|
| 18 |
|
| 19 |
logger = logging.getLogger(__name__)
|
| 20 |
|
| 21 |
-
# yfinance session is reused across calls for better connection pooling
|
| 22 |
-
_session: Optional[yf.utils.Cache] = None
|
| 23 |
-
|
| 24 |
# Configuration
|
| 25 |
MAX_RETRIES = 3
|
| 26 |
RETRY_DELAY = 2.0 # seconds (base for exponential backoff)
|
| 27 |
-
REQUEST_TIMEOUT = 30 # seconds
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
def _get_session():
|
| 31 |
-
"""Get or create a yfinance session with proper configuration."""
|
| 32 |
-
global _session
|
| 33 |
-
if _session is None:
|
| 34 |
-
_session = yf.utils.Cache()
|
| 35 |
-
return _session
|
| 36 |
|
| 37 |
|
| 38 |
def fetch_ticker_history(
|
|
|
|
| 18 |
|
| 19 |
logger = logging.getLogger(__name__)
|
| 20 |
|
|
|
|
|
|
|
|
|
|
| 21 |
# Configuration
|
| 22 |
MAX_RETRIES = 3
|
| 23 |
RETRY_DELAY = 2.0 # seconds (base for exponential backoff)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
def fetch_ticker_history(
|