# getTopGainersAndLosers

**Identifier:** `coingecko_getTopGainersAndLosers`

**Provider:** [CoinGecko](https://kirha.com/providers/coingecko.md)

Get top gainers and losers in cryptocurrency markets.

## Run it with the CLI

```bash
kirha tools run coingecko_getTopGainersAndLosers \
  --input '{}'
```

`--input` takes a JSON object that matches the input schema. Pass `--input -` to read it from stdin.

## Call it over HTTP

```bash
curl https://api.kirha.com/tools/v1/execute \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: **********' \
  --data '{
  "tool_name": "coingecko_getTopGainersAndLosers",
  "input": {}
}'
```

Replace the stars with an API key from https://app.kirha.com/api-keys.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "currency": {
      "default": "usd",
      "enum": [
        "eur",
        "usd",
        "gbp",
        "jpy",
        "aud",
        "sek",
        "btc",
        "eth",
        "cny",
        "chf"
      ],
      "type": "string"
    },
    "duration": {
      "default": "24h",
      "enum": [
        "1h",
        "24h",
        "7d",
        "14d",
        "30d",
        "60d",
        "1y"
      ],
      "type": "string"
    },
    "limit": {
      "default": 5,
      "maximum": 10,
      "minimum": 1,
      "type": "number"
    }
  },
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "context": {
      "type": "string"
    },
    "currency": {
      "enum": [
        "eur",
        "usd",
        "gbp",
        "jpy",
        "aud",
        "sek",
        "btc",
        "eth",
        "cny",
        "chf"
      ],
      "type": "string"
    },
    "duration": {
      "enum": [
        "1h",
        "24h",
        "7d",
        "14d",
        "30d",
        "60d",
        "1y"
      ],
      "type": "string"
    },
    "topGainers": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "imageUrl": {
            "type": "string"
          },
          "marketCapRank": {
            "type": [
              "number",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "price": {
            "type": "number"
          },
          "priceChangePercent": {
            "type": "number"
          },
          "symbol": {
            "type": "string"
          },
          "volume24h": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "symbol",
          "name",
          "imageUrl",
          "marketCapRank",
          "price",
          "volume24h",
          "priceChangePercent"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "topLosers": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "imageUrl": {
            "type": "string"
          },
          "marketCapRank": {
            "type": [
              "number",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "price": {
            "type": "number"
          },
          "priceChangePercent": {
            "type": "number"
          },
          "symbol": {
            "type": "string"
          },
          "volume24h": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "symbol",
          "name",
          "imageUrl",
          "marketCapRank",
          "price",
          "volume24h",
          "priceChangePercent"
        ],
        "type": "object"
      },
      "type": "array"
    }
  },
  "required": [
    "context",
    "currency",
    "duration",
    "topGainers",
    "topLosers"
  ],
  "type": "object"
}
```

-----

[All CoinGecko tools](https://kirha.com/providers/coingecko.md) · [< Back to tools list](https://kirha.com/tools.md)