> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coingecko.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Top Gainers & Losers

> To query the top 30 coins with largest price gain and loss by a specific time duration

export const CacheInfo = ({publicRate, paidRate, rate}) => {
  const fmt = v => v === 0 ? 'Real-time (Cacheless)' : `Every ${v}`;
  if (rate !== undefined) {
    return <Callout icon="clock-rotate-left" color="#2196F3" iconType="regular">
        <strong>Cache / Update Frequency:</strong><br />{fmt(rate)}
      </Callout>;
  }
  if (publicRate !== undefined && paidRate !== undefined) {
    return <Callout icon="clock-rotate-left" color="#2196F3" iconType="regular">
        <strong>Cache / Update Frequency:</strong><ul><li>{fmt(paidRate)} (Paid API)</li><li>{fmt(publicRate)} (Demo / Keyless API)</li></ul>
      </Callout>;
  }
  return null;
};

export const PlanExclusivity = ({tier}) => {
  if (tier === "enterprise") {
    return <Callout icon="crown" color="#FFC107" iconType="regular">
        <strong>Enterprise Only</strong><br />This endpoint is exclusively available to <strong>Enterprise</strong> plan.<br /><a href="https://www.coingecko.com/en/api/enterprise">→ Contact sales</a>
      </Callout>;
  }
  if (tier === "analyst_above") {
    return <Callout icon="briefcase" color="#FFC107" iconType="regular">
        <strong>Analyst Plan and Above</strong><br />This endpoint is only available to <strong>Analyst, Lite, Pro, and Enterprise</strong> plan.<br /><a href="https://www.coingecko.com/en/api/pricing">→ View pricing</a>
      </Callout>;
  }
  if (tier === "basic_above") {
    return <Callout icon="briefcase" color="#FFC107" iconType="regular">
        <strong>Basic Plan and Above</strong><br />This endpoint is only available to <strong>Basic, Analyst, Lite, Pro, and Enterprise</strong> plan.<br /><a href="https://www.coingecko.com/en/api/pricing">→ View pricing</a>
      </Callout>;
  }
  throw new Error(`PlanExclusivity: invalid tier "${tier}". Use "basic_above", "analyst_above", or "enterprise".`);
};

<Note>
  * Only includes coins with a 24-hour trading volume of at least \$50,000.
  * Equivalent page on [CoinGecko Gainers & Losers](https://www.coingecko.com/en/crypto-gainers-losers).
</Note>

<PlanExclusivity tier="analyst_above" />

<CacheInfo rate="5 minutes" />

#### SDK Examples

<CodeGroup>
  ```typescript TypeScript theme={null}
  const response = await client.coins.topGainersLosers.get({
    vs_currency: 'usd',
  });

  console.log(JSON.stringify(response, null, 2));
  ```

  ```python Python theme={null}
  response = client.coins.top_gainers_losers.get(
    vs_currency="usd",
  )

  print(response.model_dump_json(indent=2))
  ```
</CodeGroup>


## OpenAPI

````yaml openapi-specs/pro-api.json get /coins/top_gainers_losers
openapi: 3.0.0
info:
  title: CoinGecko Pro API
  version: 3.0.0
servers:
  - url: https://pro-api.coingecko.com/api/v3
security:
  - headerAuth: []
  - queryAuth: []
paths:
  /coins/top_gainers_losers:
    get:
      summary: Top Gainers & Losers
      description: >-
        To query the top 30 coins with largest price gain and loss by a specific
        time duration
      operationId: coins-top-gainers-losers
      parameters:
        - name: vs_currency
          in: query
          required: true
          description: >-
            Target currency of coins. 

            *refers to
            [`/simple/supported_vs_currencies`](/reference/simple-supported-currencies)
          schema:
            type: string
            default: usd
        - name: duration
          in: query
          required: false
          description: |-
            Filter result by time range. 
            Default: `24h`
          schema:
            type: string
            enum:
              - 1h
              - 24h
              - 7d
              - 14d
              - 30d
              - 60d
              - 1y
        - name: price_change_percentage
          in: query
          required: false
          description: >-
            Include price change percentage timeframe, comma-separated if
            querying more than 1 timeframe. 

            Valid values: `1h`, `24h`, `7d`, `14d`, `30d`, `60d`, `200d`, `1y`
          schema:
            type: string
        - name: top_coins
          in: query
          required: false
          description: >-
            Filter result by market cap ranking (top 300 to 1000) or all coins
            (including coins that do not have market cap). 

            Default: `1000`
          schema:
            type: string
            enum:
              - '300'
              - '500'
              - '1000'
              - all
      responses:
        '200':
          description: Top gainers and losers
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopGainersLosers'
              example:
                top_gainers:
                  - id: maga-bitcoin
                    symbol: mbtc
                    name: MAGA Bitcoin
                    image: >-
                      https://coin-images.coingecko.com/coins/images/102172497/original/image0-removebg-preview.webp?1773518858
                    market_cap_rank: 189
                    usd: 0.17408997149936514
                    usd_24h_vol: 50396.8060000212
                    usd_24h_change: 150.5022699272054
                    usd_1h_change: -6.503819291482131
                    usd_7d_change: 519.1190967122302
                    usd_14d_change: 461.9068555244123
                    usd_30d_change: 448.72555160441027
                    usd_60d_change: 67.38949093422981
                    usd_200d_change: null
                    usd_1y_change: null
                top_losers:
                  - id: irys
                    symbol: irys
                    name: Irys
                    image: >-
                      https://coin-images.coingecko.com/coins/images/70808/original/irys.png?1764757341
                    market_cap_rank: 352
                    usd: 0.038636564524228145
                    usd_24h_vol: 77344929.5624576
                    usd_24h_change: -19.511341677152053
                    usd_1h_change: 1.6279519726091103
                    usd_7d_change: 0.8723104841951528
                    usd_14d_change: -3.0080471375482483
                    usd_30d_change: 35.11913273728426
                    usd_60d_change: 119.67467634522242
                    usd_200d_change: null
                    usd_1y_change: null
components:
  schemas:
    TopGainersLosers:
      type: object
      required:
        - top_gainers
        - top_losers
      properties:
        top_gainers:
          type: array
          items:
            $ref: '#/components/schemas/TopGainersLosersItem'
        top_losers:
          type: array
          items:
            $ref: '#/components/schemas/TopGainersLosersItem'
    TopGainersLosersItem:
      type: object
      required:
        - id
        - symbol
        - name
        - image
        - market_cap_rank
        - usd
        - usd_24h_vol
        - usd_24h_change
      properties:
        id:
          type: string
          description: Coin ID
        symbol:
          type: string
          description: Coin symbol
        name:
          type: string
          description: Coin name
        image:
          type: string
          description: Coin image URL
        market_cap_rank:
          type: integer
          nullable: true
          description: Coin market cap rank
        usd:
          type: number
          description: Coin price in the target currency
        usd_24h_vol:
          type: number
          description: 24-hour trading volume in the target currency
        usd_24h_change:
          type: number
          nullable: true
          description: 24-hour price change percentage
        usd_1h_change:
          type: number
          nullable: true
          description: 1-hour price change percentage
        usd_7d_change:
          type: number
          nullable: true
          description: 7-day price change percentage
        usd_14d_change:
          type: number
          nullable: true
          description: 14-day price change percentage
        usd_30d_change:
          type: number
          nullable: true
          description: 30-day price change percentage
        usd_60d_change:
          type: number
          nullable: true
          description: 60-day price change percentage
        usd_200d_change:
          type: number
          nullable: true
          description: 200-day price change percentage
        usd_1y_change:
          type: number
          nullable: true
          description: 1-year price change percentage
  securitySchemes:
    headerAuth:
      type: apiKey
      in: header
      name: x-cg-pro-api-key
      description: >-
        Learn how to [set up your API
        key](https://docs.coingecko.com/docs/setting-up-your-api-key)
    queryAuth:
      type: apiKey
      in: query
      name: x_cg_pro_api_key
      description: >-
        Learn how to [set up your API
        key](https://docs.coingecko.com/docs/setting-up-your-api-key)

````