Qfex user API

The user API from Qfex — 15 operation(s) for user.

OpenAPI Specification

qfex-user-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  contact:
    email: support@qfex.com
    name: QFEX Support
  description: REST API for QFEX
  license:
    name: QFEX License
    url: https://qfex.com/license
  title: QFEX REST market-data user API
  version: 0.1.0
servers:
- description: Production server
  url: https://api.qfex.com
tags:
- name: user
paths:
  /historic-orders-csv:
    get:
      description: Stream a CSV of all historic orders for the authenticated user.
      operationId: read-historic-orders-csv
      responses:
        '200':
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: Stream Historic Orders CSV
      tags:
      - user
  /historic-twaps-csv:
    get:
      description: Stream a CSV of all historic TWAPs for the authenticated user.
      operationId: read-historic-twaps-csv
      parameters:
      - explode: false
        in: query
        name: symbol
        schema:
          type: string
      responses:
        '200':
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: Stream Historic TWAPs CSV
      tags:
      - user
  /trades-csv:
    get:
      description: Stream a CSV of all trades for the authenticated user.
      operationId: read-trades-csv
      responses:
        '200':
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: Stream Trades CSV
      tags:
      - user
  /user/account-equity:
    get:
      description: Return total account equity over time for preset durations.
      operationId: read-account-equity
      parameters:
      - explode: false
        in: query
        name: duration
        schema:
          default: 1w
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountEquityResponseBody'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: Account Equity
      tags:
      - user
  /user/fees:
    get:
      description: Return Fees data for the authenticated user.
      operationId: read-user-fees
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeesResponseBody'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: User Fees
      tags:
      - user
  /user/historic-orders:
    get:
      description: Return historic orders (filled or terminally closed) for the authenticated user.
      operationId: read-historic-orders
      parameters:
      - explode: false
        in: query
        name: symbol
        schema:
          type: string
      - explode: false
        in: query
        name: client_order_id
        schema:
          type: string
      - explode: false
        in: query
        name: start
        schema:
          format: date-time
          type: string
      - explode: false
        in: query
        name: end
        schema:
          format: date-time
          type: string
      - explode: false
        in: query
        name: limit
        schema:
          default: 100
          format: int64
          maximum: 1000
          minimum: 1
          type: integer
      - explode: false
        in: query
        name: offset
        schema:
          default: 0
          format: int64
          minimum: 0
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoricOrdersResponseBody'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: Historic Orders
      tags:
      - user
  /user/historic-pnl:
    get:
      description: Return historic user pnl change over preset durations. Supports number and percent units, and optional comma-separated symbol filters.
      operationId: read-historic-user-pnl
      parameters:
      - explode: false
        in: query
        name: duration
        schema:
          default: 1w
          type: string
      - explode: false
        in: query
        name: unit
        schema:
          default: number
          type: string
      - explode: false
        in: query
        name: symbol
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoricUserPnlResponseBody'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: Historic User PnL
      tags:
      - user
  /user/historic-twaps:
    get:
      description: Return historic TWAPs (cancelled or completed) for the authenticated user.
      operationId: read-historic-twaps
      parameters:
      - explode: false
        in: query
        name: symbol
        schema:
          type: string
      - explode: false
        in: query
        name: limit
        schema:
          default: 100
          format: int64
          maximum: 1000
          minimum: 1
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoricTwapsResponseBody'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: Historic TWAPs
      tags:
      - user
  /user/leverage:
    post:
      description: Set the leverage for the authenticated user.
      operationId: set-user-leverage
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetUserLeverageRequestBody'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SetUserLeverageResponseBody'
          description: OK
          headers:
            StatusCode:
              schema:
                format: int64
                type: integer
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: Set User Leverage
      tags:
      - user
  /user/positions:
    get:
      description: Return current positions for the authenticated user.
      operationId: read-user-positions
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionsBalanceResponseBody'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: User Positions
      tags:
      - user
  /user/referral-rewards:
    get:
      description: Return daily referral rewards for the authenticated user.
      operationId: read-user-referral-rewards
      parameters:
      - explode: false
        in: query
        name: duration
        schema:
          default: 1w
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferralRewardsResponseBody'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: User Referral Rewards
      tags:
      - user
  /user/subaccounts:
    get:
      description: Returns subaccount IDs for the authenticated user excluding the master account ID.
      operationId: list-subaccounts
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListSubaccountsResponseBody'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: List Subaccounts
      tags:
      - user
    post:
      description: Allocates a new subaccount ID for the authenticated user and returns it in the response body.
      operationId: create-subaccount
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSubaccountResponseBody'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: Create Subaccount
      tags:
      - user
  /user/trade:
    get:
      description: Return trades for the authenticated user.
      operationId: read-user-trades
      parameters:
      - explode: false
        in: query
        name: exchange_order_id
        schema:
          type: string
      - explode: false
        in: query
        name: start
        schema:
          format: date-time
          type: string
      - explode: false
        in: query
        name: end
        schema:
          format: date-time
          type: string
      - explode: false
        in: query
        name: start_time
        schema:
          format: date-time
          type: string
      - explode: false
        in: query
        name: end_time
        schema:
          format: date-time
          type: string
      - explode: false
        in: query
        name: symbol
        schema:
          type: string
      - explode: false
        in: query
        name: ordertype
        schema:
          type: string
      - explode: false
        in: query
        name: orderdirection
        schema:
          type: string
      - explode: false
        in: query
        name: limit
        schema:
          default: 100
          format: int64
          maximum: 1000
          minimum: 1
          type: integer
      - explode: false
        in: query
        name: offset
        schema:
          default: 0
          format: int64
          minimum: 0
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradesResponseBody'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: User Trades
      tags:
      - user
  /user/transfer:
    post:
      description: Transfer available balance between two of the authenticated user's accounts (master account or subaccounts).
      operationId: transfer-balance
      parameters:
      - explode: false
        in: query
        name: src_account_id
        required: true
        schema:
          type: string
      - explode: false
        in: query
        name: dst_account_id
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransferRequestBody'
        required: true
      responses:
        '204':
          description: No Content
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: Transfer Balance
      tags:
      - user
  /user/volume:
    get:
      description: 'Return daily user notional volume for one of: 1w, 1m, ytd, or all time. Supports optional comma-separated symbol filters.'
      operationId: read-user-volume
      parameters:
      - explode: false
        in: query
        name: range
        schema:
          default: 1w
          type: string
      - explode: false
        in: query
        name: symbol
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserVolumeResponseBody'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - HMACSignature: []
        Nonce: []
        PublicKey: []
        Timestamp: []
      summary: User Volume
      tags:
      - user
components:
  schemas:
    PositionPublic:
      additionalProperties: false
      properties:
        average_price:
          format: double
          type: number
        initial_margin:
          format: double
          type: number
        leverage:
          format: double
          type: number
        maintenance_margin:
          format: double
          type: number
        net_funding:
          format: double
          type: number
        open_orders:
          format: int64
          type: integer
        open_quantity:
          format: double
          type: number
        position:
          format: double
          type: number
        realised_pnl:
          format: double
          type: number
        symbol:
          type: string
        unrealised_pnl:
          format: double
          type: number
      required:
      - symbol
      - position
      - realised_pnl
      - unrealised_pnl
      - net_funding
      - open_orders
      - open_quantity
      - leverage
      - initial_margin
      - maintenance_margin
      - average_price
      type: object
    Trade:
      additionalProperties: false
      properties:
        fee:
          format: double
          type: number
        id:
          type: string
        margin_used:
          format: double
          type: number
        order_id:
          type: string
        order_timestamp:
          format: double
          type: number
        order_type:
          type: string
        price:
          format: double
          type: number
        quantity:
          format: double
          type: number
        realised_pnl_change:
          format: double
          type: number
        side:
          type: string
        symbol:
          type: string
        tif:
          type: string
      required:
      - id
      - order_timestamp
      - symbol
      - price
      - quantity
      - side
      - fee
      - margin_used
      - order_type
      - tif
      - order_id
      - realised_pnl_change
      type: object
    ListSubaccountsResponseBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/ListSubaccountsResponseBody.json
          format: uri
          readOnly: true
          type: string
        account_ids:
          items:
            type: string
          type:
          - array
          - 'null'
      required:
      - account_ids
      type: object
    ReferralRewardsResponseBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/ReferralRewardsResponseBody.json
          format: uri
          readOnly: true
          type: string
        count:
          format: int64
          type: integer
        data:
          items:
            $ref: '#/components/schemas/ReferralReward'
          type:
          - array
          - 'null'
        duration:
          type: string
        end:
          format: date-time
          type: string
        interval:
          type: string
        start:
          format: date-time
          type: string
        total_amount:
          format: double
          type: number
      required:
      - duration
      - interval
      - end
      - data
      - count
      - total_amount
      type: object
    HistoricUserPnlResponseBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/HistoricUserPnlResponseBody.json
          format: uri
          readOnly: true
          type: string
        count:
          format: int64
          type: integer
        data:
          items:
            $ref: '#/components/schemas/HistoricUserPnlPoint'
          type:
          - array
          - 'null'
        duration:
          type: string
        end:
          format: date-time
          type: string
        interval_minutes:
          format: int64
          type: integer
        start:
          format: date-time
          type: string
        symbols:
          items:
            type: string
          type:
          - array
          - 'null'
        unit:
          type: string
      required:
      - duration
      - unit
      - interval_minutes
      - end
      - data
      - count
      type: object
    AccountEquityPoint:
      additionalProperties: false
      properties:
        value:
          format: double
          type: number
        window_start:
          format: date-time
          type: string
      required:
      - window_start
      - value
      type: object
    HistoricOrder:
      additionalProperties: false
      properties:
        avg_price:
          format: double
          type:
          - number
          - 'null'
        client_order_id:
          type: string
        execution_state:
          type: string
        filled_qty:
          format: double
          type: number
        first_fill_ts:
          format: date-time
          type:
          - string
          - 'null'
        last_fill_ts:
          format: date-time
          type:
          - string
          - 'null'
        order_id:
          type: string
        passive_qty:
          format: double
          type: number
        price:
          format: double
          type: number
        quantity:
          format: double
          type: number
        side:
          type: string
        status_ts:
          format: date-time
          type: string
        symbol:
          type: string
        terminal_status:
          type: string
        time_in_force:
          type: string
        type:
          type: string
      required:
      - order_id
      - terminal_status
      - status_ts
      - symbol
      - side
      - type
      - time_in_force
      - quantity
      - price
      - client_order_id
      - passive_qty
      - filled_qty
      - avg_price
      - first_fill_ts
      - last_fill_ts
      - execution_state
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    UserVolumePoint:
      additionalProperties: false
      properties:
        date:
          format: date-time
          type: string
        maker_volume:
          format: double
          type: number
        taker_volume:
          format: double
          type: number
        volume:
          format: double
          type: number
      required:
      - date
      - maker_volume
      - taker_volume
      - volume
      type: object
    AccountEquityResponseBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/AccountEquityResponseBody.json
          format: uri
          readOnly: true
          type: string
        count:
          format: int64
          type: integer
        data:
          items:
            $ref: '#/components/schemas/AccountEquityPoint'
          type:
          - array
          - 'null'
        duration:
          type: string
        end:
          format: date-time
          type: string
        interval_minutes:
          format: int64
          type: integer
        start:
          format: date-time
          type: string
      required:
      - duration
      - interval_minutes
      - end
      - data
      - count
      type: object
    HistoricUserPnlPoint:
      additionalProperties: false
      properties:
        value:
          format: double
          type: number
        window_start:
          format: date-time
          type: string
      required:
      - window_start
      - value
      type: object
    CreateSubaccountResponseBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/CreateSubaccountResponseBody.json
          format: uri
          readOnly: true
          type: string
        account_id:
          format: uuid
          type: string
      required:
      - account_id
      type: object
    SetUserLeverageRequestBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/SetUserLeverageRequestBody.json
          format: uri
          readOnly: true
          type: string
        leverage:
          format: float
          type: number
        symbol:
          type: string
      required:
      - leverage
      - symbol
      type: object
    TransferRequestBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/TransferRequestBody.json
          format: uri
          readOnly: true
          type: string
        amount:
          format: double
          type: number
      required:
      - amount
      type: object
    ReferralReward:
      additionalProperties: false
      properties:
        amount:
          format: double
          type: number
        reward_date:
          format: date-time
          type: string
      required:
      - reward_date
      - amount
      type: object
    PositionsBalanceResponseBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/PositionsBalanceResponseBody.json
          format: uri
          readOnly: true
          type: string
        balance:
          $ref: '#/components/schemas/BalancePublic'
        positions:
          items:
            $ref: '#/components/schemas/PositionPublic'
          type:
          - array
          - 'null'
      required:
      - positions
      - balance
      type: object
    SetUserLeverageResponseBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/SetUserLeverageResponseBody.json
          format: uri
          readOnly: true
          type: string
        leverage:
          format: float
          type: number
      required:
      - leverage
      type: object
    BalancePublic:
      additionalProperties: false
      properties:
        available_balance:
          format: double
          type: number
        deposit:
          format: double
          type: number
        net_funding:
          format: double
          type: number
        order_margin:
          format: double
          type: number
        position_margin:
          format: double
          type: number
        realised_pnl:
          format: double
          type: number
        unrealised_pnl:
          format: double
          type: number
      required:
      - deposit
      - realised_pnl
      - order_margin
      - position_margin
      - unrealised_pnl
      - net_funding
      - available_balance
      type: object
    HistoricTwapsResponseBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/HistoricTwapsResponseBody.json
          format: uri
          readOnly: true
          type: string
        count:
          format: int64
          type: integer
        data:
          items:
            $ref: '#/components/schemas/HistoricTwap'
          type:
          - array
          - 'null'
      required:
      - data
      - count
      type: object
    HistoricOrdersResponseBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/HistoricOrdersResponseBody.json
          format: uri
          readOnly: true
          type: string
        count:
          format: int64
          type: integer
        data:
          items:
            $ref: '#/components/schemas/HistoricOrder'
          type:
          - array
          - 'null'
      required:
      - data
      - count
      type: object
    UserVolumeResponseBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/UserVolumeResponseBody.json
          format: uri
          readOnly: true
          type: string
        count:
          format: int64
          type: integer
        data:
          items:
            $ref: '#/components/schemas/UserVolumePoint'
          type:
          - array
          - 'null'
        end:
          format: date-time
          type: string
        interval:
          type: string
        range:
          type: string
        start:
          format: date-time
          type: string
        symbols:
          items:
            type: string
          type:
          - array
          - 'null'
        total_maker_volume:
          format: double
          type: number
        total_taker_volume:
          format: double
          type: number
        total_volume:
          format: double
          type: number
      required:
      - range
      - interval
      - end
      - data
      - count
      - total_maker_volume
      - total_taker_volume
      - total_volume
      type: object
    TradesResponseBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/TradesResponseBody.json
          format: uri
          readOnly: true
          type: string
        count:
          format: int64
          type: integer
        data:
          items:
            $ref: '#/components/schemas/Trade'
          type:
          - array
          - 'null'
      required:
      - data
      - count
      type: object
    ErrorModel:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/ErrorModel.json
          format: uri
          readOnly: true
          type: string
        detail:
          description: A human-readable explanation specific to this occurrence of the problem.
          examples:
          - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
          - array
          - 'null'
        instance:
          description: A URI reference that identifies the specific occurrence of the problem.
          examples:
          - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
          - 400
          format: int64
          type: integer
        title:
          description: A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
          examples:
          - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
          - https://example.com/errors/example
          format: uri
          type: string
      type: object
    FeesResponseBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.qfex.com/schemas/FeesResponseBody.json
          format: uri
          readOnly: true
          type: string
        fees:
          additionalProperties:
            $ref: '#/components/schemas/FeeEntry'
          examples:
          - AUD-USD:
              maker_fee: 10000
              taker_fee: 20000
            EUR-USD:
              maker_fee: 10000
              taker_fee: 20000
          type: object
      required:
      - fees
      type: object
    FeeEntry:
      additionalProperties: false
      properties:
        maker_fee:
          format: int64
          type: integer
        taker_fee:
          format: int64
          type: integer
      required:
      - maker_fee
      - taker_fee
      type: object
    HistoricTwap:
      additionalProperties: false
      properties:
        average_fill_price:
          format: double
          type: number
        client_twap_id:
          type:
          - string
          - 'null'
        created_at:
          format: date-time
          type:
          - string
          -

# --- truncated at 32 KB (34 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/qfex/refs/heads/main/openapi/qfex-user-api-openapi.yml