refined-backend / debug_yf.py
Kode-Animator's picture
Initial commit - ReFinEd AI Backend v1.0
feae69f
Raw History Blame Contribute Delete
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