asset-class-comparison / utils /currency_utils.py
prasanth.thangavel
First commit of the app
2aaf2a2
raw
history blame
266 Bytes
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