# CoinGecko

Try it in the Widget Center

Click this [url](https://docs.myshell.ai/create/pro-config-mode/api-reference/widgets/40-coingecko) to try this widget and copy the Pro Config template.

## Usage

### Get the Coin ID

<mark style="color:green;">`action`</mark> `coin_id`

**Input Parameters**

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Default</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>action</td><td><code>string</code></td><td>The action you want to perform</td><td>coin_id</td><td>true</td></tr><tr><td>name</td><td><code>string</code></td><td>The name of the coin. Required if you search coin by name.</td><td></td><td>true</td></tr></tbody></table>

**Output Parameters**

<table><thead><tr><th width="146">Name</th><th>Type</th><th>Description</th><th>File Type</th></tr></thead><tbody><tr><td>data</td><td><code>object</code></td><td>The output of coingecko API.</td><td></td></tr></tbody></table>

#### Output Example

{% code overflow="wrap" %}

```json
{
  "status": "SUCCESS",
  "created_at": "2024-04-25T02:58:32.161881",
  "started_at": "2024-04-25T02:58:36.511598",
  "result": {
    "data": {
      "id": "bitcoin",
      "symbol": "btc",
      "name": "Bitcoin"
    }
  },
  "finished_at": "2024-04-25T02:58:38.489827"
}
```

{% endcode %}

### Get the Coin Data by ID

<mark style="color:green;">`action`</mark> `coin_data_by_id`

**Input Parameters**

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th width="160">Default</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>action</td><td><code>string</code></td><td>The action you want to perform</td><td>coin_data_by_id</td><td>true</td></tr><tr><td>id</td><td><code>string</code></td><td>The id of the coin.</td><td></td><td>true</td></tr></tbody></table>

**Output Parameters**

<table><thead><tr><th width="146">Name</th><th>Type</th><th>Description</th><th>File Type</th></tr></thead><tbody><tr><td>data</td><td><code>object</code></td><td>The output of coingecko API.</td><td></td></tr></tbody></table>

#### Output Example

```json

{
    "status": "SUCCESS",
    "created_at": "2024-04-25T03:12:37.276366",
    "started_at": "2024-04-25T03:12:39.650554",
    "result": {
      "data": {
        "id": "bitcoin",
        "symbol": "btc",
        "name": "Bitcoin",
        "web_slug": "bitcoin",
        "asset_platform_id": null,
        "*****"
      }
    },
    "finished_at": "2024-04-25T03:12:41.767455"
}
```

### Get the Coin Ticker by ID

<mark style="color:green;">`action`</mark> `coin_ticker_by_id`

**Input Parameters**

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th width="160">Default</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>action</td><td><code>string</code></td><td>The action you want to perform</td><td>coin_ticker_by_id</td><td>true</td></tr><tr><td>id</td><td><code>string</code></td><td>The id of the coin.</td><td></td><td>true</td></tr></tbody></table>

**Output Parameters**

<table><thead><tr><th width="146">Name</th><th>Type</th><th>Description</th><th>File Type</th></tr></thead><tbody><tr><td>data</td><td><code>object</code></td><td>The output of coingecko API.</td><td></td></tr></tbody></table>

#### Output Example

```json
{
    "status": "SUCCESS",
    "created_at": "2024-04-25T03:21:00.040066",
    "started_at": "2024-04-25T03:21:03.711204",
    "result": {
      "data": {
        "name": "Bitcoin",
        "tickers": ["***"]
      }
    },
    "finished_at": "2024-04-25T03:21:06.378630"
}
```

### Advanced

**Input Parameters**

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Default</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>endpoint</td><td><code>string</code></td><td>The endpoint url of Coingecko, please add the path params in the endpoint</td><td>https://pro-api.coingecko.com/api/v3/coins/id</td><td>true</td></tr><tr><td>query_param</td><td><code>string</code></td><td>Dict type of query params</td><td></td><td>false</td></tr></tbody></table>

## Detailed Guidelines

> Note: You can test this feature in the widget center, but please be cautious not to output excessive information on the website. Some cryptocurrency data can be extensive and may cause your website to become unresponsive or crash.

* Main parameter of Coins:
  * `task_type` , you can use the `coin_id` to obtain the identifier of your chosen cryptocurrency. Then, utilize other functions named `xx_by_id` to fetch specific details about that cryptocurrency.
    * When using `coin_id`, you should provide the name of the coin as a parameter. For `xx_by_id` functions, you should supply the coin's ID as the parameter.
* Main parameter of Advanced
  * `endpoint`, refer to the [CoinGecko API documentation](https://docs.coingecko.com/reference/introduction) and use the API interface as the endpoint. Be sure to include the path parameters in the endpoint.
  * For the query parameters, add them as a dictionary, following the format described in the [CoinGecko API documentation](https://docs.coingecko.com/reference/introduction)
* Some examples

<figure><img src="https://2975681513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDtmZwLatyyBFLUK6P6Pj%2Fuploads%2Fgit-blob-a3e6676e9b41ddac332d8ec0f19edd9ea97b35fc%2Fimage%20(24).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2975681513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDtmZwLatyyBFLUK6P6Pj%2Fuploads%2Fgit-blob-2f5bad50b26bd1ed75c0546ef65170d54786260d%2Fimage%20(25).png?alt=media" alt=""><figcaption></figcaption></figure>
