# CoinGecko Coin Data Tool

#### CoinGecko Coin Data Tool (`coingecko_coin_data_tool`)

Fetches detailed market data (price, volume, market cap, etc.) for one or more specific cryptocurrencies from CoinGecko. Accepts common coin names or tickers.

***

```python
class CoinGeckoCoinDataInput(BaseModel):
    coinname: str # e.g., "bitcoin", "sol", "ethereum,cardano"
```

***

**Key Functionality:**

* Retrieves current market data for specified cryptocurrencies from `api.coingecko.com`.
* Handles common names (e.g., "bitcoin", "solana") and tickers (e.g., "BTC", "SOL") using an internal mapping to CoinGecko IDs.
* Provides price, market cap, rank, 24h volume, 24h price range, and 24h price change.

***

**Sample Usage Queries (How an AI might use it):**

* "Get the CoinGecko data for Bitcoin."
* "What's the current price and market cap of Ethereum and Solana?"
* "Fetch market details for $SOL."
* "Show me the CoinGecko info for Cardano, Polkadot, and Avalanche."
* "Get data for dogecoin."
* "What are the stats for Wrapped Bitcoin (WBTC) from CoinGecko?"
* "Find CoinGecko market data for Bonk."
* "Fetch details for 'shiba inu'."

***

```python
class CoinGeckoCoinDataTool(BaseTool):
    name: ClassVar[str] = "coingecko_coin_data_tool"
    description: ClassVar[str] = "Get detailed market data (price, volume, market cap) for specific cryptocurrencies..."
    args_schema: ClassVar[Type[BaseModel]] = CoinGeckoCoinDataInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`) only.
* Relies on the external CoinGecko API; functionality and data accuracy depend on this service.
* Uses an internal list to map common coin names/tickers to CoinGecko IDs; for less common coins, the exact CoinGecko ID might be needed if not in the mapping.
