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

# 列出持仓变动

> 查询有效资产数量的变动以进行对账。部分变动不关联订单。

<RequestExample>
  ```bash cURL
  curl --request GET \
    --url 'https://api-sandbox.uqpaytech.com/api/v1/stocks/position/event' \
    --header "Content-Type: application/json" \
    --header "x-auth-token: Bearer ${SANDBOX_TOKEN}"
  ```
</RequestExample>

<ResponseExample>
  ```json 200
  {
    "data": [
      {
        "asset_id": "7453f146-b267-11f1-b4f4-0abd773ba497",
        "created_at": "2026-09-21T01:50:53.561Z",
        "event_id": "664bcfe5-5a26-45dc-82d2-b3f62a35ef4f",
        "order_id": "53fe3d55-85ff-4804-b6f0-a25a32aa082f",
        "quantity_after": "0.00297066689243735",
        "quantity_delta": "0.00297066689243735",
        "symbol": "AAPLx",
        "type": "TRADE"
      }
    ],
    "total_items": 1,
    "total_pages": 1
  }
  ```
</ResponseExample>


## OpenAPI

````yaml /zh/stocks/stocks.yaml get /position/event
openapi: 3.0.3
info:
  title: UQPAY Stocks API
  version: 1.0.0
  description: 浏览资产、获取报价、创建订单并查询订单及持仓。金额和数量使用十进制字符串。
  x-source-en-commit: 586409f
  x-source-en-path: stocks/stocks.yaml
servers:
  - url: https://api-sandbox.uqpaytech.com/api/v1/stocks
    description: Sandbox
security:
  - AuthToken: []
paths:
  /position/event:
    get:
      tags:
        - Stocks
      summary: 列出持仓变动
      description: 查询有效资产数量的变动以进行对账。部分变动不关联订单。
      operationId: listStocksPositionEvents
      parameters:
        - name: page_number
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 1000000
            default: 1
          description: 要查询的页码。
        - name: page_size
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
          description: 每页返回的最大条目数。
        - name: asset_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
          description: List assets 返回的资产标识。
        - name: symbol
          in: query
          required: false
          schema:
            type: string
            maxLength: 32
          description: 按资产代码筛选。
        - name: order_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
          description: 创建或查询订单列表时返回的订单标识。
        - name: from
          in: query
          required: false
          schema:
            type: string
            format: date-time
          description: 变动发生时间范围的起点（包含）；同时提供时，from 必须早于 to。
        - name: to
          in: query
          required: false
          schema:
            type: string
            format: date-time
          description: 变动发生时间范围的终点（不包含）；同时提供时，from 必须早于 to。
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionEventPage'
              examples:
                sandbox:
                  summary: Sandbox response
                  value:
                    data:
                      - asset_id: 7453f146-b267-11f1-b4f4-0abd773ba497
                        created_at: '2026-09-21T01:50:53.561Z'
                        event_id: 664bcfe5-5a26-45dc-82d2-b3f62a35ef4f
                        order_id: 53fe3d55-85ff-4804-b6f0-a25a32aa082f
                        quantity_after: '0.00297066689243735'
                        quantity_delta: '0.00297066689243735'
                        symbol: AAPLx
                        type: TRADE
                    total_items: 1
                    total_pages: 1
        '400':
          description: 请求失败。读取错误响应中的 type、code 和 message。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: 请求失败。读取错误响应中的 type、code 和 message。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: 请求失败。读取错误响应中的 type、code 和 message。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 请求失败。读取错误响应中的 type、code 和 message。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 请求失败。读取错误响应中的 type、code 和 message。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: 请求失败。读取错误响应中的 type、code 和 message。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: 网关未能完成请求。写入操作应先核对结果，再使用同一幂等键重试。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: 请求失败。读取错误响应中的 type、code 和 message。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --request GET \
              --url 'https://api-sandbox.uqpaytech.com/api/v1/stocks/position/event' \
              --header "Content-Type: application/json" \
              --header "x-auth-token: Bearer ${SANDBOX_TOKEN}"
components:
  schemas:
    PositionEventPage:
      type: object
      additionalProperties: false
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/PositionEvent'
          description: 本页记录。空数组可能表示没有匹配记录或页码超出结果范围。
        total_pages:
          type: integer
          format: int64
          minimum: 0
          description: 按请求的每页条数计算的结果总页数。
          example: 1
        total_items:
          type: integer
          format: int64
          minimum: 0
          description: 所有页中符合筛选条件的记录总数。
          example: 1
      required:
        - data
        - total_pages
        - total_items
    Error:
      type: object
      additionalProperties: false
      required:
        - type
        - code
        - message
      properties:
        type:
          type: string
          description: 用于分类处理失败的错误类别。
          pattern: ^[a-z][a-z0-9]*(_[a-z0-9]+)*$
        code:
          type: string
          description: 可供程序处理的业务错误码。结合 HTTP 状态处理，不要依赖 message 文本匹配。
          pattern: ^[a-z][a-z0-9]*(_[a-z0-9]+)*$
        message:
          type: string
          description: 错误原因的可读说明。
    PositionEvent:
      type: object
      additionalProperties: false
      properties:
        event_id:
          type: string
          format: uuid
          description: 持仓变动标识，与 Webhook 投递标识不同。
          example: 664bcfe5-5a26-45dc-82d2-b3f62a35ef4f
        asset_id:
          type: string
          format: uuid
          description: 平台资产 UUID，列表与所有交易接口共用
          example: 7453f146-b267-11f1-b4f4-0abd773ba497
        symbol:
          type: string
          description: 资产代码。
          example: AAPLx
        order_id:
          type: string
          format: uuid
          nullable: true
          description: 关联订单标识；没有关联订单时为 null。
          example: 53fe3d55-85ff-4804-b6f0-a25a32aa082f
        type:
          type: string
          enum:
            - TRADE
            - ADJUSTMENT
          description: 持仓变动类别。
          example: TRADE
        quantity_delta:
          type: string
          pattern: ^-?[0-9]+(\.[0-9]+)?$
          description: 有效数量的有符号变动值：正数表示增加，负数表示减少。
          example: '0.00297066689243735'
        quantity_after:
          type: string
          pattern: ^-?[0-9]+(\.[0-9]+)?$
          description: 应用本次变动后的有效数量。
          example: '0.00297066689243735'
        created_at:
          type: string
          format: date-time
          description: 持仓变动发生时间。
          example: '2026-09-21T01:50:53.561Z'
      required:
        - event_id
        - asset_id
        - symbol
        - order_id
        - type
        - quantity_delta
        - quantity_after
        - created_at
  securitySchemes:
    AuthToken:
      type: apiKey
      in: header
      name: x-auth-token
      description: 由 UQPAY 提供的登录 API Token。

````