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

# 獲取未撮合訂單

> 列出你在交易所上掛著的未成交訂單

回傳呼叫方當前掛在交易所上、可供撮合的全部**未成交訂單**。

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

`GET /user/getUnmatched`

不接受參數。

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.4casters.io/user/getUnmatched \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```
</CodeGroup>

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

<ResponseField name="data.unmatched" type="array">
  未成交訂單陣列，按開賽時間升序排列。

  <Expandable title="UnmatchedOrder">
    <ResponseField name="id" type="string">訂單 ID。</ResponseField>
    <ResponseField name="txID" type="string">訂單建立的事務 ID。</ResponseField>
    <ResponseField name="type" type="string">`moneyline`、`spread`、`total` 或 `moneyline1x2`。</ResponseField>
    <ResponseField name="bet" type="number">原始 `bet`（風險額）。</ResponseField>
    <ResponseField name="odds" type="integer">美式賠率。</ResponseField>
    <ResponseField name="spread" type="number">出現在 `spread` 上。</ResponseField>
    <ResponseField name="total" type="number">出現在 `total` 上。</ResponseField>
    <ResponseField name="participantID" type="string">出現在 `moneyline` 和 `spread` 上 — 所支援的參賽方。</ResponseField>
    <ResponseField name="otherParticipantID" type="string">對方參賽方 ID（被掛出的一側）。</ResponseField>
    <ResponseField name="filled" type="number">已被撮合的風險額。</ResponseField>
    <ResponseField name="offered" type="number">原始掛單金額（已撮合 + 剩餘）。</ResponseField>
    <ResponseField name="remaining" type="number">該訂單上仍可成交的可贏金額（吃單方支付風險額以獲取）。</ResponseField>
    <ResponseField name="takenRatio" type="number">訂單已撮合的比例，介於 `0` 和 `1` 之間。</ResponseField>
    <ResponseField name="expiry" type="string">取消時間戳記（ISO 8601）。未設定過期時間時為 `null`。</ResponseField>
    <ResponseField name="createdAt" type="string">ISO 8601 時間戳記。</ResponseField>
    <ResponseField name="origin" type="string">`offer` 或 `wager`。</ResponseField>
    <ResponseField name="userReference" type="string">下單時保留的用戶端自定義識別碼。</ResponseField>
    <ResponseField name="wagerRequestID" type="string">伺服器生成的 ID，將原始下單請求產生的每一筆成交 / 掛單歸為一組。</ResponseField>
    <ResponseField name="graded" type="boolean">始終為 `false`。</ResponseField>

    <ResponseField name="closed" type="boolean" />

    <ResponseField name="adminRefund" type="boolean" />

    <Snippet file="zh-Hant/types/game-summary.mdx" />
  </Expandable>
</ResponseField>

<h3 id="example">
  示例
</h3>

<CodeGroup>
  ```json JSON theme={null}
  {
    "data": {
      "unmatched": [
        {
          "id": "62851e3bd54b74e52c39953c",
          "txID": "62851e3bd54b74e52c39953b",
          "type": "moneyline",
          "bet": 100,
          "odds": 165,
          "spread": null,
          "total": null,
          "participantID": "6165e6e23c65e61a09bf1f73",
          "otherParticipantID": "626dca8a83899580a06ba87e",
          "filled": 0,
          "offered": 100,
          "remaining": 100,
          "takenRatio": 0,
          "expiry": "2022-05-18T23:08:00.000Z",
          "createdAt": "2022-05-18T16:26:35.601Z",
          "origin": "offer",
          "graded": false,
          "closed": false,
          "adminRefund": false,
          "game": {
            "id": "62823d9d75d894042dfee218",
            "league": "NHL",
            "sport": "hockey",
            "start": "2022-05-18T23:08:00.000Z",
            "ended": false,
            "eventName": "NEW YORK RANGERS VS CAROLINA HURRICANES",
            "isFutures": false,
            "participants": [/* ... */]
          }
        }
      ]
    }
  }
  ```
</CodeGroup>


## OpenAPI

````yaml GET /user/getUnmatched
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/getUnmatched:
    get:
      tags:
        - User
      summary: Get unmatched orders
      description: >-
        Return all of the caller's open (unmatched) orders that are currently
        resting on the exchange and available to be matched.
      responses:
        '200':
          description: Unmatched orders list
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      unmatched:
                        type: array
                        items:
                          $ref: '#/components/schemas/UnmatchedOrder'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    UnmatchedOrder:
      type: object
      description: An open order that is currently resting on the exchange.
      properties:
        id:
          type: string
        txID:
          type: string
        type:
          $ref: '#/components/schemas/MarketType'
        bet:
          type: number
        odds:
          type: integer
        spread:
          type: number
          nullable: true
        total:
          type: number
          nullable: true
        participantID:
          type: string
          description: Present for `moneyline` / `spread`.
        otherParticipantID:
          type: string
          description: The opposite participant id (the one whose side is being offered).
        expiry:
          type: string
          format: date-time
          nullable: true
        filled:
          type: number
        offered:
          type: number
        remaining:
          type: number
        takenRatio:
          type: number
        createdAt:
          type: string
          format: date-time
        origin:
          type: string
          description: '`offer` or `wager`.'
        graded:
          type: boolean
        closed:
          type: boolean
        adminRefund:
          type: boolean
        userReference:
          type: string
        wagerRequestID:
          type: string
        game:
          $ref: '#/components/schemas/GameSummary'
    MarketType:
      type: string
      enum:
        - moneyline
        - spread
        - total
        - moneyline1x2
      description: >-
        Market type. `moneyline1x2` is **soccer-only** (three-way money line:
        home / away / draw).
    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.