Spaces:
Sleeping
Sleeping
| import yfinance as yf | |
| def get_usd_sgd_rate(): | |
| try: | |
| fx = yf.download('USDSGD=X', period='5d', interval='1d') | |
| if not fx.empty: | |
| return float(fx['Close'][-1]) | |
| except Exception: | |
| pass | |
| return 1.0 # fallback to 1 if failed |