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

# Polymarket 市场

> 获取 Polymarket 市场

Markets 从 Polymarket Gamma 获取市场数据。AIsa 路由直接返回上游 Gamma 响应，即由市场对象组成的顶层 JSON 数组。

**最适合：** 发现预测市场，以及按 slug、条件 ID、CLOB token ID、日期、交易量或关闭/开放状态进行筛选。

**端点：** `GET /polymarket/markets`

## 示例

```curl theme={null}
curl -X GET "https://api.aisa.one/apis/v1/polymarket/markets?limit=5&closed=false" \
  -H "Authorization: Bearer $AISA_API_KEY"
```

## 响应

响应是一个 JSON 数组。每一项都是 Polymarket Gamma 市场对象，包含 `id`、`question`、`slug`、`conditionId`、`clobTokenIds`、`outcomes`、`outcomePrices`、`active`、`closed`、`volume`、`liquidity`、`bestBid` 和 `bestAsk` 等字段。


## OpenAPI

````yaml openapi/zh/polymarket-openapi.json GET /polymarket/markets
openapi: 3.0.3
info:
  title: AIsa API proxy
  description: 预测市场 API。
  version: 0.0.1
servers:
  - url: https://api.aisa.one/apis/v1
security:
  - BearerAuth: []
paths:
  /polymarket/markets:
    get:
      summary: 获取市场
      description: >-
        获取 Polymarket Gamma 市场数据。此 AIsa 路由直接返回上游 Polymarket Gamma 响应：由市场对象组成的顶层
        JSON 数组。
      operationId: get_polymarket-markets
      parameters:
        - name: limit
          in: query
          required: false
          description: 要返回的最大市场数量。
          schema:
            type: integer
            minimum: 0
            example: 20
        - name: offset
          in: query
          required: false
          description: 基于偏移量的分页中要跳过的市场数量。
          schema:
            type: integer
            minimum: 0
            example: 0
        - name: order
          in: query
          required: false
          description: 用于排序的字段列表，以逗号分隔。
          schema:
            type: string
            example: volume
        - name: ascending
          in: query
          required: false
          description: 为 true 时按升序排序。
          schema:
            type: boolean
            example: false
        - name: id
          in: query
          required: false
          description: 按一个或多个 Polymarket 市场 ID 筛选。
          schema:
            type: array
            items:
              type: integer
            example:
              - 540817
          style: form
          explode: true
        - name: slug
          in: query
          required: false
          description: 按一个或多个市场 slug 筛选。
          schema:
            type: array
            items:
              type: string
            example:
              - new-rhianna-album-before-gta-vi-926
          style: form
          explode: true
        - name: clob_token_ids
          in: query
          required: false
          description: 按一个或多个 CLOB token ID 筛选。
          schema:
            type: array
            items:
              type: string
          style: form
          explode: true
        - name: condition_ids
          in: query
          required: false
          description: 按一个或多个市场条件 ID 筛选。
          schema:
            type: array
            items:
              type: string
            example:
              - >-
                0x1fad72fae204143ff1c3035e99e7c0f65ea8d5cd9bd1070987bd1a3316f772be
          style: form
          explode: true
        - name: volume_num_min
          in: query
          required: false
          description: 最低总量。
          schema:
            type: number
            example: 1000
        - name: volume_num_max
          in: query
          required: false
          description: 最大总成交量。
          schema:
            type: number
            example: 1000000
        - name: start_date_min
          in: query
          required: false
          description: 筛选在此 ISO 时间戳之后开始的市场。
          schema:
            type: string
            format: date-time
            example: '2025-01-01T00:00:00Z'
        - name: start_date_max
          in: query
          required: false
          description: 筛选在此 ISO 时间戳之前开始的市场。
          schema:
            type: string
            format: date-time
            example: '2026-01-01T00:00:00Z'
        - name: end_date_min
          in: query
          required: false
          description: 筛选在此 ISO 时间戳之后结束的市场。
          schema:
            type: string
            format: date-time
            example: '2025-01-01T00:00:00Z'
        - name: end_date_max
          in: query
          required: false
          description: 筛选在此 ISO 时间戳之前结束的市场。
          schema:
            type: string
            format: date-time
            example: '2026-01-01T00:00:00Z'
        - name: tag_id
          in: query
          required: false
          description: 按标签 ID 筛选。
          schema:
            type: integer
            example: 1
        - name: closed
          in: query
          required: false
          description: 按市场是否已关闭筛选。
          schema:
            type: boolean
            default: false
            example: false
        - name: include_tag
          in: query
          required: false
          description: 为 true 时包含标签元数据。
          schema:
            type: boolean
            example: true
      responses:
        '200':
          description: Polymarket 市场对象的顶层数组
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                  properties:
                    id:
                      type: string
                      example: '540817'
                    question:
                      type: string
                      example: New Rihanna Album before GTA VI?
                    slug:
                      type: string
                      example: new-rhianna-album-before-gta-vi-926
                    conditionId:
                      type: string
                      example: >-
                        0x1fad72fae204143ff1c3035e99e7c0f65ea8d5cd9bd1070987bd1a3316f772be
                    clobTokenIds:
                      description: Polymarket CLOB token ID。上游 Gamma API 可能会将其编码为 JSON 字符串。
                      oneOf:
                        - type: string
                        - type: array
                          items:
                            type: string
                    outcomes:
                      description: 市场结果。上游 Gamma API 可能会将其编码为 JSON 字符串。
                      oneOf:
                        - type: string
                        - type: array
                          items:
                            type: string
                    outcomePrices:
                      description: 结果价格。上游 Gamma API 可能会将其编码为 JSON 字符串。
                      oneOf:
                        - type: string
                        - type: array
                          items:
                            type: string
                    active:
                      type: boolean
                    closed:
                      type: boolean
                    liquidity:
                      type: string
                    volume:
                      type: string
                    volumeNum:
                      type: number
                    bestBid:
                      type: number
                    bestAsk:
                      type: number
                    startDate:
                      type: string
                      format: date-time
                    endDate:
                      type: string
                      format: date-time
                    image:
                      type: string
                    icon:
                      type: string
                    description:
                      type: string
        '400':
          description: 错误请求 - 参数无效或验证错误
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Invalid search parameter
                  message:
                    type: string
                    example: search must be at least 2 characters long
              examples:
                search_too_short:
                  summary: Search query too short
                  value:
                    error: Invalid search parameter
                    message: search must be at least 2 characters long
                search_with_other_params:
                  summary: Search with other parameters
                  value:
                    error: Invalid query parameters
                    message: >-
                      search parameter cannot be used with other filter
                      parameters
                invalid_limit:
                  summary: Invalid limit
                  value:
                    error: Invalid limit parameter
                    message: limit must be a number between 1 and 100
        '500':
          description: 内部服务器错误
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Internal Server Error
                  message:
                    type: string
                    example: Failed to fetch markets data
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: AISA API Key
      description: 您的 AIsa API 密钥，作为 Bearer token 提供。

````