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

# Active Position

> Currently held (open) positions with unrealized PnL for a wallet or cohort. One row per position token; open (unresolved) markets only.



## OpenAPI

````yaml /openapi.json post /api/v1/positions/active
openapi: 3.0.3
info:
  title: DataDash Analytics API
  version: 1.0.0
servers: []
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /api/v1/positions/active:
    post:
      tags:
        - Positions
      summary: Active Position
      description: >-
        Currently held (open) positions with unrealized PnL for a wallet or
        cohort. One row per position token; open (unresolved) markets only.
      operationId: listPositionsActive
      requestBody:
        content:
          application/json:
            schema:
              properties:
                filter:
                  $ref: '#/components/schemas/ActivePositionFilter'
                orderBy:
                  description: >-
                    Sort keys in priority order; the first is the primary sort.
                    Defaults to the table's configured ranking when omitted.
                  items:
                    properties:
                      direction:
                        default: asc
                        enum:
                          - asc
                          - desc
                        type: string
                      field:
                        enum:
                          - positionId
                          - shares
                          - avgBuyPrice
                          - unrealizedCurrentPrice
                          - value
                          - unrealizedPnl
                          - roi
                          - tokenId
                          - invested
                        type: string
                    required:
                      - field
                    type: object
                  type: array
                page:
                  $ref: '#/components/schemas/PageInput'
                searchKey:
                  description: >-
                    Free-text search over: Market (embedding + full-text
                    relevance).
                  type: string
              required:
                - page
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ActivePositionRow'
                type: array
          description: List of Active Position rows
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: >-
            invalid request (malformed body, unknown field, or failed
            validation)
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: missing or invalid credentials
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: credentials lack access to this resource
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: internal error
components:
  schemas:
    ActivePositionFilter:
      description: Filters to apply, combined with AND. Use a group for OR.
      items:
        $ref: '#/components/schemas/ActivePositionFilterNode'
      minItems: 1
      type: array
    PageInput:
      properties:
        limit:
          minimum: 1
          type: integer
        offset:
          minimum: 0
          type: integer
      required:
        - limit
      type: object
    ActivePositionRow:
      properties:
        avgBuyPrice:
          description: Average buying price of open shares
          format: double
          title: Avg Buy Price
          type: number
        invested:
          description: Total amount invested in the position
          format: double
          title: Invested
          type: number
        positionId:
          description: Position token identifier
          format: int32
          title: Position
          type: integer
        roi:
          description: Return on investment percentage
          format: double
          title: Roi
          type: number
        shares:
          description: Currently held shares
          format: double
          title: Shares
          type: number
        tokenId:
          description: >-
            The CLOB token ID representing the position. Links to token lookup
            table.
          format: big-integer
          title: Token ID
          type: string
        unrealizedCurrentPrice:
          description: Current price of the position
          format: double
          title: Current Price
          type: number
        unrealizedPnl:
          description: Unrealized profit and loss
          format: double
          title: Open PnL
          type: number
        value:
          description: Current market value of held shares
          format: double
          title: Value
          type: number
      type: object
    Error:
      properties:
        code:
          description: machine-readable error code
          type: string
        message:
          description: human-readable description
          type: string
      required:
        - code
        - message
      type: object
    ActivePositionFilterNode:
      description: A single condition, or a group combining conditions with AND/OR.
      oneOf:
        - $ref: '#/components/schemas/ActivePositionCondition'
        - $ref: '#/components/schemas/ActivePositionFilterGroup'
    ActivePositionCondition:
      description: >-
        A single field condition. in/notIn take an array of values;
        matches/notMatches take one search term.
      oneOf:
        - $ref: '#/components/schemas/ActivePositionNumericCondition'
        - $ref: '#/components/schemas/ActivePositionIdCondition'
        - $ref: '#/components/schemas/ActivePositionAddressCondition'
    ActivePositionFilterGroup:
      description: >-
        A group of conditions and nested groups, combined with the group's
        operator.
      properties:
        filters:
          items:
            oneOf:
              - $ref: '#/components/schemas/ActivePositionCondition'
              - $ref: '#/components/schemas/ActivePositionFilterInnerGroup'
          minItems: 1
          type: array
        operator:
          enum:
            - AND
            - OR
          type: string
      required:
        - operator
        - filters
      type: object
    ActivePositionNumericCondition:
      properties:
        field:
          enum:
            - shares
            - value
            - unrealizedPnl
            - invested
          type: string
        operator:
          enum:
            - eq
            - neq
            - lt
            - lte
            - gt
            - gte
          type: string
        value:
          oneOf:
            - format: double
              type: number
            - items:
                format: double
                type: number
              minItems: 1
              type: array
      required:
        - field
        - operator
        - value
      type: object
    ActivePositionIdCondition:
      properties:
        field:
          enum:
            - positionId
            - marketId
            - eventId
            - tagIds
          type: string
        operator:
          enum:
            - in
            - notIn
          type: string
        value:
          oneOf:
            - format: int32
              type: integer
            - items:
                format: int32
                type: integer
              minItems: 1
              type: array
      required:
        - field
        - operator
        - value
      type: object
    ActivePositionAddressCondition:
      description: inCohort/notInCohort take cohort ids instead of addresses.
      properties:
        field:
          enum:
            - userId
          type: string
        operator:
          enum:
            - in
            - notIn
            - matches
            - notMatches
            - inCohort
            - notInCohort
          type: string
        value:
          oneOf:
            - type: string
            - items:
                type: string
              minItems: 1
              type: array
      required:
        - field
        - operator
        - value
      type: object
    ActivePositionFilterInnerGroup:
      description: >-
        A nested group. Its members must be conditions, which bounds grouping at
        two levels.
      properties:
        filters:
          items:
            $ref: '#/components/schemas/ActivePositionCondition'
          minItems: 1
          type: array
        operator:
          enum:
            - AND
            - OR
          type: string
      required:
        - operator
        - filters
      type: object
  securitySchemes:
    ApiKeyAuth:
      description: API key issued for programmatic access.
      in: header
      name: X-Api-Key
      type: apiKey
    BearerAuth:
      bearerFormat: JWT
      description: User access token.
      scheme: bearer
      type: http

````