Config#

yfinance has a new global config for sharing common values:

>>> import yfinance as yf
>>> yf.config
{
  "network": {
    "proxy": null,
    "retries": 0
  },
  "debug": {
    "hide_exceptions": true,
    "logging": false
  }
}
>>> yf.config.network
{
  "proxy": null,
  "retries": 0
}

Network#

  • proxy - Set proxy for all yfinance data fetches.

    yf.config.network.proxy = "PROXY_SERVER"
    
  • retries - Configure automatic retry for transient network errors. The retry mechanism uses exponential backoff (1s, 2s, 4s…).

    yf.config.network.retries = 2
    

Debug#

  • hide_exceptions - Set to False to stop yfinance hiding exceptions.

    yf.config.debug.hide_exceptions = False
    
  • logging - Set to True to enable verbose debug logging.

    yf.config.debug.logging = True