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

# Consultar historial de deals

> Deals de una cuenta verificada por timestamps Unix y paginación.

Envía `from` y `to` en segundos UTC, ambos incluidos. `offset` comienza en cero
y `total` admite de 1 a 100 registros (100 por defecto).

Consulta [la guía de historial](https://api-trading-docs.ap-markets.com/es/deals.md) para permisos, campos financieros,
comisiones de entrada, cierres parciales y resultado por posición.


## OpenAPI

````yaml es/openapi.json GET /api/v1/accounts/{login}/deals
openapi: 3.1.0
info:
  title: AP Markets API — Partner Portal
  description: >-
    Endpoints seguros para verificar la propiedad de cuentas, consultar el
    mercado y operar en cuentas previamente verificadas.
  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:
        - Cuentas
      summary: Consultar historial de deals
      description: >-
        Consulta deals de una cuenta verificada entre timestamps Unix inclusivos
        en segundos. Incluye entradas, salidas, reversiones y saldo; no es un
        resumen de posiciones cerradas. Relaciona por PositionID y deduplica por
        Deal. Mantén from/to fijos al paginar con offset y total; termina con
        una página vacía o corta. Storage es swap. Conserva los signos de
        Profit, Storage, Commission y Fee; los valores ausentes no son cero.
      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: >-
              Inicio incluido: segundos Unix desde 1970-01-01 UTC, no
              milisegundos.
            title: From
          description: >-
            Inicio incluido: segundos Unix desde 1970-01-01 UTC, no
            milisegundos.
        - name: to
          in: query
          required: true
          schema:
            type: integer
            maximum: 253402300799
            minimum: 0
            description: >-
              Fin incluido: segundos Unix desde 1970-01-01 UTC; debe ser mayor o
              igual que from.
            title: To
          description: >-
            Fin incluido: segundos Unix desde 1970-01-01 UTC; debe ser mayor o
            igual que from.
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            maximum: 4294967295
            minimum: 0
            description: >-
              Desplazamiento desde cero en el historial MT5 sin filtrar de este
              rango.
            default: 0
            title: Desplazamiento
          description: >-
            Desplazamiento desde cero en el historial MT5 sin filtrar de este
            rango.
        - name: total
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            description: Máximo de deals por página, no el total de deals del rango.
            default: 100
            title: Total
          description: Máximo de deals por página, no el total de deals del rango.
      responses:
        '200':
          description: Respuesta satisfactoria
          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: Ticket único del deal; úsalo para deduplicar el historial.
        Login:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
          title: Login
          description: Cuenta verificada a la que pertenece este 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: >-
            Identificador de posición que relaciona entradas y salidas. Cero
            puede identificar un movimiento sin posición.
        Symbol:
          anyOf:
            - type: string
            - type: 'null'
          title: Símbolo
        Action:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Action
          description: >-
            Acción MT5: 0 compra, 1 venta; otros valores incluyen movimientos de
            saldo y comisión.
        Entry:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Entry
          description: >-
            Entrada MT5: 0 entrada, 1 salida, 2 reversión, 3 cierre por posición
            opuesta. Una salida puede ser parcial.
        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: Fecha del deal como timestamp Unix en segundos.
        TimeMsc:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Timemsc
          description: Fecha del deal como timestamp Unix en milisegundos.
        Digits:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Decimales
        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: Precio
        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: Volumen
          description: 'Volumen del deal en unidades MT5: 10000 = 1 lote.'
        VolumeExt:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Volumeext
          description: >-
            Volumen extendido: 100000000 = 1 lote. Representación alternativa de
            Volume, no volumen adicional.
        VolumeClosed:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Volumeclosed
          description: 'Volumen cerrado en unidades MT5: 10000 = 1 lote.'
        VolumeClosedExt:
          anyOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              minimum: 0
            - type: 'null'
          title: Volumeclosedext
          description: 'Volumen cerrado extendido: 100000000 = 1 lote.'
        Profit:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Profit
          description: Beneficio del deal en moneda de la cuenta, según MT5.
        Storage:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Storage
          description: >-
            Swap contabilizado en este deal, en moneda de la cuenta. Es el campo
            Manager para swap.
        Commission:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Commission
          description: >-
            Comisión con signo de este deal en moneda de la cuenta; puede
            cobrarse en la entrada.
        Fee:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Fee
          description: >-
            Cargo adicional con signo en moneda de la cuenta. Ausente o null no
            equivale a cero.
      additionalProperties: false
      type: object
      required:
        - Deal
        - Login
        - Time
      title: DealData
      description: Deals históricos de la cuenta, con campos financieros públicos.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      description: >-
        Envía el token entregado por el proveedor en el encabezado Authorization
        mediante autenticación Bearer.

````

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