# Get Trades

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/account/trades:
    get:
      summary: Get Trades
      deprecated: false
      description: >-
        Retrieves trades of the account the token acts on, executed within the
        specified date range, sorted by timestamp in descending order (use
        `order=ASC` for ascending).


        ### Parameter Specification


        | Parameter       | Accepted Formats | Example Values |

        |-----------------|----------------|----------------|

        | `from`          | ISO 8601 (UTC, ending in `Z`) |
        `2025-09-25T13:45:30Z` (s), `2025-09-25T13:45:30.123Z` (ms),
        `2025-09-25T13:45:30.123456Z` (us) |

        |                 | Epoch           | `1695647130` (s), `1695647130123`
        (ms), `1695647130123456` (us), `1695647130123456789` (ns) |

        |                 | Date            | `2025-09-25` |

        | `to`            | ISO 8601 (UTC, ending in `Z`) |
        `2025-09-26T18:00:00Z` (s), `2025-09-26T18:00:00.456Z` (ms),
        `2025-09-26T18:00:00.456789Z` (us) |

        |                 | Epoch           | `1695734400` (s), `1695734400456`
        (ms), `1695734400456789` (us), `1695734400456789123` (ns) |

        |                 | Date            | `2025-09-26` |

        | `instrument_code` | String         | `BTC_EUR_P` (a single instrument
        code) |

        | `order`          | String         | `ASC` or `DESC` |

        | `max_page_size`  | Integer        | 3 |

        | `cursor`         | String         |
        `eyJlcG9jaCI6IjE3NjQ2NzUxNDk5MzkzNjQwMDEiLCJjcW8iOiIyMTA1MzM3MTM0NDYxMjU3In0=`
        |


        ### Parameter Limits


        | Parameter         | Constraints / Range |

        |------------------|-------------------|

        | `from`           | On or after 2024-01-01; cannot be in the future |

        | `to`             | On or after 2024-01-01; must be strictly after
        `from` and no more than 30 days after `from`; exclusive |

        | `max_page_size`  | Integer between **1** and **100** |

        | `instrument_code` | Optional; must be a valid instrument code |

        | `order`          | Optional; `ASC` or `DESC` (case-insensitive) |


        ### Parameter Defaults


        | Parameter(s)    | Default Behavior |

        |-----------------|-----------------|

        | `from` / `to`   | Neither provided: `from` = midnight UTC of the
        previous day, `to` = present time |

        | `from` / `to`   | Only `from` provided: `to` = 1 day later or present
        time, whichever is smaller |

        | `from` / `to`   | Only `to` provided: `from` = midnight UTC of the day
        before `to` |

        | `instrument_code`| Defaults to all instruments |

        | `order`         | Defaults to `DESC` |

        | `max_page_size` | Defaults to 100 |


        `from`/`to` accept epoch (s, ms, µs or ns) or an ISO 8601 UTC timestamp
        ending in `Z` (or `YYYY-MM-DD`). `from` must be on or after 2024-01-01,
        not in the future, and strictly before `to`; `to` is exclusive.


        `cursor` is an opaque string. Pass the value from the previous response
        unchanged; it is `null` on the last page.


        Unknown query parameters are rejected with `400 UNEXPECTED_PARAMETERS`.


        **Required API scope:** any valid API key. This endpoint is
        rate-limited.
      tags:
        - One Trading Public REST API/Trading
      parameters:
        - name: from
          in: query
          description: >-
            Specifies the start of the period (inclusive). Accepts date strings
            (YYYY-MM-DD), ISO 8601 UTC strings ending in `Z`, or numeric
            timestamps in seconds, milliseconds, microseconds or nanoseconds.
          required: false
          example: '2026-01-01'
          schema:
            type: string
        - name: to
          in: query
          description: >-
            Specifies the end of the period (exclusive). Accepts date strings
            (YYYY-MM-DD), ISO 8601 UTC strings ending in `Z`, or numeric
            timestamps in seconds, milliseconds, microseconds or nanoseconds.
          required: false
          example: '2026-01-30'
          schema:
            type: string
        - name: instrument_code
          in: query
          description: >-
            Instrument code to filter by, e.g. `BTC_EUR_P`. Defaults to all
            instruments.
          required: false
          schema:
            type: string
        - name: max_page_size
          in: query
          description: >-
            Set max desired page size, between 1 and 100. If no value is
            provided, by default a maximum of 100 results per page are returned.
          required: false
          example: '2'
          schema:
            type: string
        - name: cursor
          in: query
          description: >-
            Opaque pointer to the next page, taken unchanged from the `cursor`
            of the previous response.
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: >-
            Sort order by trade time. `DESC` (default) or `ASC`,
            case-insensitive.
          required: false
          schema:
            type: string
            enum:
              - ASC
              - DESC
            default: DESC
      responses:
        '200':
          x-apidog-name: Success
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  trade_history:
                    type: array
                    items:
                      type: object
                      properties:
                        fee:
                          $ref: '#/components/schemas/Fee'
                        trade:
                          $ref: '#/components/schemas/Trade'
                      x-apidog-orders:
                        - fee
                        - trade
                      required:
                        - fee
                        - trade
                      x-apidog-ignore-properties: []
                  max_page_size:
                    type: integer
                    description: The page size applied to this request.
                  cursor:
                    type: string
                    description: >-
                      Opaque cursor for the next page. Pass it unchanged as the
                      `cursor` query parameter; `null` on the last page.
                    nullable: true
                  from:
                    type: string
                    format: date-time
                    description: >-
                      Start of the queried period (ISO 8601, nanosecond
                      precision), after defaults are applied.
                  to:
                    type: string
                    format: date-time
                    description: >-
                      End of the queried period (ISO 8601, nanosecond precision,
                      exclusive), after defaults are applied.
                x-apidog-orders:
                  - trade_history
                  - max_page_size
                  - cursor
                  - from
                  - to
                required:
                  - trade_history
                  - max_page_size
                  - cursor
                  - from
                  - to
                x-apidog-ignore-properties: []
              example:
                trade_history:
                  - fee:
                      fee_amount: '0.0020505'
                      fee_currency: USD
                    trade:
                      account_id: aaaba8bd-3195-4f72-87ff-98720a940f23
                      order_id: 71912cd5-1df2-4c14-3e59-377765d23b01
                      trade_id: aa765409-4719-5358-b27a-3fabedf27164
                      time: '2025-12-02T11:32:32.515Z'
                      time_nanos: '2025-12-02T11:32:32.515915000Z'
                      instrument_code: DOGE_USD_P
                      side: BUY
                      matched_as: TAKER
                      order_type: API
                      price: '0.1367'
                      amount: '100'
                      filled_amount: '100'
                      sequence: '92096745784'
                      open_position_amount: '0'
                      position_id: '1764675149939364'
                  - fee:
                      fee_amount: '0.002052'
                      fee_currency: USD
                    trade:
                      account_id: aaaba8bd-3195-4f72-87ff-98720a940f23
                      order_id: 02f52442-066e-4ebb-3f85-fbe8010d2861
                      trade_id: ed076827-96b9-52af-80fa-b516fd2c02c1
                      time: '2025-12-02T11:32:29.939Z'
                      time_nanos: '2025-12-02T11:32:29.939364000Z'
                      instrument_code: DOGE_USD_P
                      side: BUY
                      matched_as: TAKER
                      order_type: API
                      price: '0.1368'
                      amount: '100'
                      filled_amount: '100'
                      sequence: '92096745379'
                      open_position_amount: '100'
                      position_id: '1764675149939364'
                from: '2025-12-01T00:00:00.000000000Z'
                to: '2025-12-02T12:00:00.000000000Z'
                max_page_size: 2
                cursor: >-
                  eyJlcG9jaCI6IjE3NjQ2NzUxNDk5MzkzNjQwMDEiLCJjcW8iOiIyMTA1MzM3MTM0NDYxMjU3In0=
          headers: {}
        '400':
          x-apidog-name: Bad Request
          description: >-
            Invalid query parameters. Possible codes: `INVALID_FROM_TIMESTAMP`,
            `INVALID_TO_TIMESTAMP`, `INVALID_DATE_RANGE`, `INVALID_PAGE_SIZE`,
            `INVALID_ORDER`, `INVALID_CURSOR`, `INVALID_INSTRUMENT_CODE`,
            `UNEXPECTED_PARAMETERS`.
          content:
            application/json:
              schema: &ref_0
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                '2':
                  summary: INVALID_FROM_TIMESTAMP
                  value:
                    error: INVALID_FROM_TIMESTAMP
                    error_message: From date cannot be in the future
                '3':
                  summary: INVALID_TO_TIMESTAMP
                  value:
                    error: INVALID_TO_TIMESTAMP
                    error_message: To date must be a valid date format
                '4':
                  summary: INVALID_DATE_RANGE
                  value:
                    error: INVALID_DATE_RANGE
                    error_message: >-
                      Date range cannot exceed 30 days. Provided range was
                      greater than 31 days
                '5':
                  summary: INVALID_PAGE_SIZE
                  value:
                    error: INVALID_PAGE_SIZE
                    error_message: 'page_size must be between 1 and 100, got: 200'
                '6':
                  summary: INVALID_ORDER
                  value:
                    error: INVALID_ORDER
                    error_message: 'order must be ''ASC'' or ''DESC'', got: newest'
                '7':
                  summary: INVALID_CURSOR
                  value:
                    error: INVALID_CURSOR
                    error_message: The cursor parameter is invalid or malformed
                '8':
                  summary: INVALID_INSTRUMENT_CODE
                  value:
                    error: INVALID_INSTRUMENT_CODE
                    error_message: >-
                      Invalid instrument codes: FOO_EUR. Valid codes: BTC_EUR,
                      ETH_EUR, BTC_EUR_P, ...
                '9':
                  summary: UNEXPECTED_PARAMETERS
                  value:
                    error: UNEXPECTED_PARAMETERS
                    error_message: >-
                      Unsupported parameter: limit. Allowed: from, to,
                      instrument_code, cursor, order, max_page_size
          headers: {}
        '401':
          description: >-
            Unauthorized. The token was accepted by the gateway but rejected by
            the endpoint: `UNAUTHORIZED`, or `INVALID_REQUEST_SIGNATURE` when
            the API key requires signed requests and the signature is missing or
            invalid.
          content:
            application/json:
              schema: *ref_0
              examples:
                '10':
                  summary: Unauthorized
                  value:
                    error: UNAUTHORIZED
                    error_message: Unauthorized access
                '11':
                  summary: Invalid signature
                  value:
                    error: INVALID_REQUEST_SIGNATURE
                    error_message: The request signature is missing or invalid
          headers: {}
          x-apidog-name: Unauthorized
        '403':
          description: >-
            Forbidden. Either the gateway rejected the token
            (`{"message":"Forbidden"}`), or the endpoint denied the request,
            e.g. `PERMISSION_DENIED` (API key lacks the required scope, or
            account not permitted) or `EXCHANGE_ACCOUNT_NOT_PROVISIONED`.
          content:
            application/json:
              schema:
                oneOf:
                  - *ref_0
                  - $ref: '#/components/schemas/GatewayError'
              examples:
                '12':
                  summary: Gateway
                  value:
                    message: Forbidden
                '13':
                  summary: Permission denied
                  value:
                    error: PERMISSION_DENIED
                    error_message: Permission denied
                '14':
                  summary: Not provisioned
                  value:
                    error: EXCHANGE_ACCOUNT_NOT_PROVISIONED
                    error_message: >-
                      The account is authenticated but has no exchange account
                      yet
          headers: {}
          x-apidog-name: Forbidden
        '429':
          description: >-
            Rate limit exceeded. Limits are per account holder per minute: 600
            (retail), 2,000 (institutional), 10,000 (market maker).
          content:
            application/json:
              schema: *ref_0
              example:
                error: TOO_MANY_REQUESTS
                error_message: Too many requests
          headers: {}
          x-apidog-name: ''
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema: *ref_0
              example:
                error: SERVER_ERROR
                error_message: An internal server error occurred
          headers: {}
          x-apidog-name: Server Error
      security: []
      x-apidog-folder: One Trading Public REST API/Trading
      x-apidog-status: released
      x-run-in-apidog: https://app.eu.apidog.com/web/project/349694/apis/api-3612099-run
components:
  schemas:
    Trade:
      type: object
      properties:
        account_id:
          type: string
          format: uuid
          description: Account ID the trade belongs to
        order_id:
          type: string
          format: uuid
          description: Unique identifier of the order the trade belongs to
        trade_id:
          type: string
          format: uuid
          description: Unique identifier of the trade
        time:
          type: string
          description: The time the trade was executed (ISO 8601, millisecond precision)
          format: date-time
          deprecated: true
        time_nanos:
          type: string
          format: date-time
          description: The time the trade was executed (ISO 8601, nanosecond precision)
        instrument_code:
          type: string
          description: The market identifier for the trade
        side:
          type: string
          enum:
            - BUY
            - SELL
          x-apidog-enum:
            - value: BUY
              name: ''
              description: ''
            - value: SELL
              name: ''
              description: ''
          description: BUY or SELL
        matched_as:
          type: string
          enum:
            - MAKER
            - TAKER
          x-apidog-enum:
            - value: MAKER
              name: ''
              description: ''
            - value: TAKER
              name: ''
              description: ''
          description: MAKER or TAKER
        amount:
          type: string
          description: The quantity that has been executed, expressed in the base currency.
          deprecated: true
        filled_amount:
          type: string
          description: The quantity that has been executed, expressed in the base currency.
        price:
          type: string
          description: The price at which the trade matched at
        sequence:
          type: string
          description: An incremental identifier for tracking the trade in the exchange
        position_id:
          type: string
          description: >-
            Numeric ID (as a string) of the position associated with this trade.
            Present only on futures trades returned by the trades endpoints and
            `GET /v1/account/orders/{order_id}/trades`; never included in trades
            nested in order responses.
        prev_position_id:
          type: string
          description: >-
            Numeric ID (as a string) of the position closed by this trade when
            it causes a position flip (long to short or short to long). Present
            only on futures trades returned by the trades endpoints and `GET
            /v1/account/orders/{order_id}/trades`; never included in trades
            nested in order responses.
        open_position_amount:
          type: string
          description: >-
            The post-execution open position amount. Present only on futures
            trades returned by the trades endpoints and `GET
            /v1/account/orders/{order_id}/trades`; never included in trades
            nested in order responses.
        order_type:
          type: string
          enum:
            - API
            - UI
            - LIQUIDATION
            - TAKE_PROFIT
            - STOP_LOSS
            - INSTANT_TRADE
            - SPOT_LEGACY
            - UNKNOWN
          x-apidog-enum:
            - value: API
              name: ''
              description: ''
            - value: UI
              name: ''
              description: ''
            - value: LIQUIDATION
              name: ''
              description: ''
            - value: TAKE_PROFIT
              name: ''
              description: ''
            - value: STOP_LOSS
              name: ''
              description: ''
            - value: INSTANT_TRADE
              name: ''
              description: ''
            - value: SPOT_LEGACY
              name: ''
              description: ''
            - value: UNKNOWN
              name: ''
              description: ''
          description: >-
            How the order was placed: API, UI, LIQUIDATION, TAKE_PROFIT,
            STOP_LOSS, INSTANT_TRADE, SPOT_LEGACY or UNKNOWN. Returned by every
            endpoint that returns trades.
        time_in_force:
          type: string
          description: >-
            Time in force of the order the trade belongs to. Returned by the
            trades endpoints and `GET /v1/account/orders/{order_id}/trades`; not
            included in trades nested in order responses.
          nullable: true
        liquidation:
          type: boolean
          enum:
            - true
          description: >-
            Present (and `true`) only on trades of liquidation orders nested in
            order responses (`GET /v1/account/orders`, `GET
            /v1/account/orders/{order_id}`, `GET
            /v1/account/orders/client/{client_id}`). Absent otherwise.
      x-apidog-orders:
        - account_id
        - order_id
        - trade_id
        - time
        - time_nanos
        - instrument_code
        - side
        - matched_as
        - amount
        - filled_amount
        - price
        - sequence
        - position_id
        - prev_position_id
        - open_position_amount
        - order_type
        - time_in_force
        - liquidation
      required:
        - account_id
        - order_id
        - trade_id
        - time
        - time_nanos
        - instrument_code
        - side
        - matched_as
        - amount
        - filled_amount
        - price
        - sequence
        - order_type
      x-apidog-folder: ''
      x-apidog-ignore-properties: []
    Fee:
      type: object
      properties:
        fee_amount:
          type: string
          description: The amount paid in the fee currency
        fee_currency:
          type: string
          description: The currency the fee was paid in
      x-apidog-orders:
        - fee_amount
        - fee_currency
      required:
        - fee_amount
        - fee_currency
      x-apidog-folder: ''
      x-apidog-ignore-properties: []
    ErrorResponse:
      type: object
      description: >-
        Error body. `error` is a machine-readable code (e.g.
        `INVALID_INSTRUMENT_CODE`) on most endpoints; a few older endpoints
        return a human-readable message in `error` instead and omit
        `error_message`.
      properties:
        error:
          type: string
          description: Error code (or, on older endpoints, a human-readable message).
        error_message:
          type: string
          description: >-
            Human-readable detail. Present on endpoints that return an error
            code in `error`.
      required:
        - error
      x-apidog-orders:
        - error
        - error_message
      x-apidog-folder: ''
      x-apidog-ignore-properties: []
    GatewayError:
      type: object
      description: >-
        Returned by the API gateway itself when the bearer token is missing,
        invalid, expired or revoked, or the calling IP is not on the API key's
        allowlist.
      properties:
        message:
          type: string
          enum:
            - Forbidden
            - Unauthorized
      required:
        - message
      x-apidog-orders:
        - message
      x-apidog-folder: ''
      x-apidog-ignore-properties: []
  securitySchemes:
    bearerAuth:
      type: bearer
      scheme: bearer
      description: >-
        API key issued to the account holder, sent as `Authorization: Bearer
        <token>`. The key must hold the `SUBACCOUNT_TRANSFER` scope.
    bearer:
      type: bearer
      scheme: bearer
servers:
  - url: https://api.onetrading.com/fast
    description: Production Env
security: []

```