{"id":6787,"library":"pycoingecko","title":"Pycoingecko Python Client","description":"Pycoingecko is a Python wrapper around the CoinGecko API (V3), simplifying access to cryptocurrency market data. It supports both the Public and Pro API tiers. The library is actively maintained, with version 3.2.0 released on November 12, 2024, and maintains a regular release cadence.","status":"active","version":"3.2.0","language":"en","source_language":"en","source_url":"https://github.com/man-c/pycoingecko","tags":["cryptocurrency","api","coingecko","market-data"],"install":[{"cmd":"pip install -U pycoingecko","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"CoinGeckoAPI","correct":"from pycoingecko import CoinGeckoAPI"}],"quickstart":{"code":"import os\nfrom pycoingecko import CoinGeckoAPI\n\n# For Public API (no key required, but rate-limited)\n# For Demo API with key: cg = CoinGeckoAPI(demo_api_key=os.environ.get('COINGECKO_DEMO_API_KEY', ''))\n# For Pro API with key: cg = CoinGeckoAPI(api_key=os.environ.get('COINGECKO_PRO_API_KEY', ''))\n\ncg = CoinGeckoAPI()\n\ntry:\n    price_data = cg.get_price(ids='bitcoin', vs_currencies='usd')\n    print(f\"Bitcoin price in USD: {price_data.get('bitcoin', {}).get('usd')}\")\n    \n    status = cg.ping()\n    print(f\"API Status: {status}\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"Initializes the CoinGeckoAPI client and fetches the current price of Bitcoin in USD. It also includes a basic API status check. Users with Demo or Pro API keys should pass them during client initialization for higher rate limits and access to more endpoints."},"warnings":[{"fix":"Implement rate limiting/exponential backoff in your application. For increased limits, obtain a CoinGecko API key and pass it to the `CoinGeckoAPI` constructor (e.g., `CoinGeckoAPI(demo_api_key='YOUR_KEY')`).","message":"Public API Rate Limits: The free Public API has a strict rate limit of approximately 30 calls per minute. Exceeding this limit will result in 429 (Too Many Requests) errors. For higher throughput, consider using a Demo or Pro API key.","severity":"gotcha","affected_versions":"All versions"},{"fix":"First, use `cg.get_coins_list()` or `cg.get_coins_markets()` to find the correct CoinGecko ID for a given symbol or name. Then, use this ID for subsequent API calls.","message":"Coin IDs vs. Symbols: The CoinGecko API often requires specific CoinGecko IDs (e.g., 'bitcoin') for queries, rather than common ticker symbols (e.g., 'BTC'). Directly querying with symbols for detailed market data endpoints (like /simple/price) may not work as expected due to non-unique symbols.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update your data processing logic to use `market_cap_rank_with_rehypothecated` if you need ranking visibility for all tokens, including rehypothecated ones.","message":"Market Cap Rank Changes for Rehypothecated Tokens: Effective February 4th, 2026, the `market_cap_rank` field will return null for rehypothecated tokens. A new field, `market_cap_rank_with_rehypothecated`, is available to include these tokens in ranking calculations.","severity":"breaking","affected_versions":"CoinGecko API data fetched after 2026-02-04"},{"fix":"Always wrap your API calls in a `print()` statement or assign the result to a variable and then print the variable to see the output. E.g., `print(cg.ping())` instead of `cg.ping()`.","message":"Missing Output in Console: When using the `pycoingecko` client methods, the return value is often a dictionary. If you don't explicitly `print()` the result, no output will appear in the console.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If precision for low-value assets is critical, consider implementing a custom data handling layer using high-precision data types like Python's `Decimal` to preserve exact values.","message":"Floating-point Precision for Low-Value Assets: For cryptocurrencies with extremely low prices (e.g., 0.00000001), standard floating-point parsers in Python might convert these to scientific notation or round them down to zero.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}