openapi: 3.1.0
info:
    title: History
    version: '3'
    description: |
        Public history APIs.
servers:
    - url: https://futures.kraken.com/api/history/v3
      description: Kraken Futures
      x-kfOnly: true
tags:
    - name: Account History
      description: |
        Account History provides account-specific data, including account logs ( history of all balance and position changes) and history for executions, orders, and triggers.

        * The `/account-log` endpoint provides a paginated JSON response, with access to all account log history specified by ranges of timestamp or ID.
        * The `/accountlogcsv` endpoint provides a CSV formatted response of 500,000 rows of most recent account logs.
         See also the websocket feed of account log snapshots
        * The `/executions` endpoint provides a paginated JSON response, with access to all private execution history specified by ranges of timestamp or ID
        * The `/orders` endpoint provides a paginated JSON response, with access to all private order history specified by ranges of timestamp or ID
        * The `/triggers` endpoint provides a paginated JSON response, with access to all private trigger history specified by ranges of timestamp or ID
    - name: Market History
paths:
    /market/{tradeable}/executions:
        get:
            operationId: getPublicExecutionEvents
            tags:
                - Market History
            summary: Get public execution events
            description: |
                Lists trades for a market.
            security:
                - {}
            parameters:
                - $ref: '#/components/parameters/SinceDateFilter'
                - $ref: '#/components/parameters/BeforeDateFilter'
                - $ref: '#/components/parameters/SortOrder'
                - $ref: '#/components/parameters/ContinuationToken'
                - $ref: '#/components/parameters/CountPublic'
                - name: tradeable
                  in: path
                  required: true
                  schema:
                    type: string
            responses:
                '200':
                    description: ''
                    content:
                        application/json:
                            schema:
                                type: object
                                properties:
                                    len:
                                        type: integer
                                        format: uint64
                                    elements:
                                        type: array
                                        items:
                                            $ref: '#/components/schemas/HistoricalExecutionElementSanitized'
                                    continuationToken:
                                        $ref: '#/components/schemas/NextContinuationToken'
                                required:
                                    - elements
                                    - len
    /market/{tradeable}/orders:
        get:
            operationId: getPublicOrderEvents
            tags:
                - Market History
            summary: Get public order events
            description: |
                Lists order events for a market.
            security:
                - {}
            parameters:
                - $ref: '#/components/parameters/SinceDateFilter'
                - $ref: '#/components/parameters/BeforeDateFilter'
                - $ref: '#/components/parameters/SortOrder'
                - $ref: '#/components/parameters/ContinuationToken'
                - $ref: '#/components/parameters/CountPublic'
                - name: tradeable
                  in: path
                  required: true
                  schema:
                    type: string
            responses:
                '200':
                    description: ''
                    content:
                        application/json:
                            schema:
                                type: object
                                properties:
                                    len:
                                        type: integer
                                        format: uint64
                                    elements:
                                        type: array
                                        items:
                                            $ref: '#/components/schemas/HistoricalOrderElementSanitized'
                                    continuationToken:
                                        $ref: '#/components/schemas/NextContinuationToken'
                                required:
                                    - len
                                    - elements
    /market/{tradeable}/price:
        get:
            operationId: getPublicPriceEvents
            tags:
                - Market History
            summary: Get public mark price events
            description: |
                Lists price events for a market.
            security:
                - {}
            parameters:
                - $ref: '#/components/parameters/SinceDateFilter'
                - $ref: '#/components/parameters/BeforeDateFilter'
                - $ref: '#/components/parameters/SortOrder'
                - $ref: '#/components/parameters/ContinuationToken'
                - $ref: '#/components/parameters/CountPublic'
                - name: tradeable
                  in: path
                  required: true
                  schema:
                    type: string
            responses:
                '200':
                    description: ''
                    content:
                        application/json:
                            schema:
                                type: object
                                properties:
                                    len:
                                        type: integer
                                        format: uint64
                                    elements:
                                        type: array
                                        items:
                                            $ref: '#/components/schemas/PriceElement'
                                    continuationToken:
                                        $ref: '#/components/schemas/NextContinuationToken'
                                required:
                                    - len
                                    - elements
    /executions:
        get:
            operationId: getExecutionEvents
            tags:
                - Account History
            summary: Get execution events
            description: |
                Lists executions/trades for authenticated account.
            security:
                - general-api-key-read-only: []
                  authent: []
            parameters:
                - $ref: '#/components/parameters/SinceDateFilter'
                - $ref: '#/components/parameters/BeforeDateFilter'
                - $ref: '#/components/parameters/SortOrder'
                - $ref: '#/components/parameters/ContinuationToken'
                - $ref: '#/components/parameters/CountPublic'
                - $ref: '#/components/parameters/Tradeable'
            responses:
                '200':
                    description: ''
                    content:
                        application/json:
                            schema:
                                type: object
                                properties:
                                    accountUid:
                                        type: string
                                        format: uuid
                                    len:
                                        type: integer
                                        format: uint64
                                    elements:
                                        type: array
                                        items:
                                            $ref: '#/components/schemas/HistoricalExecutionElement'
                                    continuationToken:
                                        $ref: '#/components/schemas/NextContinuationToken'
                                required:
                                    - accountUid
                                    - len
                                    - elements
    /orders:
        get:
            operationId: getOrderEvents
            tags:
                - Account History
            summary: Get order events
            description: |
                Lists order events for authenticated account.
            security:
                - general-api-key-read-only: []
                  authent: []
            parameters:
                - $ref: '#/components/parameters/SinceDateFilter'
                - $ref: '#/components/parameters/BeforeDateFilter'
                - $ref: '#/components/parameters/SortOrder'
                - $ref: '#/components/parameters/ContinuationToken'
                - $ref: '#/components/parameters/CountPublic'
                - $ref: '#/components/parameters/Tradeable'
                - $ref: '#/components/parameters/OpenedOrder'
                - $ref: '#/components/parameters/ClosedOrder'
            responses:
                '200':
                    description: ''
                    content:
                        application/json:
                            schema:
                                type: object
                                properties:
                                    accountUid:
                                        type: string
                                        format: uuid
                                    len:
                                        type: integer
                                        format: uint64
                                    serverTime:
                                        type: string
                                        format: date-time
                                    elements:
                                        type: array
                                        items:
                                            $ref: '#/components/schemas/HistoricalOrderElement'
                                    continuationToken:
                                        $ref: '#/components/schemas/NextContinuationToken'
                                required:
                                    - accountUid
                                    - len
                                    - elements
    /triggers:
        get:
            operationId: getTriggerEvents
            tags:
                - Account History
            summary: Get trigger events
            description: |
                Lists trigger events for authenticated account.
            security:
                - general-api-key-read-only: []
                  authent: []
            parameters:
                - $ref: '#/components/parameters/SinceDateFilter'
                - $ref: '#/components/parameters/BeforeDateFilter'
                - $ref: '#/components/parameters/SortOrder'
                - $ref: '#/components/parameters/ContinuationToken'
                - $ref: '#/components/parameters/CountPublic'
                - $ref: '#/components/parameters/Tradeable'
                - $ref: '#/components/parameters/OpenedTrigger'
                - $ref: '#/components/parameters/ClosedTrigger'
            responses:
                '200':
                    description: ''
                    content:
                        application/json:
                            schema:
                                type: object
                                properties:
                                    accountUid:
                                        type: string
                                        format: uuid
                                    len:
                                        type: integer
                                        format: uint64
                                    serverTime:
                                        type: string
                                        format: date-time
                                    elements:
                                        type: array
                                        items:
                                            $ref: '#/components/schemas/HistoricalTriggerElement'
                                    continuationToken:
                                        $ref: '#/components/schemas/NextContinuationToken'
                                required:
                                    - accountUid
                                    - len
                                    - elements
    /positions:
        get:
            operationId: getPositionEvents
            tags:
                - Account History
            summary: Get position update events
            description: Lists position events for authenticated account.
            security:
                - general-api-key-read-only: []
                  authent: []
            parameters:
                - $ref: '#/components/parameters/SinceDateFilter'
                - $ref: '#/components/parameters/BeforeDateFilter'
                - $ref: '#/components/parameters/SortOrder'
                - $ref: '#/components/parameters/ContinuationToken'
                - $ref: '#/components/parameters/CountPublic'
                - $ref: '#/components/parameters/IncludeOpenedPositions'
                - $ref: '#/components/parameters/IncludeClosedPositions'
                - $ref: '#/components/parameters/IncludeIncreasedPositions'
                - $ref: '#/components/parameters/IncludeDecreasedPositions'
                - $ref: '#/components/parameters/IncludeReversedPositions'
                - $ref: '#/components/parameters/IncludeNoChangePositions'
                - $ref: '#/components/parameters/IncludeTradePositions'
                - $ref: '#/components/parameters/IncludeFundingRealizationPositions'
                - $ref: '#/components/parameters/IncludeSettlementPositions'
                - $ref: '#/components/parameters/Tradeable'
            responses:
                '200':
                    description: ''
                    content:
                        application/json:
                            schema:
                                type: object
                                properties:
                                    accountUid:
                                        type: string
                                        format: uuid
                                    len:
                                        type: integer
                                        format: uint64
                                    serverTime:
                                        type: string
                                        format: date-time
                                    elements:
                                        type: array
                                        items:
                                            $ref: '#/components/schemas/HistoricalPositionUpdateElement'
                                    continuationToken:
                                        $ref: '#/components/schemas/NextContinuationToken'
                                required:
                                    - accountUid
                                    - len
                                    - elements
    /account-log:
        get:
            operationId: accountLog
            tags:
                - Account History
            summary: Get account log
            description: |
                Lists account log entries, paged by timestamp or by ID.

                To request entries by time range, use the `since` and `before` parameters.
                To request entries by ID range, use the `from` and `to` parameters.
                Any combination of `since`, `before`, `from` and `to` can be used to restrict the requested range of entries.
            security:
                - general-api-key-read-only: []
                  authent: []
            parameters:
                - description: Unix timestamp in milliseconds.
                  name: since
                  in: query
                  required: false
                  schema:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                - description: Unix timestamp in milliseconds.
                  name: before
                  in: query
                  required: false
                  schema:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                - description: ID of the first entry (inclusive). IDs start at 1.
                  name: from
                  in: query
                  required: false
                  schema:
                    type: integer
                    example: 1
                - description: ID of the last entry (inclusive).
                  name: to
                  in: query
                  required: false
                  schema:
                    type: integer
                    example: 100
                - description: |
                    Order of events in response. `asc` = chronological, `desc` = reverse-chronological.
                  name: sort
                  in: query
                  required: false
                  schema:
                    type: string
                    enum:
                        - asc
                        - desc
                    default: desc
                - description: Types of entry to filter by. Only these types will be returned.
                  name: info
                  in: query
                  required: false
                  schema:
                    type: array
                    items:
                        type: string
                        enum:
                            - deposit
                            - withdrawal
                            - futures partial liquidation
                            - futures assignment
                            - futures assignor
                            - futures assignee
                            - futures liquidation
                            - futures_unwind
                            - settlement
                            - futures trade
                            - admin transfer
                            - transfer
                            - subaccount transfer
                            - fee credit
                            - legacy
                            - transfers fee
                            - referral
                            - funding rate change
                            - revenue share
                            - cross-exchange transfer
                            - cross-exchange transfer failed
                            - spot trade
                            - spot fee credit
                            - margin trade
                            - margin position settlement
                            - conversion credit
                            - loan transfer
                            - conversion
                            - interest payment
                            - interest payment credit
                            - futures unwind bankrupt
                            - futures unwind counterparty
                            - kfee applied
                            - covered liquidation
                            - position transfer
                            - portfolio auctioning
                            - external custody delegation
                            - external custody undelegation
                            - external custody unbind
                            - futures tax withheld
                            - futures tax refund
                            - tax conversion
                            - options trade
                            - hedging trade
                            - rfq
                            - funding rate payment - cash dividend
                            - funding rate payment - spin off
                            - funding rate payment - rights distribution
                            - funding rate payment - cashflow
                    example:
                        - futures trade
                - description: Amount of entries to be returned.
                  name: count
                  in: query
                  required: false
                  schema:
                    type: integer
                    default: 500
                - description: Include exchange rate and conversion fee for conversions.
                  name: conversion_details
                  in: query
                  required: false
                  schema:
                    type: boolean
                    default: false
            responses:
                '200':
                    description: Account log.
                    content:
                        application/json:
                            schema:
                                title: Account Log Response
                                type: object
                                properties:
                                    accountUid:
                                        $ref: '#/components/schemas/AccountUid'
                                    logs:
                                        type: array
                                        items:
                                            $ref: '#/components/schemas/AccountLogEntry'
                                required:
                                    - accountUid
                                    - logs
                '429':
                    $ref: '#/components/responses/RateLimited'
    /accountlogcsv:
        get:
            operationId: accountLogCsv
            tags:
                - Account History
            summary: Account log (CSV)
            description: |
                Lists recent account log entries in CSV format.
            security:
                - general-api-key-read-only: []
                  authent: []
            parameters:
                - description: Include exchange rate, exchange rate from currency, and conversion fee for conversions.
                  name: conversion_details
                  in: query
                  required: false
                  schema:
                    type: boolean
                    default: false
            responses:
                '200':
                    description: A CSV formatted response of most recent account log entries.
                    content:
                        text/csv:
                            schema:
                                type: string
                '401':
                    description: Credentials required.
                '429':
                    $ref: '#/components/responses/RateLimited'
components:
    securitySchemes:
        authent:
            type: apiKey
            description: Authentication string
            in: header
            name: Authent
            x-inlineDescription: true
        general-api-key-read-only:
            type: apiKey
            description: General API key with at least **read-only** access
            in: header
            name: APIKey
            x-inlineDescription: true
    parameters:
        Tradeable:
            description: If present events of other tradeables are filtered out.
            name: tradeable
            in: query
            required: false
            schema:
                type: string
        SinceDateFilter:
            name: since
            in: query
            description: Timestamp in milliseconds.
            schema:
                $ref: '#/components/schemas/TimestampMilliseconds'
        BeforeDateFilter:
            name: before
            in: query
            description: Timestamp in milliseconds.
            schema:
                $ref: '#/components/schemas/TimestampMilliseconds'
        SortOrder:
            name: sort
            in: query
            description: |
                Determines the order of events in response(s).

                - `asc` = chronological
                - `desc` = reverse-chronological
            required: false
            schema:
                type: string
                enum:
                    - asc
                    - desc
                default: desc
                x-exhaustive: true
        ContinuationToken:
            name: continuation_token
            in: query
            description: |
                Opaque token from the `Next-Continuation-Token` header used to continue listing events. The
                `sort` parameter must be the same as in the previous request to continue listing in the same
                direction.
            schema:
                type: string
                format: base64
        CountPublic:
            name: count
            in: query
            description: |
                The maximum number of results to return. Larger values are not rejected, they are silently
                capped at 1000; when more events match, the `Next-Continuation-Token` header is returned to
                continue the listing.
            schema:
                type: integer
                format: int64
                minimum: 1
                x-rustType: usize
        OpenedOrder:
            name: opened
            in: query
            schema:
                type: boolean
            description: |
                Determines status of the orders that should be included in response(s).

                - `true` = return orders that have been placed within given time range.
                - `false` = don't return orders that have been placed within given time range.
            required: false
        ClosedOrder:
            name: closed
            in: query
            schema:
                type: boolean
            description: |
                Determines status of the order that should be included in response(s).

                - `true` = return orders that have been closed/cancelled/rejected within given time range.
                - `false` = don't return orders that have been closed/cancelled/rejected within given time range.
            required: false
        OpenedTrigger:
            name: opened
            in: query
            schema:
                type: boolean
            description: |
                Determines status of the triggers that should be included in response(s).

                - `true` = return triggers that have been placed within given time range.
                - `false` = don't return triggers that have been placed within given time range.
            required: false
        ClosedTrigger:
            name: closed
            in: query
            schema:
                type: boolean
            description: |
                Determines status of the trigger that should be included in response(s).

                - `true` = return triggers that have been closed/cancelled/rejected within given time range.
                - `false` = don't return triggers that have been closed/cancelled/rejected within given time range.
            required: false
        IncludeOpenedPositions:
            name: opened
            in: query
            schema:
                type: boolean
            description: |
                True if results should include opened position events. Setting this to
                false has no effect.

                If multiple position change filters (opened/closed/increased/decreased/reversed/no_change)
                are provided, then positions matching any of these will be included.

                When combined with update reason filters (trades/funding_realization/settlement),
                positions must match at least one position change filter AND at least one
                update reason filter.

                If no filters are provided for the request, all position events will be included.
            required: false
        IncludeClosedPositions:
            name: closed
            in: query
            schema:
                type: boolean
            description: |
                True if results should include closed position events. Setting this to
                false has no effect.

                If multiple position change filters (opened/closed/increased/decreased/reversed/no_change)
                are provided, then positions matching any of these will be included.

                When combined with update reason filters (trades/funding_realization/settlement),
                positions must match at least one position change filter AND at least one
                update reason filter.

                If no filters are provided for the request, all position events will be included.
            required: false
        IncludeIncreasedPositions:
            name: increased
            in: query
            schema:
                type: boolean
            description: |
                True if results should include increased position events. Setting this to
                false has no effect.

                If multiple position change filters (opened/closed/increased/decreased/reversed/no_change)
                are provided, then positions matching any of these will be included.

                When combined with update reason filters (trades/funding_realization/settlement),
                positions must match at least one position change filter AND at least one
                update reason filter.

                If no filters are provided for the request, all position events will be included.
            required: false
        IncludeDecreasedPositions:
            name: decreased
            in: query
            schema:
                type: boolean
            description: |
                True if results should include decreased position events. Setting this to
                false has no effect.

                If multiple position change filters (opened/closed/increased/decreased/reversed/no_change)
                are provided, then positions matching any of these will be included.

                When combined with update reason filters (trades/funding_realization/settlement),
                positions must match at least one position change filter AND at least one
                update reason filter.

                If no filters are provided for the request, all position events will be included.
            required: false
        IncludeReversedPositions:
            name: reversed
            in: query
            schema:
                type: boolean
            description: |
                True if results should include reversed position events. Setting this to
                false has no effect.

                If multiple position change filters (opened/closed/increased/decreased/reversed/no_change)
                are provided, then positions matching any of these will be included.

                When combined with update reason filters (trades/funding_realization/settlement),
                positions must match at least one position change filter AND at least one
                update reason filter.

                If no filters are provided for the request, all position events will be included.
            required: false
        IncludeNoChangePositions:
            name: no_change
            in: query
            schema:
                type: boolean
            description: |
                True if results should include "no change" position events - where the
                position has not changed. Setting this to false has no effect.

                If multiple position change filters (opened/closed/increased/decreased/reversed/no_change)
                are provided, then positions matching any of these will be included.

                When combined with update reason filters (trades/funding_realization/settlement),
                positions must match at least one position change filter AND at least one
                update reason filter.

                If no filters are provided for the request, all position events will be included.
            required: false
        IncludeTradePositions:
            name: trades
            in: query
            schema:
                type: boolean
            description: |
                True if results should include position events caused by a trade.
                Setting this to false has no effect.

                If multiple update reason filters (trades/funding_realization/settlement)
                are provided, then positions matching any of these will be included.

                When combined with position change filters (opened/closed/increased/decreased/reversed/no_change),
                positions must match at least one update reason filter AND at least one
                position change filter.

                If no filters are provided for the request, all position events will be included.
            required: false
        IncludeFundingRealizationPositions:
            name: funding_realization
            in: query
            schema:
                type: boolean
            description: |
                True if results should include position events caused by a funding
                realisation. Setting this to false has no effect.

                If multiple update reason filters (trades/funding_realization/settlement)
                are provided, then positions matching any of these will be included.

                When combined with position change filters (opened/closed/increased/decreased/reversed/no_change),
                positions must match at least one update reason filter AND at least one
                position change filter.

                If no filters are provided for the request, all position events will be included.
            required: false
        IncludeSettlementPositions:
            name: settlement
            in: query
            schema:
                type: boolean
            description: |
                True if results should include position events caused by a settlement.
                Setting this to false has no effect.

                If multiple update reason filters (trades/funding_realization/settlement)
                are provided, then positions matching any of these will be included.

                When combined with position change filters (opened/closed/increased/decreased/reversed/no_change),
                positions must match at least one update reason filter AND at least one
                position change filter.

                If no filters are provided for the request, all position events will be included.
            required: false
    responses:
        RateLimited:
            description: Rate limited.
            content:
                text/plain:
                    schema:
                        type: string
            headers:
                rate-limit-reset:
                    description: Time remaining (in seconds) until repeat request (i.e., same cost) will be accepted.
                    schema:
                        type: integer
                        minimum: 1
    schemas:
        BaseOrQuote:
            type: string
            enum:
                - Base
                - Quote
                - Unknown
        FeeCalculationInfoElement:
            type: object
            properties:
                percentageFee:
                    $ref: '#/components/schemas/Decimal'
                userFeeDiscountApplied:
                    oneOf:
                        - $ref: '#/components/schemas/Decimal'
                        - type: 'null'
                marketShareRebateCredited:
                    oneOf:
                        - $ref: '#/components/schemas/Decimal'
                        - type: 'null'
            required:
                - percentageFee
                - userFeeDiscountApplied
                - marketShareRebateCredited
        HistoricalExecution:
            type: object
            properties:
                uid:
                    type: string
                    format: uuid
                order:
                    $ref: '#/components/schemas/HistoricalOrder'
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                quantity:
                    $ref: '#/components/schemas/Decimal'
                price:
                    $ref: '#/components/schemas/Decimal'
                markPrice:
                    $ref: '#/components/schemas/Decimal'
                executionType:
                    $ref: '#/components/schemas/executionType'
                limitFilled:
                    type: boolean
                oldTakerOrder:
                    $ref: '#/components/schemas/HistoricalOrder'
                usdValue:
                    $ref: '#/components/schemas/Decimal'
                orderData:
                    $ref: '#/components/schemas/OrderData'
                    nullable: true
                partnerTradeId:
                    type: string
                regulatoryData:
                    $ref: '#/components/schemas/RegulatoryData'
            required:
                - uid
                - order
                - timestamp
                - quantity
                - price
                - markPrice
                - executionType
                - limitFilled
                - usdValue
                - orderData
        HistoricalExecutionDetails:
            type: object
            properties:
                execution:
                    $ref: '#/components/schemas/HistoricalExecution'
                takerReducedQuantity:
                    description: sometimes empty string
                    type: string
            required:
                - execution
                - takerReducedQuantity
        HistoricalExecutionDetailsSanitized:
            type: object
            properties:
                execution:
                    $ref: '#/components/schemas/HistoricalExecutionSanitized'
                takerReducedQuantity:
                    description: sometimes empty string
                    type: string
            required:
                - execution
                - takerReducedQuantity
        HistoricalExecutionElement:
            type: object
            properties:
                uid:
                    type: string
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                event:
                    $ref: '#/components/schemas/HistoricalExecutionEvent'
            required:
                - uid
                - timestamp
                - event
        HistoricalExecutionElementSanitized:
            type: object
            properties:
                uid:
                    type: string
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                event:
                    $ref: '#/components/schemas/HistoricalExecutionEventSanitized'
            required:
                - uid
                - timestamp
                - event
        HistoricalExecutionEvent:
            type: object
            properties:
                execution:
                    $ref: '#/components/schemas/HistoricalExecutionDetails'
            required:
                - execution
        HistoricalExecutionEventSanitized:
            type: object
            properties:
                Execution:
                    $ref: '#/components/schemas/HistoricalExecutionDetailsSanitized'
            required:
                - Execution
        HistoricalExecutionSanitized:
            type: object
            properties:
                uid:
                    type: string
                    format: uuid
                makerOrder:
                    $ref: '#/components/schemas/HistoricalOrderSanitized'
                takerOrder:
                    $ref: '#/components/schemas/HistoricalOrderSanitized'
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                quantity:
                    $ref: '#/components/schemas/Decimal'
                price:
                    $ref: '#/components/schemas/Decimal'
                markPrice:
                    $ref: '#/components/schemas/Decimal'
                limitFilled:
                    type: boolean
                oldTakerOrder:
                    $ref: '#/components/schemas/HistoricalOrderSanitized'
                usdValue:
                    $ref: '#/components/schemas/Decimal'
            required:
                - uid
                - makerOrder
                - takerOrder
                - timestamp
                - quantity
                - price
                - markPrice
                - limitFilled
                - usdValue
        HistoricalOrder:
            type: object
            properties:
                uid:
                    type: string
                    format: uuid
                accountUid:
                    type: string
                    format: uuid
                tradeable:
                    type: string
                positionUid:
                    type: string
                direction:
                    description: |
                        `Unknown` is returned when the source value couldn't be decoded; this will be replaced with a real value as soon as possible.
                    type: string
                    enum:
                        - Buy
                        - Sell
                        - Unknown
                quantity:
                    $ref: '#/components/schemas/Decimal'
                filled:
                    $ref: '#/components/schemas/Decimal'
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                limitPrice:
                    $ref: '#/components/schemas/Decimal'
                orderType:
                    description: |
                        `Unknown` is returned when the source value couldn't be decoded; this will be replaced with a real value as soon as possible.
                    type: string
                    enum:
                        - Limit
                        - IoC
                        - Post
                        - Liquidation
                        - Assignment
                        - Stop
                        - Unwind
                        - Market
                        - Block
                        - CoveredLiquidation
                        - HedgeImmediateOrCancel
                        - HedgeAssignment
                        - FillOrKill
                        - Rfq
                        - PartialLiquidation
                        - Unknown
                clientId:
                    type: string
                reduceOnly:
                    type: boolean
                lastUpdateTimestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                spotData:
                    $ref: '#/components/schemas/SpotOrderData'
                parentOfGroupId:
                    type: string
                memberOfGroupId:
                    type: string
                partnerOrderId:
                    type: string
                regulatoryExternalUid:
                    type: string
                    format: uuid
            required:
                - uid
                - accountUid
                - tradeable
                - direction
                - quantity
                - filled
                - timestamp
                - limitPrice
                - orderType
                - clientId
                - reduceOnly
                - lastUpdateTimestamp
        HistoricalOrderElement:
            type: object
            properties:
                uid:
                    type: string
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                event:
                    $ref: '#/components/schemas/HistoricalOrderEvent'
            required:
                - uid
                - timestamp
                - event
        HistoricalOrderElementSanitized:
            type: object
            properties:
                uid:
                    type: string
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                event:
                    $ref: '#/components/schemas/HistoricalOrderEventSanitized'
            required:
                - uid
                - timestamp
                - event
        HistoricalOrderEvent:
            type: object
            oneOf:
                - type: object
                  properties:
                    OrderPlaced:
                        $ref: '#/components/schemas/OrderPlaced'
                  required:
                    - OrderPlaced
                - type: object
                  properties:
                    OrderUpdated:
                        $ref: '#/components/schemas/OrderUpdated'
                  required:
                    - OrderUpdated
                - type: object
                  properties:
                    OrderRejected:
                        $ref: '#/components/schemas/OrderRejected'
                  required:
                    - OrderRejected
                - type: object
                  properties:
                    OrderCancelled:
                        $ref: '#/components/schemas/OrderCancelled'
                  required:
                    - OrderCancelled
                - type: object
                  properties:
                    OrderNotFound:
                        $ref: '#/components/schemas/OrderNotFound'
                  required:
                    - OrderNotFound
                - type: object
                  properties:
                    OrderEditRejected:
                        $ref: '#/components/schemas/OrderEditRejected'
                  required:
                    - OrderEditRejected
        HistoricalOrderEventSanitized:
            type: object
            oneOf:
                - type: object
                  properties:
                    OrderPlaced:
                        $ref: '#/components/schemas/OrderPlacedSanitized'
                  required:
                    - OrderPlaced
                - type: object
                  properties:
                    OrderUpdated:
                        $ref: '#/components/schemas/OrderUpdatedSanitized'
                  required:
                    - OrderUpdated
                - type: object
                  properties:
                    OrderCancelled:
                        $ref: '#/components/schemas/OrderCancelledSanitized'
                  required:
                    - OrderCancelled
        HistoricalOrderSanitized:
            type: object
            properties:
                uid:
                    type: string
                    format: uuid
                tradeable:
                    type: string
                direction:
                    description: |
                        `Unknown` is returned when the source value couldn't be decoded; this will be replaced with a real value as soon as possible.
                    type: string
                    enum:
                        - Buy
                        - Sell
                        - Unknown
                quantity:
                    $ref: '#/components/schemas/Decimal'
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                limitPrice:
                    $ref: '#/components/schemas/Decimal'
                orderType:
                    type: string
                reduceOnly:
                    type: boolean
                lastUpdateTimestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
            required:
                - uid
                - tradeable
                - direction
                - quantity
                - timestamp
                - limitPrice
                - orderType
                - reduceOnly
                - lastUpdateTimestamp
        HistoricalTrigger:
            type: object
            properties:
                uid:
                    type: string
                    format: uuid
                accountId:
                    type: number
                    format: uint64
                accountUid:
                    type: string
                    format: uuid
                tradeable:
                    type: string
                direction:
                    description: |
                        `Unknown` is returned when the source value couldn't be decoded; this will be replaced with a real value as soon as possible.
                    type: string
                    enum:
                        - Buy
                        - Sell
                        - Unknown
                quantity:
                    $ref: '#/components/schemas/Decimal'
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                limitPrice:
                    $ref: '#/components/schemas/Decimal'
                orderType:
                    type: string
                clientId:
                    type: string
                reduceOnly:
                    type: boolean
                lastUpdateTimestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                triggerOptions:
                    $ref: '#/components/schemas/TriggerOptions'
            required:
                - uid
                - accountId
                - accountUid
                - tradeable
                - direction
                - quantity
                - timestamp
                - limitPrice
                - orderType
                - clientId
                - reduceOnly
                - lastUpdateTimestamp
                - triggerOptions
        HistoricalTriggerElement:
            type: object
            properties:
                uid:
                    type: string
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                event:
                    $ref: '#/components/schemas/HistoricalTriggerEvent'
            required:
                - uid
                - timestamp
                - event
        HistoricalTriggerEvent:
            type: object
            oneOf:
                - type: object
                  properties:
                    OrderTriggerPlaced:
                        $ref: '#/components/schemas/TriggerPlaced'
                  required:
                    - OrderTriggerPlaced
                - type: object
                  properties:
                    OrderTriggerCancelled:
                        $ref: '#/components/schemas/TriggerCancelled'
                  required:
                    - OrderTriggerCancelled
                - type: object
                  properties:
                    OrderTriggerUpdated:
                        $ref: '#/components/schemas/TriggerUpdated'
                  required:
                    - OrderTriggerUpdated
                - type: object
                  properties:
                    OrderTriggerActivated:
                        $ref: '#/components/schemas/TriggerActivated'
                  required:
                    - OrderTriggerActivated
                - type: object
                  properties:
                    OrderTriggerEditRejected:
                        $ref: '#/components/schemas/TriggerEditRejected'
                  required:
                    - OrderTriggerEditRejected
        NextContinuationToken:
            description: |
                Opaque token to pass to the next request to continue listing events. The `sort` parameter
                must be the same as in the previous request to continue listing in the same direction.
            type: string
            format: base64
        OrderCancelled:
            type: object
            properties:
                order:
                    $ref: '#/components/schemas/HistoricalOrder'
                reason:
                    type: string
            required:
                - order
                - reason
        OrderCancelledSanitized:
            type: object
            properties:
                order:
                    $ref: '#/components/schemas/HistoricalOrderSanitized'
                reason:
                    type: string
            required:
                - order
                - reason
        OrderData:
            type: object
            properties:
                fee:
                    $ref: '#/components/schemas/Decimal'
                positionSize:
                    $ref: '#/components/schemas/Decimal'
                feeCalculationInfo:
                    $ref: '#/components/schemas/FeeCalculationInfoElement'
                realizedPnl:
                    $ref: '#/components/schemas/Decimal'
            required:
                - fee
                - positionSize
                - feeCalculationInfo
        OrderEditRejected:
            type: object
            properties:
                oldOrder:
                    $ref: '#/components/schemas/HistoricalOrder'
                attemptedOrder:
                    $ref: '#/components/schemas/HistoricalOrder'
                orderError:
                    type: string
            required:
                - oldOrder
                - attemptedOrder
                - orderError
        OrderNotFound:
            type: object
            properties:
                accountUid:
                    type: string
                    format: uuid
                orderId:
                    type: string
                    example: Uuid(uuid=2ceb1d31-f619-457b-870c-fd4ddbb10d45)
            required:
                - accountUid
                - orderId
        OrderPlaced:
            type: object
            properties:
                order:
                    $ref: '#/components/schemas/HistoricalOrder'
                reason:
                    type: string
                reducedQuantity:
                    description: always empty string
                    type: string
            required:
                - order
                - reason
                - reducedQuantity
        OrderPlacedSanitized:
            type: object
            properties:
                order:
                    $ref: '#/components/schemas/HistoricalOrderSanitized'
                reason:
                    type: string
                reducedQuantity:
                    description: always empty string
                    type: string
            required:
                - order
                - reason
                - reducedQuantity
        OrderRejected:
            type: object
            properties:
                order:
                    $ref: '#/components/schemas/HistoricalOrder'
                orderError:
                    type: string
                reason:
                    type: string
            required:
                - order
                - orderError
                - reason
        OrderUpdated:
            type: object
            properties:
                oldOrder:
                    $ref: '#/components/schemas/HistoricalOrder'
                newOrder:
                    $ref: '#/components/schemas/HistoricalOrder'
                reason:
                    type: string
                reducedQuantity:
                    $ref: '#/components/schemas/Decimal'
            required:
                - oldOrder
                - newOrder
                - reason
                - reducedQuantity
        OrderUpdatedSanitized:
            type: object
            properties:
                oldOrder:
                    $ref: '#/components/schemas/HistoricalOrderSanitized'
                newOrder:
                    $ref: '#/components/schemas/HistoricalOrderSanitized'
                reason:
                    type: string
                reducedQuantity:
                    $ref: '#/components/schemas/Decimal'
            required:
                - oldOrder
                - newOrder
                - reason
                - reducedQuantity
        PriceOffset:
            type: object
            properties:
                priceOffset:
                    $ref: '#/components/schemas/Decimal'
                unit:
                    description: |
                        `Unknown` is returned when the source value couldn't be decoded; this will be replaced with a real value as soon as possible.
                    type: string
                    enum:
                        - Percent
                        - QuoteCurrency
                        - Unknown
            required:
                - priceOffset
                - unit
        SpotOrderData:
            type: object
            properties:
                margin:
                    type: boolean
                feePreference:
                    oneOf:
                        - $ref: '#/components/schemas/BaseOrQuote'
                        - type: 'null'
                quantityPreference:
                    $ref: '#/components/schemas/BaseOrQuote'
            required:
                - margin
                - feePreference
                - quantityPreference
        TrailingStopOptions:
            type: object
            properties:
                maxDeviation:
                    $ref: '#/components/schemas/Decimal'
                unit:
                    description: |
                        `Unknown` is returned when the source value couldn't be decoded; this will be replaced with a real value as soon as possible.
                    type: string
                    enum:
                        - Percent
                        - QuoteCurrency
                        - Unknown
            required:
                - maxDeviation
                - unit
        TriggerActivated:
            type: object
            properties:
                order:
                    $ref: '#/components/schemas/HistoricalTrigger'
            required:
                - order
        TriggerCancelled:
            type: object
            properties:
                order:
                    $ref: '#/components/schemas/HistoricalTrigger'
                reason:
                    type: string
            required:
                - order
                - reason
        TriggerEditRejected:
            type: object
            properties:
                attemptedOrderTrigger:
                    $ref: '#/components/schemas/HistoricalTrigger'
                oldOrderTrigger:
                    $ref: '#/components/schemas/HistoricalTrigger'
                reason:
                    type: string
                orderError:
                    type: string
            required:
                - attemptedOrderTrigger
                - oldOrderTrigger
                - reason
                - orderError
        TriggerOptions:
            type: object
            properties:
                triggerPrice:
                    $ref: '#/components/schemas/Decimal'
                triggerSignal:
                    description: |
                        `Unknown` is returned when the source value couldn't be decoded; this will be replaced with a real value as soon as possible.
                    type: string
                    enum:
                        - MarkPrice
                        - LastPrice
                        - SpotPrice
                        - Unknown
                triggerSide:
                    description: |
                        `Unknown` is returned when the source value couldn't be decoded; this will be replaced with a real value as soon as possible.
                    type: string
                    enum:
                        - Above
                        - Below
                        - Unknown
                trailingStopOptions:
                    $ref: '#/components/schemas/TrailingStopOptions'
                limitPriceOffset:
                    $ref: '#/components/schemas/PriceOffset'
            required:
                - triggerPrice
                - triggerSignal
                - triggerSide
                - trailingStopOptions
                - limitPriceOffset
        TriggerPlaced:
            type: object
            properties:
                order:
                    $ref: '#/components/schemas/HistoricalTrigger'
                reason:
                    type: string
            required:
                - order
                - reason
        TriggerUpdated:
            type: object
            properties:
                oldOrderTrigger:
                    $ref: '#/components/schemas/HistoricalTrigger'
                newOrderTrigger:
                    $ref: '#/components/schemas/HistoricalTrigger'
                reason:
                    type: string
            required:
                - oldOrderTrigger
                - newOrderTrigger
                - reason
        TimestampMilliseconds:
            type: integer
            format: timestamp-milliseconds
            example: 1604937694000
        Decimal:
            type: string
            format: decimal
            example: '1234.56789'
        MarkPriceChanged:
            type: object
            properties:
                price:
                    $ref: '#/components/schemas/Decimal'
            required:
                - price
        PriceElement:
            type: object
            properties:
                uid:
                    type: string
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                event:
                    $ref: '#/components/schemas/MarkPriceChanged'
            required:
                - uid
                - timestamp
                - event
        executionType:
            type: string
            enum:
                - maker
                - taker
        RegulatoryData:
            type: object
            properties:
                venue:
                    type: string
                counterparty:
                    type: string
                externalUid:
                    type: string
                    format: uuid
        HistoricalPositionUpdate:
            type: object
            properties:
                accountUid:
                    description: Account UID
                    type: string
                tradeable:
                    type: string
                oldPosition:
                    type: string
                oldAverageEntryPrice:
                    type:
                        - string
                        - 'null'
                newPosition:
                    type: string
                newAverageEntryPrice:
                    type: string
                fillTime:
                    type:
                        - integer
                        - 'null'
                    format: timestamp-milliseconds
                fee:
                    type: string
                feeCurrency:
                    type: string
                realizedPnL:
                    type: string
                positionChange:
                    type: string
                    description: |
                        `unknown` is returned when the source value couldn't be decoded; this will be replaced with a real value as soon as possible.
                    enum:
                        - open
                        - close
                        - increase
                        - decrease
                        - reverse
                        - noChange
                        - unknown
                executionUid:
                    type: string
                executionPrice:
                    type: string
                executionSize:
                    type: string
                tradeType:
                    type: string
                    description: |
                        `unknown` is returned when the source value couldn't be decoded; this will be replaced with a real value as soon as possible.
                    enum:
                        - userExecution
                        - liquidation
                        - partialLiquidation
                        - assignment
                        - unwind
                        - unknown
                fundingRealizationTime:
                    type: integer
                    format: timestamp-milliseconds
                realizedFunding:
                    type: string
                settlementPrice:
                    type: string
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                updateReason:
                    type: string
                    description: |
                        `unknown` is returned when the source value couldn't be decoded; this will be replaced with a real value as soon as possible.
                    enum:
                        - trade
                        - fundingRealisation
                        - settlement
                        - unknown
            required:
                - accountUid
                - tradeable
                - oldPosition
                - newPosition
                - newAverageEntryPrice
                - positionChange
                - timestamp
                - updateReason
        HistoricalPositionUpdateEvent:
            type: object
            properties:
                PositionUpdate:
                    $ref: '#/components/schemas/HistoricalPositionUpdate'
            required:
                - PositionUpdate
        HistoricalPositionUpdateElement:
            type: object
            properties:
                uid:
                    type: string
                timestamp:
                    $ref: '#/components/schemas/TimestampMilliseconds'
                event:
                    $ref: '#/components/schemas/HistoricalPositionUpdateEvent'
            required:
                - uid
                - timestamp
                - event
        AccountUid:
            description: UID of the account
            type: string
            format: uuid
        Rfc3339DateTime:
            description: RFC 3339 formatted date-time
            type: string
            format: date-time
            example: '2019-08-24T14:15:22Z'
        AccountLogEntry:
            description: Account log entry
            type: object
            properties:
                asset:
                    description: Asset related with the entry.
                    type: string
                booking_uid:
                    description: UID of the log entry.
                    type: string
                    format: uuid
                collateral:
                    description: Currency of the associated entry.
                    type:
                        - string
                        - 'null'
                contract:
                    type:
                        - string
                        - 'null'
                date:
                    $ref: '#/components/schemas/Rfc3339DateTime'
                execution:
                    description: |
                        UID of the associated execution or transfer.

                        For orders and trades, this is always a UUID. However, this field is also populated with
                        "cross-exchange transfer" references, which are not always UUIDs.
                    type:
                        - string
                        - 'null'
                fee:
                    description: Fee paid
                    type:
                        - number
                        - 'null'
                    format: double
                funding_rate:
                    description: Absolute funding rate at time of entry.
                    type:
                        - number
                        - 'null'
                    format: double
                id:
                    description: Log entry ID.
                    type: integer
                    format: int64
                    minimum: 1
                info:
                    description: Short description of the entry.
                    type: string
                    enum:
                        - deposit
                        - withdrawal
                        - futures partial liquidation
                        - futures assignment
                        - futures assignor
                        - futures assignee
                        - futures liquidation
                        - futures_unwind
                        - settlement
                        - futures trade
                        - admin transfer
                        - transfer
                        - subaccount transfer
                        - fee credit
                        - legacy
                        - transfers fee
                        - referral
                        - funding rate change
                        - revenue share
                        - cross-exchange transfer
                        - cross-exchange transfer failed
                        - spot trade
                        - spot fee credit
                        - margin trade
                        - margin position settlement
                        - conversion credit
                        - loan transfer
                        - conversion
                        - interest payment
                        - interest payment credit
                        - futures unwind bankrupt
                        - futures unwind counterparty
                        - kfee applied
                        - covered liquidation
                        - position transfer
                        - portfolio auctioning
                        - external custody delegation
                        - external custody undelegation
                        - external custody unbind
                        - futures tax withheld
                        - futures tax refund
                        - tax conversion
                        - options trade
                        - hedging trade
                        - rfq
                        - funding rate payment - cash dividend
                        - funding rate payment - spin off
                        - funding rate payment - rights distribution
                        - funding rate payment - cashflow
                margin_account:
                    description: Name of the wallet associated with the entry.
                    type: string
                mark_price:
                    description: Mark price at the time the trade was executed.
                    type:
                        - number
                        - 'null'
                    format: double
                new_average_entry_price:
                    description: Average entry price of the position after this trade.
                    type:
                        - number
                        - 'null'
                    format: double
                new_balance:
                    description: |
                        New balance of wallet or new size of the position after the described in info action.
                    type: number
                    format: double
                old_average_entry_price:
                    description: Average entry price of the position prior to this trade.
                    type:
                        - number
                        - 'null'
                    format: double
                old_balance:
                    description: Account balance before the described in info action.
                    type: number
                    format: double
                realized_funding:
                    description: Funding realized due to change in position size or end of funding rate period.
                    type:
                        - number
                        - 'null'
                    format: double
                realized_pnl:
                    description: PnL that is realized by reducing the position.
                    type:
                        - number
                        - 'null'
                    format: double
                trade_price:
                    description: Price at which the trade was executed.
                    type:
                        - number
                        - 'null'
                    format: double
                conversion_spread_percentage:
                    description: Percentage conversion spread used in a currency conversion.
                    type:
                        - number
                        - 'null'
                    format: double
                liquidation_fee:
                    description: |
                        Liquidation fee associated with a liquidation/assignment entry.

                        Not applicable for inverse futures.
                    type:
                        - number
                        - 'null'
                    format: double
                exchange_rate:
                    description: The exchange rate used for the conversion, USD quote.
                    type: number
                    format: double
                conversion_fee:
                    description: The percentage fee charged for the conversion. E.g. 0.05 = 0.05%.
                    type: number
                    format: double
                exchange_rate_from:
                    description: The currency code of the base currency in the exchange rate.
                    type: string
            required:
                - asset
                - booking_uid
                - collateral
                - contract
                - date
                - execution
                - fee
                - funding_rate
                - id
                - info
                - margin_account
                - mark_price
                - new_average_entry_price
                - new_balance
                - old_average_entry_price
                - old_balance
                - realized_funding
                - realized_pnl
                - trade_price
                - conversion_spread_percentage
                - liquidation_fee
