Spaces:
Sleeping
Sleeping
Download debug_yf.py from Into-The-Eye/refined-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/spaces/Into-The-Eye/refined-backend/resolve/main/debug_yf.py
- Command line
-
hf download hf://spaces/Into-The-Eye/refined-backend/debug_yf.py
-
curl -L -o debug_yf.py https://huggingface.co/spaces/Into-The-Eye/refined-backend/resolve/main/debug_yf.py
1.08 kB
| import yfinance as yf | |
| import sys | |
| def check_ticker(symbol): | |
| print(f"--- Checking {symbol} ---") | |
| try: | |
| t = yf.Ticker(symbol) | |
| # Check fast_info | |
| print("Fetching fast_info...") | |
| fi = t.fast_info | |
| # fast_info is a LazyLoader, accessing keys helps trigger load | |
| keys = list(fi.keys()) if fi else [] | |
| print(f"fast_info keys: {keys}") | |
| last_price = fi.get('lastPrice') | |
| print(f"fast_info['last_price']: {last_price}") | |
| if last_price is None: | |
| print("fast_info missing price, checking info...") | |
| info = t.info | |
| print(f"info keys: {list(info.keys())[:5]}...") # Just show first few | |
| print(f"info['regularMarketPrice']: {info.get('regularMarketPrice')}") | |
| print(f"info['currentPrice']: {info.get('currentPrice')}") | |
| except Exception as e: | |
| print(f"ERROR for {symbol}: {e}") | |
| if __name__ == "__main__": | |
| check_ticker("SPY") | |
| check_ticker("BTC-USD") | |
| check_ticker("AACB") # The one user failed on | |