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

# Positions Expiring

> Get positions in markets that are active within a time window. Merges data from Polymarket and Kalshi, sorted by soonest activity. Useful for pre-resolution position review and exit planning.

Get positions in markets that are active within a time window.

## Overview

Returns positions from both **Polymarket** and **Kalshi** that have been active within the specified hours window. Useful for:

* **Pre-resolution position review** — see which positions may need attention soon
* **Exit planning** before market closes
* **Avoiding surprise resolutions**

### Parameters

| Param    | Type    | Default | Description                                     |
| -------- | ------- | ------- | ----------------------------------------------- |
| `hours`  | integer | 24      | Time window in hours (1–168, i.e. up to 1 week) |
| `venue`  | string  | `all`   | `all`, `polymarket`, or `kalshi`                |
| `limit`  | integer | 50      | Max results (1–200)                             |
| `offset` | integer | 0       | Pagination offset                               |

<Tip>
  **Cross-venue by default.** The `venue` parameter defaults to `all`, returning merged positions from both Polymarket and Kalshi sorted by soonest activity. Each position is tagged with a `venue` field.
</Tip>

## Example

<Tabs>
  <Tab title="curl">
    ```bash theme={null}
    curl -X GET "https://www.aionmarket.com/bvapi/markets/positions/expiring?hours=24&venue=all&limit=50" \
      -H "Authorization: Bearer YOUR_API_KEY"
    ```
  </Tab>

  <Tab title="Python SDK">
    ```python theme={null}
    from aion_sdk import AionMarketClient

    client = AionMarketClient(api_key="YOUR_API_KEY")

    # Default: 24h window, all venues
    positions = client.get_positions_expiring()

    # Custom: 48h window, Kalshi only
    kalshi_positions = client.get_positions_expiring(hours=48, venue="kalshi", limit=20)
    ```
  </Tab>
</Tabs>

## Response Example

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "positions": [
      {
        "id": "12345",
        "venue": "polymarket",
        "title": "Will BTC exceed $100k by June?",
        "side": "Yes",
        "shares": 50,
        "avgPrice": 0.62,
        "currentPrice": 0.75,
        "pnl": 6.5,
        "resolutionTimestamp": "1720000000000",
        "hoursUntilResolution": 18.5
      },
      {
        "id": "67890",
        "venue": "kalshi",
        "marketId": "KXBTC-100K-JUN",
        "title": "KXBTC-100K-JUN",
        "side": "yes",
        "shares": 10,
        "avgPrice": 0.55,
        "currentPrice": 0.70,
        "pnl": 1.5,
        "resolutionTimestamp": "1720050000000",
        "hoursUntilResolution": 22.3
      }
    ],
    "total": 2,
    "hours": 24,
    "venue": "all"
  }
}
```


## OpenAPI

````yaml GET /markets/positions/expiring
openapi: 3.1.0
info:
  title: Aion AI Agent API
  description: >-
    API for agent registration, wallet onboarding, market discovery, order
    management, and execution on Aion.
  version: 1.0.0
  contact:
    name: Aion Support
    email: info@aionmarket.com
    url: https://docs.aionmarket.com
servers:
  - url: https://www.aionmarket.com/bvapi
    description: Aion API
security:
  - bearerAuth: []
tags:
  - name: Agent Management
  - name: Market Operations
  - name: Order Management
  - name: Trading
  - name: Kalshi
  - name: Skills
  - name: Wallet Management
  - name: Trades & Leaderboard
  - name: Utilities
  - name: Settings
  - name: Positions & Portfolio
  - name: Fee Charging
paths:
  /markets/positions/expiring:
    get:
      tags:
        - Positions & Portfolio
      summary: Positions Expiring
      description: >-
        Get positions in markets that are active within a time window. Merges
        data from Polymarket and Kalshi, sorted by soonest activity. Useful for
        pre-resolution position review and exit planning.
      operationId: positionsExpiring
      parameters:
        - name: hours
          in: query
          required: false
          schema:
            type: integer
            default: 24
            minimum: 1
            maximum: 168
          description: >-
            Hours until resolution (1-168). Returns positions active within this
            window.
        - name: venue
          in: query
          required: false
          schema:
            type: string
            default: all
            enum:
              - all
              - polymarket
              - kalshi
          description: 'Venue filter: all, polymarket, or kalshi.'
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            default: 50
            minimum: 1
            maximum: 200
          description: Max results to return.
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            default: 0
            minimum: 0
          description: Pagination offset.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionsExpiringResponse'
components:
  schemas:
    PositionsExpiringResponse:
      type: object
      properties:
        positions:
          type: array
          items:
            $ref: '#/components/schemas/ExpiringPositionItem'
          description: Positions expiring within the requested window
        total:
          type: integer
          example: 12
          description: Total count before pagination
        hours:
          type: integer
          example: 24
          description: Requested hours window
        venue:
          type: string
          example: all
          description: Applied venue filter
    ExpiringPositionItem:
      type: object
      properties:
        id:
          type: string
          example: '12345'
          description: Position record ID
        venue:
          type: string
          example: polymarket
          description: 'Venue: polymarket or kalshi'
        marketId:
          type: string
          nullable: true
          description: Market condition ID (polymarket) or market ticker (kalshi)
        title:
          type: string
          nullable: true
          description: Market / event title
        side:
          type: string
          example: 'Yes'
          description: Side / outcome
        shares:
          type: number
          example: 50
          description: Position size (shares)
        avgPrice:
          type: number
          example: 0.62
          description: Average entry price
        currentPrice:
          type: number
          example: 0.75
          description: Current market price
        pnl:
          type: number
          example: 6.5
          description: Unrealised PnL
        resolutionTimestamp:
          type: string
          nullable: true
          example: '1720000000000'
          description: Estimated resolution timestamp (ms)
        hoursUntilResolution:
          type: number
          nullable: true
          example: 18.5
          description: Hours until resolution
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      x-default: YOUR_API_KEY

````