# Get Trades for Order

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/account/orders/{order_id}/trades:
    get:
      summary: Get Trades for Order
      deprecated: false
      description: >-
        Get list of trades for a specific order, oldest first.


        An unknown order ID, or an order without trades, returns `200` with an
        empty `trade_history`.


        Requires any valid API key. This endpoint is rate-limited per account
        holder.
      tags:
        - One Trading Public REST API/Trading
      parameters:
        - name: order_id
          in: path
          description: The order ID to get trades for
          required: true
          example: e9765da8-1861-4cc8-1af3-6f89b079941a
          schema:
            type: string
            format: uuid
      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: []
                x-apidog-orders:
                  - trade_history
                required:
                  - trade_history
                x-apidog-ignore-properties: []
              example:
                trade_history:
                  - fee:
                      fee_amount: '0.29'
                      fee_currency: EUR
                    trade:
                      account_id: 726288e6-a463-4f88-9068-024ae8f97a34
                      order_id: ff119f4e-7918-4bec-8816-75d5b57865d1
                      trade_id: a7b6f4f8-0278-40a1-a435-7d02f93bafd0
                      time: '2024-11-14T10:26:57.241Z'
                      time_nanos: '2024-11-14T10:26:57.241123456Z'
                      instrument_code: SOL_EUR
                      side: SELL
                      matched_as: MAKER
                      order_type: API
                      price: '145'
                      amount: '1'
                      filled_amount: '1'
                      sequence: '58894265752'
          headers: {}
        '400':
          x-apidog-name: Bad Request
          description: Invalid order ID. `error` is `INVALID_PARAMETERS`.
          content:
            application/json:
              schema: &ref_0
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: INVALID_PARAMETERS
                error_message: Order ID must be a valid UUID
          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:
                '3':
                  summary: Unauthorized
                  value:
                    error: UNAUTHORIZED
                    error_message: Unauthorized access
                '4':
                  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:
                '5':
                  summary: Gateway
                  value:
                    message: Forbidden
                '6':
                  summary: Permission denied
                  value:
                    error: PERMISSION_DENIED
                    error_message: Permission denied
                '7':
                  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-3612098-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: []

```