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

# 活动

> 获取活动

Activity 从 Polymarket 获取链上交易活动，并可按用户钱包、市场、条件和时间范围进行筛选。返回的活动记录包括 MERGES、SPLITS 和 REDEEMS，它们代表平台上不同类型的仓位管理操作。

**最适合：** 跟踪钱包活动、监控仓位变化、分析赎回模式以及审计链上交易操作。

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

## 示例

```curl theme={null}
curl -X GET "https://api.aisa.one/apis/v1/polymarket/activity?user=0x7c3db723f1d4d8cb9c550095203b686cb11e5c6b&limit=50" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"
```

## 响应

响应返回一个 `activities` 数组，其中包含活动对象，字段包括 side（MERGE/SPLIT/REDEEM）、shares、price、交易哈希、时间戳和用户钱包地址。包含 `has_more` 和 `pagination_key` 字段的 `pagination` 对象支持使用游标对大型结果集进行分页。


## OpenAPI

````yaml openapi/zh/polymarket-openapi.json GET /polymarket/activity
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/activity:
    get:
      summary: 获取活动
      description: 获取符合必填用户/钱包筛选条件的 Polymarket 活动，并支持可选的市场、条件和时间范围筛选。
      operationId: get_polymarket-activity
      parameters:
        - name: user
          in: query
          required: true
          description: 钱包地址或用户标识符。运行时路由要求提供此项。
          schema:
            type: string
            pattern: ^0x[0-9a-fA-F]{40}$
            example: '0x7c3db723f1d4d8cb9c550095203b686cb11e5c6b'
        - name: start_time
          in: query
          required: false
          description: 筛选从此 Unix 时间戳（秒）开始的活动（含此时间点）
          schema:
            type: integer
            example: 1640995200
        - name: end_time
          in: query
          required: false
          description: 筛选截至此 Unix 时间戳（秒）的活动（含该时间点）
          schema:
            type: integer
            example: 1672531200
        - name: market_slug
          in: query
          required: false
          description: 按市场 slug 筛选活动
          schema:
            type: string
            example: bitcoin-up-or-down-july-25-8pm-et
        - name: condition_id
          in: query
          required: false
          description: 按条件 ID 筛选活动
          schema:
            type: string
            example: '0x4567b275e6b667a6217f5cb4f06a797d3a1eaf1d0281fb5bc8c75e2046ae7e57'
        - name: limit
          in: query
          required: false
          description: 要返回的活动数量（1-1000）
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 100
            example: 50
        - name: pagination_key
          in: query
          required: false
          description: 用于高效分页的 Base64 编码游标。在上一个响应的 pagination 对象中返回。
          schema:
            type: string
            example: >-
              eyJibG9ja190aW1lc3RhbXAiOiIyMDI1LTAxLTE5VDEyOjAwOjAwLjAwMFoiLCJzaWRlIjoiU1BMSVQiLCJ0eF9oYXNoIjoiMHgxMjM0NTY3ODkwYWJjZGVmIiwibG9nX2luZGV4IjoxMCwidG90YWwiOjE5ODkwMTc3Nn0=
      responses:
        '200':
          description: 带分页的活动响应
          content:
            application/json:
              schema:
                type: object
                properties:
                  activities:
                    type: array
                    items:
                      type: object
                      properties:
                        token_id:
                          type: string
                          example: ''
                        side:
                          type: string
                          enum:
                            - MERGE
                            - SPLIT
                            - REDEEM
                          example: REDEEM
                        market_slug:
                          type: string
                          example: will-the-doj-charge-boeing
                        condition_id:
                          type: string
                          example: >-
                            0x92e4b1b8e0621fab0537486e7d527322569d7a8fd394b3098ff4bb1d6e1c0bbd
                        shares:
                          type: number
                          example: 187722726
                          description: 原始股份数量（来自区块链）
                        shares_normalized:
                          type: number
                          example: 187.722726
                          description: 标准化后的股份数量（原始值除以 1000000）
                        price:
                          type: number
                          example: 1
                        block_number:
                          type: integer
                          description: 活动发生时的区块编号
                          example: 123456789
                        log_index:
                          type: integer
                          description: 区块中活动事件的日志索引
                          example: 42
                        tx_hash:
                          type: string
                          example: >-
                            0x028baff23a90c10728606781d15077098ee93c991ea204aa52a0bd2869187574
                        title:
                          type: string
                          example: Will the DOJ charge Boeing?
                        timestamp:
                          type: integer
                          description: 活动发生时的 Unix 时间戳（秒）
                          example: 1721263049
                        order_hash:
                          type: string
                          example: ''
                        user:
                          type: string
                          description: 用户钱包地址
                          example: '0xfd9c3e7f8c56eb4186372f343c873cce154b3873'
                  pagination:
                    type: object
                    properties:
                      limit:
                        type: integer
                        example: 50
                      count:
                        type: integer
                        description: 符合筛选条件的活动总数
                        example: 1250
                      has_more:
                        type: boolean
                        description: 是否还有更多活动可用
                        example: true
                      pagination_key:
                        type: string
                        description: 用于下一页的 Base64 编码游标。仅当存在更多结果时才会提供。
                        example: >-
                          eyJibG9ja190aW1lc3RhbXAiOiIyMDI1LTAxLTE5VDEyOjAwOjAwLjAwMFoiLCJzaWRlIjoiU1BMSVQiLCJ0eF9oYXNoIjoiMHgxMjM0NTY3ODkwYWJjZGVmIiwibG9nX2luZGV4IjoxMCwidG90YWwiOjE5ODkwMTc3Nn0=
        '400':
          description: 错误请求 - 参数无效或验证错误
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Missing required parameter
                  message:
                    type: string
                    example: user parameter is required
              examples:
                invalid_start_time:
                  summary: Invalid start_time parameter
                  value:
                    error: Invalid start_time parameter
                    message: start_time must be a valid Unix timestamp
                invalid_end_time:
                  summary: Invalid end_time parameter
                  value:
                    error: Invalid end_time parameter
                    message: end_time must be a valid Unix timestamp
                invalid_time_range:
                  summary: Invalid time range
                  value:
                    error: Invalid time range
                    message: start_time must be less than end_time
                invalid_limit:
                  summary: Invalid limit
                  value:
                    error: Invalid limit parameter
                    message: limit must be a number between 1 and 1000
                invalid_pagination_key:
                  summary: Invalid pagination key
                  value:
                    error: Invalid pagination key
                    message: pagination_key is invalid or corrupted
                invalid_filter_combination:
                  summary: Invalid filter combination
                  value:
                    error: Invalid filter combination
                    message: Only one of market_slug or condition_id can be provided
        '500':
          description: 内部服务器错误
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Internal Server Error
                  message:
                    type: string
                    example: Failed to fetch activity data
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: AISA API Key
      description: 您的 AIsa API 密钥，作为 Bearer token 提供。

````