> ## 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.

# 獲取已撮合成交量

> 一段日期範圍內的全站已撮合成交量

回傳一段 **美國東部時間（ET）日曆日** 範圍（首尾兩天均含）內的全站已撮合成交量。

<h2 id="how-volume-is-calculated">
  成交量如何計算
</h2>

每筆已撮合投注計入撮合**雙方**的本金：

* **吃單方本金**（撮合金額），加上
* **掛單方本金**，由吃單賠率推導 — 吃單賠率為正時為 `stake × odds / 100`，為負時為 `stake × −100 / odds`。

等價地，從任一方看，每筆已撮合投注計入 **`risk + win`** — 你的本金加上潛在利潤，因為你的潛在利潤恰好是對手方的本金。一筆 $100、+150 的吃單計為 $250 成交量（吃單方 $100 + 掛單方 $150）。

<Note>
  成交量使用佣金前的原始本金。[獲取已撮合投注](/zh-Hant/pages/rest/user/get-matched-bets) 上的 `risk` / `win` 欄位已計入佣金，因此把它們相加會與此端點略有差異。
</Note>

<h2 id="freshness">
  新鮮度
</h2>

已結束的 ET 日從最終日歸檔讀取。如果範圍結束於今天（晚於今天的 `endDate` 會被截斷到今天），會再加上當天撮合的即時彙總，因此當天部分會隨投注撮合即時更新。

<h2 id="request">
  請求
</h2>

`GET /exchange/getMatchedVolume`

<ParamField query="startDate" type="string" required>
  範圍的第一個 ET 日曆日，`YYYY-MM-DD`（含）。
</ParamField>

<ParamField query="endDate" type="string" required>
  範圍的最後一個 ET 日曆日，`YYYY-MM-DD`（含）。不得早於 `startDate`。晚於今天的日期會被截斷到今天。
</ParamField>

<CodeGroup>
  ```bash curl theme={null}
  curl "https://api.4casters.io/exchange/getMatchedVolume?startDate=2026-08-10&endDate=2026-08-11" \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```
</CodeGroup>

<h2 id="response">
  回應
</h2>

<ResponseField name="data" type="object">
  <Expandable title="data">
    <ResponseField name="startDate" type="string">所請求開始日期的回顯。</ResponseField>
    <ResponseField name="endDate" type="string">所請求結束日期的回顯（截斷前）。</ResponseField>
    <ResponseField name="matchedVolume" type="number">以美元計的已撮合成交量總計：範圍內每筆已撮合投注雙方本金（風險額 + 可贏額）之和。</ResponseField>
  </Expandable>
</ResponseField>

```json 回應示例 theme={null}
{
  "data": {
    "startDate": "2026-08-10",
    "endDate": "2026-08-11",
    "matchedVolume": 6447933.012757301
  }
}
```

<h2 id="rate-limits">
  速率限制
</h2>

沒有端點級限制 — 僅適用 [全域每 IP 限制](/zh-Hant/pages/rest/introduction#rate-limiting)（滾動每分鐘 3,000 次請求）。對於儀表盤，每隔幾秒輪詢一次完全足夠；注意已最終確定的日期不會再變化，因此只有包含今天的範圍才有必要重新輪詢。

<h2 id="errors">
  錯誤
</h2>

| 狀態 | 含義 |
| - | - |
| `400` | `startDate` / `endDate` 缺失或格式錯誤（必須為 `YYYY-MM-DD`），或 `startDate` 晚於 `endDate`。 |
| `401` | 認證令牌缺失或無效。 |
| `429` | 超出全域每 IP 速率限制。請遵守 `Retry-After` 回應標頭。 |
| `503` | 觸發了伺服器端 15 秒超時。可以安全重試。 |


## OpenAPI

````yaml GET /exchange/getMatchedVolume
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/getMatchedVolume:
    get:
      tags:
        - Markets
      summary: Get matched volume
      description: >-
        Return total sitewide matched volume for an inclusive range of
        US-Eastern (ET) calendar days.


        Every matched bet contributes the stakes of **both** sides to the total:
        the taker's stake plus the maker's stake (derived from the taker odds).
        Equivalently, from either party's perspective each match contributes
        `risk + win` — your stake plus your potential profit, which is exactly
        the counterparty's stake. Commission is not included.


        Past days are read from a finalized daily archive; a range that ends
        today (or later — the end is clamped to today) additionally includes a
        live aggregate of today's matches, so today's portion updates in real
        time.
      parameters:
        - name: startDate
          in: query
          required: true
          schema:
            type: string
            format: date
            example: '2026-08-01'
          description: First ET calendar day of the range (`YYYY-MM-DD`, inclusive).
        - name: endDate
          in: query
          required: true
          schema:
            type: string
            format: date
            example: '2026-08-11'
          description: >-
            Last ET calendar day of the range (`YYYY-MM-DD`, inclusive). Dates
            after today are clamped to today. Must not be before `startDate`.
      responses:
        '200':
          description: Total matched volume for the range
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      startDate:
                        type: string
                        format: date
                        description: Echo of the requested start date.
                      endDate:
                        type: string
                        format: date
                        description: Echo of the requested end date (before clamping).
                      matchedVolume:
                        type: number
                        description: >-
                          Total matched volume in USD: the sum of both sides'
                          stakes (risk + win) of every bet matched in the range.
                example:
                  data:
                    startDate: '2026-08-10'
                    endDate: '2026-08-11'
                    matchedVolume: 6447933.01
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/HttpError'
    Unauthorized:
      description: Missing or invalid auth token
  schemas:
    HttpError:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message.
  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.