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

# Query deal history

> Read a verified account's deals using Unix timestamps and pagination.

Send `from` and `to` in UTC seconds, both inclusive. `offset` starts at zero
and `total` accepts 1–100 records (100 by default).

See [the history guide](https://api-trading-docs.ap-markets.com/deals.md) for permissions, financial fields, entry commissions,
partial closes and position results.


## OpenAPI

````yaml openapi.json GET /api/v1/accounts/{login}/deals
openapi: 3.1.0
info:
  title: AP Markets API — Partner Portal
  description: >-
    Secure endpoints for account ownership verification, market data, and
    trading on previously verified accounts.
  version: 0.1.0
servers:
  - url: https://api-trading.ap-markets.com
    description: AP Markets API
security: []
paths:
  /api/v1/accounts/{login}/deals:
    get:
      tags:
        - Accounts
      summary: List historical deals
      description: >-
        Read a verified account's MT5 deals between inclusive Unix timestamps in
        seconds. Includes entry, exit, reversal and balance deals; it is not a
        closed-position summary. Use PositionID to link deals and Deal to
        deduplicate. Keep from/to fixed while paging with offset and total; stop
        on an empty or short page. Storage is swap. Preserve the signs of
        Profit, Storage, Commission and Fee; missing values are not zero.
      operationId: account_deals_api_v1_accounts__login__deals_get
      parameters:
        - name: login
          in: path
          required: true
          schema:
            type: integer
            exclusiveMinimum: 0
            title: Login
        - name: from
          in: query
          required: true
          schema:
            type: integer
            maximum: 253402300799
            minimum: 0
            description: >-
              Inclusive start: Unix seconds since 1970-01-01 UTC, not
              milliseconds.
            title: From
          description: >-
            Inclusive start: Unix seconds since 1970-01-01 UTC, not
            milliseconds.
        - name: to
          in: query
          required: true
          schema:
            type: integer
            maximum: 253402300799
            minimum: 0
            description: >-
              Inclusive end: Unix seconds since 1970-01-01 UTC; must be at least
              from.
            title: To
          description: >-
            Inclusive end: Unix seconds since 1970-01-01 UTC; must be at least
            from.
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            maximum: 4294967295
            minimum: 0
            description: >-
              Zero-based offset in the unfiltered MT5 deal history for this
              range.
            default: 0
            title: Offset
          description: Zero-based offset in the unfiltered MT5 deal history for this range.
        - name: total
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            description: Maximum deals per page, not the total number of matching deals.
            default: 100
            title: Total
          description: Maximum deals per page, not the total number of matching deals.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DealsResponse'
        '422':
          description: Invalid request or incompatible trading parameters.
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    type: string
              example:
                detail: Invalid request
      security:
        - HTTPBearer: []
components:
  schemas:
    DealsResponse:
      properties:
        retcode:
          type: string
          title: Retcode
        answer:
          items:
            $ref: '#/components/schemas/DealData'
          type: array
          title: Answer
      additionalProperties: false
      type: object
      required:
        - retcode
        - answer
      title: DealsResponse
    DealData:
      properties:
        Deal:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
          title: Deal
          description: Unique deal ticket; use it to deduplicate history.
        Login:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
          title: Login
          description: Verified account owning this deal.
        Order:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Order
        PositionID:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Positionid
          description: >-
            Position identifier linking entry and exit deals. Zero may identify
            a non-position transaction.
        Symbol:
          anyOf:
            - type: string
            - type: 'null'
          title: Symbol
        Action:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Action
          description: >-
            MT5 deal action: 0 buy, 1 sell; other values include balance and
            commission transactions.
        Entry:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Entry
          description: >-
            MT5 entry: 0 entry, 1 exit, 2 reversal, 3 close-by. An exit can be
            partial.
        Reason:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Reason
        Time:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
          title: Time
          description: Deal time as a Unix timestamp in seconds.
        TimeMsc:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Timemsc
          description: Deal time as a Unix timestamp in milliseconds.
        Digits:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Digits
        DigitsCurrency:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Digitscurrency
        Price:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Price
        PriceSL:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Pricesl
        PriceTP:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Pricetp
        Volume:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Volume
          description: 'Deal volume in MT5 units: 10000 = 1 lot.'
        VolumeExt:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Volumeext
          description: >-
            Extended deal volume: 100000000 = 1 lot. Alternative representation
            of Volume, not an additional volume.
        VolumeClosed:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Volumeclosed
          description: 'Closed volume in MT5 units: 10000 = 1 lot.'
        VolumeClosedExt:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Volumeclosedext
          description: 'Extended closed volume: 100000000 = 1 lot.'
        Profit:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Profit
          description: Deal profit in account currency, as reported by MT5.
        Storage:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Storage
          description: >-
            Swap booked on this deal in account currency. This is the Manager
            field for swap.
        Commission:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Commission
          description: >-
            Signed commission booked on this deal in account currency; may be
            charged on entry.
        Fee:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Fee
          description: >-
            Signed additional fee booked on this deal in account currency.
            Missing or null is not zero.
      additionalProperties: false
      type: object
      required:
        - Deal
        - Login
        - Time
      title: DealData
      description: Account-owned historical deals, with only public financial fields.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      description: >-
        Send the provider-issued token in the Authorization header using Bearer
        authentication.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.