# Get Trades

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /account/trades:
    get:
      summary: Get Trades
      deprecated: false
      description: >-
        Retrieves trades executed within the specified date range, sorted by
        timestamp in descending order.


        ### Parameter Specification


        | Parameter       | Accepted Formats | Example Values |

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

        | `from`          | ISO 8601        | `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        | `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` (single) |

        |                  | List           | `BTC_EUR_P,ETH_EUR_P`
        (comma-separated list) |

        | `max_page_size`  | Integer        | 3 |

        | `cursor`         | String         |
        `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...` |


        ### Parameter Limits


        | Parameter         | Constraints / Range |

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

        | `from`           | Cannot be a future date |

        | `to`             | Must be on or after `from` and no more than 30 days
        after `from` |

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

        | `instrument_code` | Optional; must be a valid market instrument code
        or codes 


        ### Parameter Defaults


        | Parameter(s)    | Default Behavior |

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

        | `from` / `to`   | Neither provided: `from` = 7 days ago at midnight
        UTC, `to` = present time |

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

        | `from` / `to`   | Only `to` provided: `from` = 7 days earlier |

        | `instrument_code`| Defaults to all markets |

        | `max_page_size` | Defaults to 100 |
      tags:
        - One Trading Public REST API/Trading
      parameters:
        - name: from
          in: query
          description: >-
            Specifies the start of the period. Accepts date strings
            (YYYY-MM-DD), ISO 8601 strings, or numeric timestamps in seconds,
            milliseconds, or microseconds.
          required: false
          schema:
            type: string
        - name: to
          in: query
          description: >-
            Specifies the end of the period. Accepts date strings (YYYY-MM-DD),
            ISO 8601 strings, or numeric timestamps in seconds, milliseconds, or
            microseconds.
          required: false
          schema:
            type: string
            format: date-time
        - name: instrument_code
          in: query
          description: >-
            Instrument(s) to filter by. Can be a single pair or a
            comma-separated string of pairs. Defaults to all instruments.
          required: false
          schema:
            type: string
        - name: max_page_size
          in: query
          description: >-
            Set max desired page size. If no value is provided, by default a
            maximum of 100 results per page are returned. The maximum upper
            limit is 100 results per page
          required: false
          example: '2'
          schema:
            type: string
        - name: cursor
          in: query
          description: >-
            Pointer indicating where the next page of results will be retrieved
            from.
          required: false
          schema:
            type: string
      responses:
        '200':
          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 amount of items requested
                  cursor:
                    type: string
                    description: >-
                      If there are more records to fetch, the cursor returned
                      should be passed into the next request, to be used as a
                      starting point for the next batch of trades
                x-apidog-orders:
                  - trade_history
                  - max_page_size
                  - cursor
                required:
                  - trade_history
                  - max_page_size
                x-apidog-ignore-properties: []
          headers: {}
          x-apidog-name: Success
        '400':
          description: ''
          content:
            application/json:
              schema:
                title: ''
                type: object
                properties:
                  error:
                    type: string
                x-apidog-orders:
                  - error
                required:
                  - error
                x-apidog-ignore-properties: []
          headers: {}
          x-apidog-name: Bad Request
      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, milisecond 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
          format: uuid
          description: >-
            The ID of the position associated with this trade. Included only for
            trades executed on perpetual markets.
        prev_position_id:
          type: string
          format: uuid
          description: >-
            If the trade causes a position flip (long to short or short to
            long), this field specifies the ID of the position closed by the
            trade. Present only for perpetual-market trades that result in a
            position flip.
        open_position_amount:
          type: string
          description: >-
            The post-execution open position amount. This field is included only
            for trades executed on perpetual markets.
      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
      required:
        - account_id
        - order_id
        - trade_id
        - time
        - time_nanos
        - instrument_code
        - side
        - matched_as
        - amount
        - filled_amount
        - price
        - sequence
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    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-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes: {}
servers:
  - url: https://api.onetrading.com/fast/v1
    description: Production Env
security: []

```