{"id":7652,"library":"quandl","title":"Quandl Python API Client","description":"The `quandl` Python library provides a convenient interface for accessing financial, economic, and alternative datasets from Nasdaq Data Link (formerly Quandl). It allows users to fetch data as Pandas DataFrames or NumPy arrays, facilitating data analysis and integration into quantitative workflows. The library is actively maintained, with the current version being 3.7.0, and new features and fixes are released regularly.","status":"active","version":"3.7.0","language":"en","source_language":"en","source_url":"https://github.com/quandl/quandl-python","tags":["finance","data","api","stock-market","economics","nasdaq-data-link"],"install":[{"cmd":"pip install quandl","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Data from Quandl is typically returned as Pandas DataFrames, making pandas essential for data manipulation and analysis.","package":"pandas","optional":true},{"reason":"Used in conjunction with pandas for numerical operations on the fetched data.","package":"numpy","optional":true}],"imports":[{"note":"The package name is lowercase, and attempting to import with a capitalized 'Q' will result in an ImportError.","wrong":"import Quandl","symbol":"quandl","correct":"import quandl"},{"note":"Used to configure global settings like the API key, which is crucial for authenticated access.","symbol":"ApiConfig","correct":"import quandl\nquandl.ApiConfig.api_key = 'YOUR_API_KEY'"}],"quickstart":{"code":"import quandl\nimport os\n\n# Your Quandl API Key, stored as an environment variable for security\nAPI_KEY = os.environ.get('QUANDL_API_KEY', 'YOUR_API_KEY_HERE')\n\nif API_KEY == 'YOUR_API_KEY_HERE':\n    print(\"WARNING: Please set the QUANDL_API_KEY environment variable or replace 'YOUR_API_KEY_HERE' with your actual key.\")\n    # For demonstration, proceed with limited anonymous access or raise an error\n    # raise ValueError(\"Quandl API Key not configured.\")\n\nquandl.ApiConfig.api_key = API_KEY\n\ntry:\n    # Fetching historical stock data for Apple from the WIKI database (now deprecated/archived, but good example)\n    # For current data, find up-to-date codes on Nasdaq Data Link website\n    data = quandl.get(\"WIKI/AAPL\", start_date=\"2015-01-01\", end_date=\"2015-12-31\")\n    print(data.head())\nexcept quandl.QuandlError as e:\n    print(f\"Error fetching data: {e}\")\n    print(\"Ensure your API key is correct and you have access to the requested dataset.\")","lang":"python","description":"This quickstart demonstrates how to import the `quandl` library, configure your API key (preferably via environment variable), and fetch a sample dataset. Data is returned as a Pandas DataFrame, making it easy to inspect and manipulate. An API key is essential for most practical uses beyond very limited anonymous calls."},"warnings":[{"fix":"Upgrade Python to version 3.6 or later.","message":"Support for Python 3.3 was removed in `quandl` version 3.4.0. Users on Python 3.3 or older must upgrade their Python environment to at least 3.4 (though >=3.6 is now required by the latest package) to use `quandl` versions 3.4.0 and newer.","severity":"breaking","affected_versions":">=3.4.0"},{"fix":"Register for a free account on the Nasdaq Data Link website, obtain your API key from your account settings, and set it using `quandl.ApiConfig.api_key = 'YOUR_KEY'` or via the `QUANDL_API_KEY` environment variable.","message":"An API key is critical for most practical uses of Quandl. Anonymous users are severely rate-limited (e.g., 50 calls per day). Without a valid API key configured, you will quickly hit limits or fail to access many datasets, receiving 403 Forbidden or similar errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consult the Nasdaq Data Link website for the most current dataset codes and documentation, even when using the `quandl` library.","message":"Quandl was acquired by Nasdaq and is now known as Nasdaq Data Link. While the `quandl` Python library still functions to access their data, new users should be aware of the rebranding and seek dataset codes on the Nasdaq Data Link website.","severity":"gotcha","affected_versions":"All versions since late 2018"},{"fix":"Ensure your environment's SSL certificates are correctly configured or, as a last resort for debugging (not recommended for production), disable SSL verification via `quandl.ApiConfig.verify_ssl_certs = False`.","message":"SSL certificate verification was enabled by default in v3.4.8. If you are operating in an environment with custom SSL certificates or proxies, you might encounter SSL errors.","severity":"gotcha","affected_versions":">=3.4.8"},{"fix":"Avoid relying on `authtoken.p`. Explicitly set `quandl.ApiConfig.api_key` in your script or use the `QUANDL_API_KEY` environment variable.","message":"The `authtoken.p` file, previously used to persist API keys locally, can be a security concern if not properly managed or if the working directory changes. The recommended modern approach is to set the API key programmatically or via environment variables.","severity":"gotcha","affected_versions":"<3.4.3 (older mechanism), generally a configuration gotcha for all versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change the import statement to `import quandl` (all lowercase).","cause":"The Python package name for Quandl is all lowercase (`quandl`). Attempting to import it with a capitalized 'Q' will fail.","error":"ImportError: No module named Quandl"},{"fix":"Set your API key using `quandl.ApiConfig.api_key = 'YOUR_API_KEY'` before making data requests. Ensure 'YOUR_API_KEY' is replaced with your actual key from Nasdaq Data Link.","cause":"You are attempting to access a dataset that requires authentication or have exceeded anonymous call limits without providing a valid API key.","error":"ValueError: The Quandl API key must be provided."},{"fix":"Verify your API key is correct and active. Check your Nasdaq Data Link account for subscription status and daily call limits. Some datasets require paid subscriptions. If the key is correct, try accessing a free dataset like `WIKI/GOOGL` to isolate the problem.","cause":"This error typically indicates that your API key is invalid, has expired, or you do not have sufficient permissions (e.g., subscription level) to access the requested dataset, or you have exceeded your rate limits.","error":"quandl.errors.quandl_error.QuandlError: (Status 403) Something went wrong. Please try again."},{"fix":"Check the full error message for a `QuandlError` status code (e.g., 403, 500). Ensure your API key is valid, your request parameters are correct, and you are not exceeding rate limits. Temporarily enabling verbose logging might reveal the actual HTTP response body.","cause":"This often occurs when the Quandl API returns an unexpected non-JSON response (e.g., an HTML error page or an empty response) instead of valid JSON data, usually due to an underlying API issue, rate limiting, or an invalid request.","error":"json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)"}]}