> ## 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 apostas liquidadas (legado)

> Lista apostas liquidadas entre duas datas com um resumo de P&L

> [!WARNING]
>
> **Obsoleto.** Use [Obter apostas liquidadas por datas](https://docs.4casters.io/pt-BR/pages/rest/user/get-graded.md) para uma janela de datas, ou [Obter apostas liquidadas a partir de um cursor](https://docs.4casters.io/pt-BR/pages/rest/user/get-graded-since.md) para se manter sincronizado à medida que as apostas são liquidadas. Este endpoint continua funcionando para as integrações existentes.

Retorna todas as **apostas liquidadas** da conta autenticada entre duas datas, mais um resumo de P\&L e volume. As datas correspondem ao **horário de início do evento** da aposta (assim, `startDate=06-22-2022` retorna apostas de eventos que começam depois de 06-21-2022 00:00 GMT).

## Requisição

`GET /user/getGradedWagers`

**startDate** `string`

Data de início (`MM-DD-YYYY`). O valor padrão é `10-21-2020`.

**endDate** `string`

Data de fim (`MM-DD-YYYY`). O valor padrão é hoje.

```bash curl theme={null}
curl "https://api.4casters.io/user/getGradedWagers?startDate=01-01-2024&endDate=02-01-2024" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

## Resposta

**data.graded** `array`

Array de apostas liquidadas, ordenadas de forma descendente por horário de início do evento.

**GradedWager**

**id** `string`

Id da aposta.

**txID** `string`

Id de transação do casamento.

**ticketNumber** `string`

Número de ticket de exibição.

**type** `string`

`moneyline`, `spread`, `total` ou `moneyline1x2`.

**outcome** `string`

`winner`, `loser`, `push` ou `refund`.

**bet** `number`

Tamanho original da aposta.

**odds** `integer`

Odds americanas no momento do casamento.

**spread** `number`

Presente em `spread`.

**total** `number`

Presente em `total`.

**OU** `string`

Presente em `total`.

**participantID** `string`

Presente em `moneyline` e `spread`.

**market** `string`

Presente em `moneyline1x2`.

**side** `string`

Em `moneyline1x2` — `yes` ou `no`.

**matchedTime** `string`

Marca de tempo ISO 8601 em que o casamento ocorreu.

**settledAt** `string`

Marca de tempo ISO 8601 em que a aposta foi liquidada.

**createdAt** `string`

Marca de tempo ISO 8601 em que a ordem foi enviada.

**cancelled** `boolean`

**closed** `boolean`

**graded** `boolean`

Sempre `true` aqui.

**adminRefund** `boolean`

**platform** `string`

Origem da ordem, p. ex. `api`, `web`, `mobile`.

**risk** `string`

Risco da porção casada (string, 2 casas decimais).

**win** `string`

Valor de ganho, líquido de comissão.

**fee** `string`

Comissão cobrada sobre a porção casada.

**result** `string`

P\&L líquido desta aposta. Negativo se você perdeu, positivo se você ganhou, `0` em push.

**pinnacleLine** `object`

Instantâneo da linha comparável da Pinnacle no momento do casamento, quando disponível.

<Snippet file="pt-BR/types/game-summary.mdx" />

**data.summary** `object`

Totais agregados sobre as apostas retornadas.

**summary**

**pnl** `integer`

Soma de `result` (arredondada).

**volume** `integer`

Soma de `min(risk, win)` (arredondada).

### Exemplo

```json JSON theme={null}
{
  "data": {
    "graded": [
      {
        "id": "64c98e8c0745a206acf18ad7",
        "txID": "64c99640453fd2ad91206018",
        "ticketNumber": "5a5494406ef9e2c5988b30bf666ce55e",
        "type": "total",
        "outcome": "loser",
        "bet": 1,
        "odds": 101,
        "total": 8.5,
        "OU": "over",
        "matchedTime": "2023-08-01T23:33:20.273Z",
        "settledAt": "2023-08-02T02:26:16.152Z",
        "createdAt": "2023-08-01T23:33:20.273Z",
        "graded": true,
        "platform": "api",
        "risk": "1.01",
        "win": "1.00",
        "fee": "0.01",
        "result": "-1.01",
        "pinnacleLine": { "odds": -102, "total": 8.5, "OU": "over" },
        "game": {
          "id": "64c7fa454803b0ff0f7f5741",
          "league": "MLB",
          "sport": "baseball",
          "start": "2023-08-01T23:45:00.000Z",
          "ended": true,
          "participants": [/* ... */]
        }
      }
    ],
    "summary": { "pnl": -1, "volume": 1 }
  }
}
```


## OpenAPI

````yaml api-reference/openapi.json GET /user/getGradedWagers
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:
  /user/getGradedWagers:
    get:
      tags:
        - User
      summary: Get graded wagers
      description: >-
        Return all of the caller's graded (settled) wagers between two dates,
        plus a summary of P&L and volume. Dates correspond to the **start time
        of the game** the wager is on (so `startDate=06-22-2022` returns wagers
        on games starting after 06-21-2022 00:00 GMT).
      parameters:
        - name: startDate
          in: query
          required: false
          description: Start date (`MM-DD-YYYY`). Defaults to `10-21-2020`.
          schema:
            type: string
            example: 01-01-2024
        - name: endDate
          in: query
          required: false
          description: End date (`MM-DD-YYYY`). Defaults to today.
          schema:
            type: string
            example: 02-01-2024
      responses:
        '200':
          description: Graded wagers and summary
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      graded:
                        type: array
                        items:
                          $ref: '#/components/schemas/GradedWager'
                      summary:
                        $ref: '#/components/schemas/GradedSummary'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    GradedWager:
      type: object
      description: A settled wager.
      properties:
        id:
          type: string
        txID:
          type: string
        ticketNumber:
          type: string
        type:
          $ref: '#/components/schemas/MarketType'
        outcome:
          type: string
          enum:
            - winner
            - loser
            - push
            - refund
        bet:
          type: number
        odds:
          type: integer
        spread:
          type: number
          nullable: true
        total:
          type: number
          nullable: true
        OU:
          type: string
          enum:
            - over
            - under
        participantID:
          type: string
        market:
          type: string
        side:
          $ref: '#/components/schemas/MarketSide'
        matchedTime:
          type: string
          format: date-time
        settledAt:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        graded:
          type: boolean
        closed:
          type: boolean
        cancelled:
          type: boolean
        adminRefund:
          type: boolean
        platform:
          type: string
          example: api
        fee:
          type: string
          description: Commission charged on the matched portion.
        risk:
          type: string
        win:
          type: string
        result:
          type: string
          description: Net P&L on this wager (signed).
        pinnacleLine:
          type: object
          description: >-
            Snapshot of the comparable Pinnacle line at fill time, when
            available.
        game:
          $ref: '#/components/schemas/GameSummary'
    GradedSummary:
      type: object
      properties:
        pnl:
          type: integer
          description: Sum of `result` across the returned wagers (rounded).
        volume:
          type: integer
          description: Sum of `min(risk, win)` across the returned wagers (rounded).
    MarketType:
      type: string
      enum:
        - moneyline
        - spread
        - total
        - moneyline1x2
      description: >-
        Market type. `moneyline1x2` is **soccer-only** (three-way money line:
        home / away / draw).
    MarketSide:
      type: string
      description: |-
        Order side. Meaning depends on `type`:

        - `moneyline`, `spread` — the participant id you are backing.
        - `total` — `"over"` or `"under"`.
        - `moneyline1x2` — `"yes"` or `"no"` on the outcome named by `market`.
    GameSummary:
      type: object
      properties:
        id:
          type: string
        league:
          type: string
        sport:
          type: string
        start:
          type: string
          format: date-time
        ended:
          type: boolean
        eventName:
          type: string
          nullable: true
        isFutures:
          type: boolean
        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.