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

# Obter preço médio

> Melhores preços e preços médios por evento em uma liga

Retorna uma lista truncada dos melhores preços e preços médios de cada evento de uma liga. Para cada evento e cada mercado (moneyline / spread / total), a resposta inclui:

* o **melhor preço** (o preço da oferta em aberto no topo);
* o **preço médio** que você pagaria varrendo pelo menos **\$500** de liquidez;
* a **aposta máxima** que poderia casar ao melhor preço e ao preço médio.

Os arrays por mercado (`awayMoneylines`, `homeMoneylines`, etc.) são removidos de cada evento; só permanece o bloco de resumo `odds`.

> [!NOTE]
>
> Ao contrário da maioria dos endpoints, este retorna os eventos no **nível superior** (não sob `data`).

## Requisição

`GET /exchange/getOddsForAveragePrice`

**leagueRequested** `string` *required*

Código de liga (não diferencia maiúsculas).

```bash curl theme={null}
curl "https://api.4casters.io/exchange/getOddsForAveragePrice?leagueRequested=NBA" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

## Resposta

**games** `array`

Cada `game` tem a forma padrão de [Game](https://docs.4casters.io/pt-BR/pages/rest/markets/get-games.md#response) com os seguintes campos adicionais:

**Extras por evento**

**matchedVolume** `number`

**mainHomeSpread** `string`

**mainAwaySpread** `number`

**mainTotal** `string`

**odds** `object`

Melhores preços / preços médios e tamanhos máximos de aposta para mercados moneyline, spread e total.

**odds**

**averageHomeMoneyline** `integer`

**bestHomeMoneyline** `integer`

**bestHomeMoneylineWithCommission** `integer`

**bestHomeMoneylinePriceLimit** `integer`

Aposta máxima ao melhor preço moneyline mandante.

**averageAwayMoneyline** `integer`

**bestAwayMoneyline** `integer`

**bestAwayMoneylineWithCommission** `integer`

**bestAwayMoneylinePriceLimit** `integer`

**averageHomeSpread** `integer`

**bestHomeSpread** `integer`

**bestHomeSpreadWithCommission** `integer`

**bestHomeSpreadPriceLimit** `integer`

**mainHomeSpread** `string`

**averageAwaySpread** `integer`

**bestAwaySpread** `integer`

**bestAwaySpreadWithCommission** `integer`

**bestAwaySpreadPriceLimit** `integer`

**mainAwaySpread** `number`

**averageOver** `integer`

**bestOver** `integer`

**bestOverWithCommission** `integer`

**bestOverPriceLimit** `integer`

**averageUnder** `integer`

**bestUnder** `integer`

**bestUnderWithCommission** `integer`

**bestUnderPriceLimit** `integer`

**mainTotal** `string`

**maxMoneyLineBet** `integer`

Máximo de `homeMoneylineMaxBet` e `awayMoneylineMaxBet`.

**homeMoneylineMaxBet** `integer`

**awayMoneylineMaxBet** `integer`

**maxTotalBet** `integer`

**maxOverBet** `integer`

**maxUnderBet** `integer`

**maxSpreadBet** `integer`

**maxHomeSpreadBet** `integer`

**maxAwaySpreadBet** `integer`


## OpenAPI

````yaml GET /exchange/getOddsForAveragePrice
openapi: 3.1.0
info:
  title: 4casters REST API
  version: 1.0.0
  description: >-
    Public REST API for the 4casters peer-to-peer betting exchange. Use this API
    to manage your account, query the orderbook and games, and place / edit /
    cancel orders.


    All responses (unless noted otherwise) are JSON envelopes of the form `{
    "data": ... }`.
  contact:
    name: 4casters
    url: https://4casters.io
servers:
  - url: https://api.4casters.io
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: Login and account session management
  - name: User
    description: Read account info, bets, and orders
  - name: Orders
    description: Place, edit, look up, and cancel orders
  - name: Markets
    description: Browse leagues, games, participants, and orderbooks
  - name: Affiliate
    description: Affiliate / referral commission
paths:
  /exchange/getOddsForAveragePrice:
    get:
      tags:
        - Markets
      summary: Get average price
      description: >-
        Return a truncated list of best and average prices for every game in a
        league. For each game and each market (moneyline / spread / total), the
        response includes:


        - the best price (the price on the top resting offer);

        - the average price you'd pay sweeping at least $500 of liquidity;

        - the maximum bet that could be filled at the best price and the average
        price.


        The per-market arrays (`awayMoneylines`, `homeMoneylines`,
        `homeSpreads`, `awaySpreads`, `over`, `under`) are stripped from each
        game; only the summary `odds` block remains.
      parameters:
        - name: leagueRequested
          in: query
          required: true
          schema:
            type: string
          description: League code (case-insensitive).
      responses:
        '200':
          description: Game best/average prices
          content:
            application/json:
              schema:
                type: object
                properties:
                  games:
                    type: array
                    items:
                      $ref: '#/components/schemas/GameAveragePrice'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    GameAveragePrice:
      allOf:
        - $ref: '#/components/schemas/Game'
        - type: object
          properties:
            matchedVolume:
              type: number
            mainHomeSpread:
              type:
                - string
                - number
              nullable: true
            mainAwaySpread:
              type:
                - string
                - number
              nullable: true
            mainTotal:
              type:
                - string
                - number
              nullable: true
            odds:
              type: object
              description: >-
                Best/average prices and max bet sizes for moneyline, spread, and
                total markets.
              properties:
                averageHomeMoneyline:
                  type: integer
                  nullable: true
                bestHomeMoneyline:
                  type: integer
                  nullable: true
                bestHomeMoneylineWithCommission:
                  type: integer
                  nullable: true
                bestHomeMoneylinePriceLimit:
                  type: integer
                  nullable: true
                averageAwayMoneyline:
                  type: integer
                  nullable: true
                bestAwayMoneyline:
                  type: integer
                  nullable: true
                bestAwayMoneylineWithCommission:
                  type: integer
                  nullable: true
                bestAwayMoneylinePriceLimit:
                  type: integer
                  nullable: true
                averageHomeSpread:
                  type: integer
                  nullable: true
                bestHomeSpread:
                  type: integer
                  nullable: true
                bestHomeSpreadWithCommission:
                  type: integer
                  nullable: true
                bestHomeSpreadPriceLimit:
                  type: integer
                  nullable: true
                mainHomeSpread:
                  type:
                    - string
                    - number
                  nullable: true
                averageAwaySpread:
                  type: integer
                  nullable: true
                bestAwaySpread:
                  type: integer
                  nullable: true
                bestAwaySpreadWithCommission:
                  type: integer
                  nullable: true
                bestAwaySpreadPriceLimit:
                  type: integer
                  nullable: true
                mainAwaySpread:
                  type:
                    - string
                    - number
                  nullable: true
                averageOver:
                  type: integer
                  nullable: true
                bestOver:
                  type: integer
                  nullable: true
                bestOverWithCommission:
                  type: integer
                  nullable: true
                bestOverPriceLimit:
                  type: integer
                  nullable: true
                averageUnder:
                  type: integer
                  nullable: true
                bestUnder:
                  type: integer
                  nullable: true
                bestUnderWithCommission:
                  type: integer
                  nullable: true
                bestUnderPriceLimit:
                  type: integer
                  nullable: true
                mainTotal:
                  type:
                    - string
                    - number
                  nullable: true
                maxMoneyLineBet:
                  type: integer
                homeMoneylineMaxBet:
                  type: integer
                awayMoneylineMaxBet:
                  type: integer
                maxTotalBet:
                  type: integer
                maxOverBet:
                  type: integer
                maxUnderBet:
                  type: integer
                maxSpreadBet:
                  type: integer
                maxHomeSpreadBet:
                  type: integer
                maxAwaySpreadBet:
                  type: integer
    Game:
      type: object
      description: Game without orderbook data.
      properties:
        id:
          type: string
        parentGameID:
          type: string
          nullable: true
        cheapDataUID:
          type: string
          description: >-
            Stable cross-system identifier for the game (used for line
            correlation).
        league:
          type: string
        sport:
          type: string
        start:
          type: string
          format: date-time
        ended:
          type: boolean
        live:
          type: boolean
        featured:
          type: boolean
        eventName:
          type: string
          nullable: true
        tournamentName:
          type: string
          nullable: true
        periodName:
          type: string
          description: e.g. `Full Time`, `1H`, `Set 1`.
        isSpecials:
          type: boolean
          description: True for futures and other specials markets.
        participants:
          type: array
          items:
            $ref: '#/components/schemas/Participant'
    Participant:
      type: object
      properties:
        id:
          type: string
        longName:
          type: string
        shortName:
          type: string
        homeAway:
          type: string
          enum:
            - home
            - away
        mainPitcher:
          type: string
          nullable: true
        rotationNumber:
          type: string
          nullable: true
        futuresSide:
          type: string
          nullable: true
        score:
          type: number
          description: Final score; only present for ended games.
  responses:
    Unauthorized:
      description: Missing or invalid auth token
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Pass your auth token in the `Authorization` header. The `Bearer` prefix
        is optional; the server also accepts a signed `auth` cookie or a `token`
        field in the request body.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.