openapi: 3.0.1
info:
  title: TrueX REST API
  description: >
    ## Overview

    This API allows clients to interact with the **TrueX trading platform** for
    order management, market data retrieval, and account information.


    ## Base URL

    ```

    https://prod.truex.co/api/v1/

    ```


    ## Authentication

    Certain API requests must be **authenticated** using **HMAC-SHA256 signature
    authentication**.


    ## Links

    - 📖 **Full API Documentation**:
    [https://docs.truex.co/](https://docs.truex.co/)

    - 📧 **Support**: [support@truex.co](mailto:support@truex.co)
  contact:
    email: info@truex.co
  termsOfService: https://truex.co/tos
  version: 1.0.0
servers:
  - url: https://prod.truex.co
paths:
  /api/v1/asset:
    get:
      tags:
        - Assets
      summary: Get assets
      description: >-
        Query for assets available on the exchange by specific asset ID or
        name.  If no query parameters are supplied than ALL available assets
        will be returned.
      operationId: getAsset
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Asset'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Error serializing data.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      parameters:
        - name: id
          in: query
          description: ID of asset to query for.
          required: false
          schema:
            type: string
        - name: name
          in: query
          description: Name of the asset to query for.
          required: false
          schema:
            type: string
      security:
        - {}
  /api/v1/instrument:
    get:
      tags:
        - Instruments
      summary: Get instruments
      description: >-
        Query for instruments available on the exchange by specific instrument
        ID or name.  If no query parameters are supplied than ALL available
        instruments will be returned.
      operationId: getInstrument
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Instrument'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Error serializing data.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      parameters:
        - name: id
          in: query
          description: ID of instrument to query for.
          required: false
          schema:
            type: string
        - name: symbol
          in: query
          description: Symbol of the instrument to query for.
          required: false
          schema:
            type: string
      security:
        - {}
  /api/v1/market/quote:
    get:
      tags:
        - Market Data
      summary: Get markets
      description: >-
        Query for the exchange best bid/offer (EBBO) by instrument ID. If no
        query parameters are supplied then ALL available EBBOs will be returned.
      operationId: getMarketData
      parameters:
        - name: instrument_id
          in: query
          description: Instrument ID of the market to query for.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MarketData'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Error serializing data.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      security:
        - {}
  /api/v1/client:
    get:
      tags:
        - Clients
      summary: Get clients
      description: Query for a user's information.
      operationId: getClient
      parameters:
        - $ref: '#/components/parameters/XAuthUserId'
        - $ref: '#/components/parameters/XAuthTimestamp'
        - $ref: '#/components/parameters/XAuthToken'
        - $ref: '#/components/parameters/XAuthSignature'
        - name: id
          in: query
          description: ID of client to query for.
          required: false
          schema:
            type: string
        - name: mnemonic
          in: query
          description: Client mnenomic (human readable text) to query for.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Client'
        '401':
          description: Not authorized.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '403':
          description: Invalid permissions.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Error serializing data.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      security:
        - HMAC: []
    patch:
      tags:
        - Clients
      summary: Update client settings
      description: Update client level settings.
      operationId: patchClient
      parameters:
        - $ref: '#/components/parameters/XAuthUserId'
        - $ref: '#/components/parameters/XAuthTimestamp'
        - $ref: '#/components/parameters/XAuthToken'
        - $ref: '#/components/parameters/XAuthSignature'
      requestBody:
        description: Client settings context.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientPatch'
        required: true
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Client'
        '401':
          description: Not authorized.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '403':
          description: Invalid permissions.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Error serializing data.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      security:
        - HMAC: []
  /api/v1/order/active:
    get:
      tags:
        - Orders
      summary: Active orders
      description: >-
        Query for orders currently active on the exchange. An order ID may be
        supplied to query for a specific order, if this query parameter is not
        supplied then all active orders will be returned.
      operationId: getOrderActive
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Order'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '401':
          description: Not authorized.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '403':
          description: Invalid permissions.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Error serializing data.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      parameters:
        - $ref: '#/components/parameters/XAuthUserId'
        - $ref: '#/components/parameters/XAuthTimestamp'
        - $ref: '#/components/parameters/XAuthToken'
        - $ref: '#/components/parameters/XAuthSignature'
        - name: id
          in: query
          description: ID of order to query for.
          required: false
          schema:
            type: string
      security:
        - HMAC: []
  /api/v1/order:
    get:
      tags:
        - Orders
      summary: All orders
      description: >-
        Query for all orders placed on the exchange within the last 24 hours. A
        filter can be provided to limit the results.
      operationId: getOrder
      parameters:
        - $ref: '#/components/parameters/XAuthUserId'
        - $ref: '#/components/parameters/XAuthTimestamp'
        - $ref: '#/components/parameters/XAuthToken'
        - $ref: '#/components/parameters/XAuthSignature'
        - name: query
          in: query
          description: >-
            A serialized JSON object containing filter parameters. Filter orders
            by property, using $eq, $lt, $gt, $gte, $lte operators.
          schema:
            type: string
          examples:
            example1:
              summary: Filter for BUY orders
              value: >-
                {"columns":[{"name":"status","filter":[{"$in": ["REJECTED",
                "CANCELED"]}] }]}
        - name: skip
          in: query
          required: false
          description: The number of items to skip for pagination.
          schema:
            type: integer
            default: 0
          examples:
            example1:
              summary: Skip 10 items
              value: 10
        - name: size
          in: query
          required: false
          description: The number of items to return.
          schema:
            type: integer
            default: 10
          examples:
            example1:
              summary: Return 10 items
              value: 10
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Order'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '401':
          description: Not authorized.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '403':
          description: Invalid permissions.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Error serializing data.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      security:
        - HMAC: []
    post:
      tags:
        - Orders
      summary: Create order
      description: Create a new order for a specific instrument.
      operationId: addOrder
      parameters:
        - $ref: '#/components/parameters/XAuthUserId'
        - $ref: '#/components/parameters/XAuthTimestamp'
        - $ref: '#/components/parameters/XAuthToken'
        - $ref: '#/components/parameters/XAuthSignature'
      requestBody:
        description: Order new request context.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderNew'
        required: true
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '401':
          description: Not authorized.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '403':
          description: Invalid permissions.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Internal server error - See message on request for more information.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      security:
        - HMAC: []
    patch:
      tags:
        - Orders
      summary: Modify order
      description: Modify an existing active order request.
      operationId: modifyOrder
      parameters:
        - $ref: '#/components/parameters/XAuthUserId'
        - $ref: '#/components/parameters/XAuthTimestamp'
        - $ref: '#/components/parameters/XAuthToken'
        - $ref: '#/components/parameters/XAuthSignature'
      requestBody:
        description: Order modify request context.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderModify'
        required: true
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '401':
          description: Not authorized.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '403':
          description: Invalid permissions.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Internal server error - See message on request for more information.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      security:
        - HMAC: []
  /api/v1/order/{ref_order_id}:
    delete:
      tags:
        - Orders
      summary: Cancel order
      description: >-
        Begins the cancellation process of an existing active order from the
        exchange.  N.B. it is still possible to recieve trades on the order that
        is being canceled.
      operationId: cancelOrder
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '401':
          description: Not authorized.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '403':
          description: Invalid permissions.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '404':
          description: Order not found.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Error serializing data.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      parameters:
        - $ref: '#/components/parameters/XAuthUserId'
        - $ref: '#/components/parameters/XAuthTimestamp'
        - $ref: '#/components/parameters/XAuthToken'
        - $ref: '#/components/parameters/XAuthSignature'
        - name: ref_order_id
          in: path
          description: ID of order to cancel.
          required: true
          schema:
            type: string
      security:
        - HMAC: []
  /api/v1/order/trade:
    get:
      tags:
        - Orders
      summary: All order trades
      description: >-
        Fetches all trades for a client executed within the past 24 hours on the
        exchange. A filter can be provided to limit the results.
      operationId: getOrderTrades
      parameters:
        - $ref: '#/components/parameters/XAuthUserId'
        - $ref: '#/components/parameters/XAuthTimestamp'
        - $ref: '#/components/parameters/XAuthToken'
        - $ref: '#/components/parameters/XAuthSignature'
        - name: size
          in: query
          description: Number of records to return per page. Maximum allowed value is 100.
          required: false
          schema:
            type: string
        - name: skip
          in: query
          description: >-
            Number of records to skip before returning results. Used for
            offset-based pagination.
          required: false
          schema:
            type: string
        - name: timestamp
          in: query
          description: >
            A Unix timestamp in **UTC nanoseconds** (e.g.,
            `1741523275598727336`) that serves as the reference point for
            fetching transfers.  This ensures precise time-based filtering and
            stable pagination.  If omitted, the server responds with **400 BAD
            REQUEST**.
          required: true
          schema:
            type: string
            example: '1741523275598727336'
            pattern: ^[0-9]{19}$
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OrderTrade'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '401':
          description: Not authorized.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '403':
          description: Invalid permissions.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Error serializing data.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      security:
        - HMAC: []
  /api/v1/balance:
    get:
      tags:
        - Balances
      summary: Get balance
      description: Query for balance information current allocated to the exchange.
      operationId: getBalance
      parameters:
        - $ref: '#/components/parameters/XAuthUserId'
        - $ref: '#/components/parameters/XAuthTimestamp'
        - $ref: '#/components/parameters/XAuthToken'
        - $ref: '#/components/parameters/XAuthSignature'
        - name: asset_id
          in: query
          description: ID of asset to query balance information for.
          required: false
          schema:
            type: string
        - name: asset_name
          in: query
          description: Name of asset to query balance information for.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Balances'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '401':
          description: Not authorized.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '403':
          description: Invalid permissions.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Error serializing data.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      security:
        - HMAC: []
  /api/v1/transfer/active:
    get:
      tags:
        - Transfers
      summary: Get Active transfers
      description: >-
        Fetches all currently active transfers on the exchange. If a
        `transfer_id` is provided, returns details for the specified transfer.
        Otherwise, retrieves all active transfers for the authenticated client.
      operationId: getActiveTransfer
      parameters:
        - $ref: '#/components/parameters/XAuthUserId'
        - $ref: '#/components/parameters/XAuthTimestamp'
        - $ref: '#/components/parameters/XAuthToken'
        - $ref: '#/components/parameters/XAuthSignature'
        - name: transfer_id
          in: query
          description: >-
            Unique identifier of a specific transfer. If omitted, all active
            transfers for the client will be returned.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful response with active transfers.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TransferDetails'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '401':
          description: Not authorized.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '403':
          description: Invalid permissions.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Error serializing data.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      security:
        - HMAC: []
  /api/v1/transfer:
    get:
      tags:
        - Transfers
      summary: Get transfer
      description: >-
        Fetches all transfers for a client within the past 24 hours on the
        exchange.
      operationId: getTransfer
      parameters:
        - $ref: '#/components/parameters/XAuthUserId'
        - $ref: '#/components/parameters/XAuthTimestamp'
        - $ref: '#/components/parameters/XAuthToken'
        - $ref: '#/components/parameters/XAuthSignature'
        - name: size
          in: query
          description: >-
            Number of transfers to return per page. Maximum allowed value is
            100.
          required: false
          schema:
            type: string
        - name: skip
          in: query
          description: >-
            Number of records to skip before returning results. Used for
            offset-based pagination.
          required: false
          schema:
            type: string
        - name: timestamp
          in: query
          description: >
            A Unix timestamp in **UTC nanoseconds** (e.g.,
            `1741523275598727336`) that serves as the reference point for
            fetching transfers.  This ensures precise time-based filtering and
            stable pagination.  If omitted, the server responds with **400 BAD
            REQUEST**.
          required: true
          schema:
            type: string
            example: '1741523275598727336'
            pattern: ^[0-9]{19}$
      responses:
        '200':
          description: Successful response with a list of transfers.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/HistoricalTransfer'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '401':
          description: Not authorized.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '403':
          description: Invalid permissions.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Error serializing data.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      security:
        - HMAC: []
    post:
      tags:
        - Transfers
      summary: Initiate transfer
      description: Initiate a new transfer of assets to/from the exchange.
      operationId: addTransfer
      parameters:
        - $ref: '#/components/parameters/XAuthUserId'
        - $ref: '#/components/parameters/XAuthTimestamp'
        - $ref: '#/components/parameters/XAuthToken'
        - $ref: '#/components/parameters/XAuthSignature'
      requestBody:
        description: Transfer request object.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Transfer'
        required: true
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransferDetails'
        '400':
          description: Invalid parameter supplied.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '401':
          description: Not authorized.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '403':
          description: Invalid permissions.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
        '500':
          description: Internal server error - See message on request for more information.
          content:
            application/problem+json:
              schema:
                type: object
                $ref: '#/components/schemas/Problem'
      security:
        - HMAC: []
components:
  schemas:
    Asset:
      type: object
      properties:
        id:
          type: string
          example: '0987654321'
          description: Exchange assigned ID of asset.
        status:
          enum:
            - DISABLED
            - ACTIVE
            - INVALID
          type: string
          example: ACTIVE
          description: Current asset state.
        fields:
          type: object
          properties:
            name:
              type: string
              maxLength: 31
              example: BTC
              description: Human readable name of the asset.
            min_transfer_qty:
              type: string
              example: '1000.01'
              description: >-
                The minimum amount of an asset that can be transferred in a
                single transaction, specific to each asset.
            max_transfer_qty:
              type: string
              example: '9999.99'
              description: >-
                The maximum amount of an asset that can be transferred in a
                single transaction, specific to each asset.
            flags:
              type: array
              uniqueItems: true
              items:
                type: string
                enum:
                  - REFERENCE_ASSET
                  - STABLECOIN
                example: STABLECOIN
              description: >
                A platform-defined value that provides additional metadata or
                classification for the asset. This flag is used to denote
                specific attributes or roles associated with the asset within
                the exchange ecosystem.

                - **REFERENCE_ASSET** Indicates that the asset is the default
                reference asset for the exchange. It serves as the primary asset
                for settling trades by default and is used as the basis for
                calculating fees.

                - **STABLECOIN** Indicates if the asset is a stablecoin (value
                pegged to a external source such as fiat currency.
    InstrumentStat:
      type: object
      properties:
        last_24hr_notional:
          type: string
          example: '4325606.30380'
          description: >-
            The notional (quantity * price) amount of REFERENCE_ASSET traded
            over the last 24hr period.
        last_24hr_quantity:
          type: string
          example: '123754.234598480'
          description: The quantity traded over the last 24 hour period.
    Instrument:
      type: object
      properties:
        id:
          type: string
          example: '0987654321'
          description: Exchange assigned ID of the instrument.
        status:
          enum:
            - DISABLED
            - OPENING
            - ACTIVE
            - HALTED
          type: string
          example: ACTIVE
          description: Current instrument state.
        info:
          type: object
          properties:
            symbol:
              type: string
              maxLength: 31
              example: BTC-PYUSD
              description: Human readable representation of the instrument.
            reference_price:
              type: string
              example: '75000.50'
              description: Price used for initial price limit/band calcuations.
            base_asset_id:
              type: string
              example: '123456789'
              description: ID of the base asset.
            quote_asset_id:
              type: string
              example: '987654321'
              description: ID of the quote asset.
            price_limit_window_secs:
              type: string
              example: '3600'
              description: Number of seconds in the price limit's sliding window.
            price_limit_percent:
              type: string
              example: '0.015'
              description: >-
                Specifies the percentage threshold for price movement beyond a
                reference price (e.g., the midpoint or previous close) at which
                the exchange will take action. If the price of a trade or order
                breaches this threshold, the exchange may halt trading, trigger
                a circuit breaker, or initiate other predefined actions to
                ensure market stability.
            price_bands_percent:
              type: string
              example: '0.025'
              description: >-
                Defines the acceptable price range for order validation within
                the market. The price bands ensure that orders are priced within
                a range around the market's midpoint, adjusted for increments
                and thresholds.
        stats:
          type: object
          $ref: '#/components/schemas/InstrumentStat'
    MarketQuote:
      type: object
      properties:
        price:
          type: string
          example: '75.50'
        qty:
          type: string
          example: '1.5'
    MarketData:
      type: object
      properties:
        id:
          type: string
          example: '0987654321'
          description: Exchange assigned ID of the market data.
        status:
          enum:
            - DISABLED
            - ENABLED
          type: string
          example: ENABLED
          description: Current market data state.
        info:
          type: object
          properties:
            last_trade:
              type: object
              $ref: '#/components/schemas/MarketQuote'
              description: Last trade information.
            best_bid:
              type: object
              $ref: '#/components/schemas/MarketQuote'
              description: Current (at the time of request) exchange best bid.
            best_ask:
              type: object
              $ref: '#/components/schemas/MarketQuote'
              description: Current (at the time of request) exchange best ask.
            last_update:
              type: string
              example: '123478909'
              description: >-
                A UTC Unix epoch in nanoseconds indicating when the book was
                last updated.
    Client:
      type: object
      properties:
        id:
          type: string
          example: '0987654321'
        status:
          enum:
            - INITIIALIZED
            - ACTIVE
            - DISABLED
          type: string
          example: ACTIVE
          description: Current client state.
        info:
          type: object
          properties:
            organization_id:
              type: string
              format: uuid
              description: >-
                Must be UUIDv4. [RFC
                9562](https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-4).
              example: ed671d2b-bb9e-4cf5-9eb4-71b6db672207
            mnemonic:
              type: string
              example: CLIENT1
              description: Client supplied human readable name of the client entity.
            type:
              type: string
              enum:
                - INSTITUTION
                - INDIVIDUAL
                - APPLICATION
              example: INDIVIDUAL
              description: Client designation.
            maker_fee_tier:
              type: integer
              example: 1
              description: Client's current maker fee tier.
            taker_fee_tier:
              type: integer
              example: 2
              description: Client's current taker fee tier.
            self_trade_prevention:
              type: string
              enum:
                - INVALID
                - NONE
                - CANCEL_AGGRESSIVE
                - CANCEL_BOTH
              example: CANCEL_AGGRESSIVE
              description: >
                Client level self trade protection instruction.

                * **INVALID** Client level self trade protections are in an
                invalid state and may result in order rejection.

                * **NONE** No self trade protections are enabled for this
                client.  Can be overridden at the order level.

                * **CANCEL_AGGRESSIVE** All orders entered with this client ID
                will have cancel aggressive self trade protections enabled.

                * **CANCEL_BOTH** All order entered with this client ID will
                have cancel both self trade protections enabled.
    ClientPatch:
      type: object
      properties:
        id:
          type: string
          example: '1234567890'
        info:
          type: object
          properties:
            self_trade_prevention:
              type: string
              enum:
                - NONE
                - CANCEL_AGGRESSIVE
                - CANCEL_BOTH
              example: CANCEL_BOTH
              description: >
                Set the client level self trade protection instruction.

                * **NONE** No self trade protections are enabled for this
                client.

                * **CANCEL_AGGRESSIVE** All orders entered with this client ID
                will have cancel aggressive self trade protections enabled.

                * **CANCEL_BOTH** All order entered with this client ID will
                have cancel both self trade protections enabled.
    OrderNew:
      type: object
      required:
        - info
      properties:
        external_id:
          type: string
          example: 321e7654-e89b-42d4-a456-426614174000
          description: >
            A unique identifier created by the client.  Must be in one the
            follower formats:

              * UUID version 4 in its human readable form, with hypens, and in lowercase (e.g. 2adc09dd-d49f-41da-b3b8-30d01bb350fe).

              * ASCII character string that does not exceed 18 characters.
        info:
          type: object
          $ref: '#/components/schemas/OrderInfo'
    OrderInfo:
      type: object
      required:
        - client_id
        - instrument_id
        - qty
        - price
        - side
        - type
      properties:
        msg_id:
          type: string
          example: '123456789'
          description: ID of last message to act upon the order.
        parent_id:
          type: string
          example: '0'
          description: ID of the application creating the order, may be zero.
        client_id:
          type: string
          example: '5432167890'
          description: The client ID the order will be entered on behalf of.
        instrument_id:
          type: string
          example: '987654321'
          description: The ID of the instrument the order will transact in.
        qty:
          type: string
          example: '10.5'
          description: The amount of base asset the order is requesting to tranasct.
        price:
          type: string
          example: '75.50'
          description: >-
            The highest or lowest price the order will buy or sell,
            respectively, at. Only required for LIMIT orders.
        flags:
          type: array
          uniqueItems: true
          items:
            type: string
            enum:
              - USE_AGGRESSIVE_PRICING
            example: USE_AGGRESSIVE_PRICING
          description: >
            General order flags that can be combined and used together.

            * **USE_AGGRESIVE_PRICING** Applicable to market orders only. When
            enabled, the exchange calculates a price for the market order that
            is more aggressive than the current best bid or offer. This is
            useful when prioritizing liquidity capture over minimizing price
            slippage.
        side:
          type: string
          enum:
            - BUY
            - SELL
          description: |
            Side of order, can be `BUY` or `SELL`
            * **BUY** Provide trader's quote asset to acquire the base asset.
            * **SELL** Provide trader's base asset to acquire the quote asset.
          example: BUY
        type:
          type: string
          enum:
            - LIMIT
            - MARKET
          description: >
            Type of order, can be `LIMIT`, `MARKET`.

            * **LIMIT** A specified limit price sets the maximum amount in quote
            currency units that the order will exchange to acquire the base
            currency.

            * **MARKET** The order uses the TrueX market price at time of order
            entry plus/minus (for buy/sell respectively) the max price allowed
            by the price band risk limits for the instrument.
          example: LIMIT
        tif:
          type: string
          enum:
            - GTC
            - IOC
          description: >
            The "Time In Force" (TIF) of an order indicates how long the order
            will remain active before being canceled, can be `GTC`, `IOC`.

            * **GTC** (Good-Till-Cancel) Order remains active for up to 30 days
            from the time of entry. 

            * **IOC** (Immediate-Or-Cancel) Order will execute as much of the
            order as possible up to the requested price, provided there are
            existing orders that match or improve upon the price. An `IOC` order
            will cancel any unfilled quantity back to the requestor. If no
            matching orders are found, the `IOC` order will be canceled
            immediately. If the TIF is omitted, the order will default to `GTC`.
          example: GTC
        exec_inst_flags:
          type: array
          uniqueItems: true
          items:
            type: string
            enum:
              - ALO
            example: ALO
          description: >
            Execution specific instructions that can be combined and used
            together.

            * **ALO** Ensures the order adds liquidity to the market rather than
            removing it. When this flag is enabled, the order will only be
            placed if it would not immediately execute against the current best
            bid or offer. If the order would otherwise result in an immediate
            match, it will be canceled or adjusted based on the exchange's
            rules.
        hold_fee_rate:
          type: string
          example: '0.002'
          description: >-
            The amount of fee asset being held by the order. This is not
            necessarily the fee charge associated with the order.
        stp:
          type: string
          enum:
            - INVALID
            - NONE
            - CANCEL_AGGRESSIVE
            - CANCEL_BOTH
          example: NONE
          description: >
            Order level self trade protection instruction.

            * **INVALID** Order level self trade protections are in an invalid
            state and may result in order rejection.

            * **NONE** No self trade protections are enabled for this order.  

            * **CANCEL_AGGRESSIVE** This order will be canceled in the result of
            a self trade.

            * **CANCEL_BOTH** This order and the resting order will both be
            canceled in the result of a self trade.
    OrderModify:
      type: object
      required:
        - info
      properties:
        id:
          type: string
          example: '1159718398822187014'
          description: >
            The internal order ID of the order to be modified. This is the id
            that was set by TrueX and should be a purely numeric string.
        external_id:
          type: string
          example: 123e7654-e89b-42d4-a456-426614174000
          description: >
            The external ID for the modification request set by the client. Must
            be in one the follower formats:

            * **UUID** version 4 in its human readable form, with hypens, and in
            lowercase (e.g. 2adc09dd-d49f-41da-b3b8-30d01bb350fe).

            * **ASCII** character string that does not exceed 18 characters.
        info:
          type: object
          $ref: '#/components/schemas/ModifyInfo'
    ModifyInfo:
      type: object
      required:
        - client_id
        - new_qty
        - new_price
      properties:
        msg_id:
          type: string
          example: '123456789'
          description: ID of last message to act upon the order.
        parent_id:
          type: string
          example: '0'
          description: ID of the application creating the order, may be zero.
        client_id:
          type: string
          example: '5432167890'
          description: The client ID the modification will be entered on behalf of.
        prev_modify:
          type: string
          example: '0'
          description: ID of previous modify to act upon the order.
        new_qty:
          type: string
          example: '1.5'
          description: The new amount of base asset the order is requesting to tranasct.
        new_price:
          type: string
          example: '75.50'
          description: >-
            The new highest or lowest price the order will buy or sell,
            respectively, at. Only required for LIMIT orders.
        new_type:
          type: string
          enum:
            - MARKET
          example: MARKET
          description: >
            `LIMIT` orders may be converted to `MARKET` orders. The new `MARKET`
            order will immediately execute against the resting side of the order
            book providing there is available liquidity on the contra side of
            the request.
    Order:
      type: object
      properties:
        id:
          type: string
          example: '0987654321'
        status:
          enum:
            - INITIALIZED
            - NEW_PENDING
            - REJECTED
            - ACTIVE
            - FILLED
            - CANCEL_PENDING
            - CANCELED
            - MODIFY_PENDING
          type: string
          example: ACTIVE
          description: >
            The current status of the order.

            * **INITIALIZED** Order has been created, but not sent yet.

            * **NEW_PENDING** Order has been sent, but not confirmed by the
            exchange or downstream process.

            * **REJECTED** An order setting or market condition prevents the
            order from getting processed.

            * **ACTIVE** The order was accepted by the system and open to
            trading (order and market conditions permitting).

            * **FILLED** The entire order traded.

            * **CANCEL_PENDING** Indicates a cancel request was received and
            being processed.

            * **CANCELED** The order was canceled from a cancel request, order
            conditions, or market conditions.

            * **MODIFY_PENDING** Indicates a modification request was received
            and being processed.
        order_info:
          type: object
          $ref: '#/components/schemas/OrderInfo'
        modify_info:
          type: object
          $ref: '#/components/schemas/ModifyInfo'
        external_id:
          type: string
          example: EXT-ORDER-123
          description: >
            A unique identifier created by the client.  Must be in one the
            follower formats:

            * **UUID** version 4 in its human readable form, with hypens, and in
            lowercase (e.g. 2adc09dd-d49f-41da-b3b8-30d01bb350fe).

            * **ASCII** character string that does not exceed 18 characters.
        ref_external_id:
          type: string
          example: REF-EXT-ORDER-123
          description: >
            A unique identifier created by the client.  Must be in one the
            follower formats:

            * **UUID** version 4 in its human readable form, with hypens, and in
            lowercase (e.g. 2adc09dd-d49f-41da-b3b8-30d01bb350fe).

            * **ASCII** character string that does not exceed 18 characters.
        pending_qty:
          type: string
          example: '1'
          description: >-
            Order quantity that has been acknowledge by the exchange but is not
            yet trading.
        leaves_qty:
          type: string
          example: '100'
          description: Order quantity that is currently active in the market.
        exeuted_qty:
          type: string
          example: '100'
          description: Amount of quantity currently executed.
        executed_vwap:
          type: string
          example: '897.321'
          description: >-
            Volume weighted average price calculation for all executions on the
            order.
    Balance:
      type: object
      properties:
        asset_id:
          type: string
          example: '0987654321'
          description: Exchange assigned entity ID.
        state:
          type: string
          enum:
            - INVALID
            - INITIALIZED
            - OPEN
            - LOCKED
            - CLOSING
          example: OPEN
          description: >
            Current state of the balance.

            * **INVALID** Balance is not active on the exchange and currently in
            an error state.

            * **INIITIALIZED** Balance has been created on the exchange but is
            not currently active.

            * **OPEN** Balance is active on the exchange.

            * **LOCKED** Balance is on the exchange but cannot be used for
            transactions.

            * **CLOSING** Balance is currently be moved off of the exchange and
            cannot be used for transactions."
        balance:
          type: string
          example: '123.45'
          description: Total amount of asset currently placed on the exchange.
        order_hold:
          type: string
          example: '45.321'
          description: >-
            Amount of asset currently being held by the exchange due to trading
            activity.
        transfer_hold:
          type: string
          example: '100.00'
          description: >-
            Amount of asset currently being held by the exchange due to transfer
            activity.
        unsettled:
          type: string
          example: '25.00'
          description: >-
            Amount of asset that has been traded on the exchange but is awaiting
            settlement by the asset custodian.
    Balances:
      type: object
      properties:
        id:
          type: string
          example: '0987654321'
          description: Exchange assigned entity ID.
        state:
          type: string
          enum:
            - INVALID
          example: INVALID
          description: Exchange only status value, will always bee INVALID.
        unsettled_fees:
          type: string
          example: '-0.25'
          description: >-
            Current amount of fee asset that have been accrued due to trading
            but have yet to be settled with the exchange.
        fees_hold:
          type: string
          example: '1.15'
          description: >-
            Current amount of fee asset that is being held by the exchange as a
            result of trading activity.
        balances:
          type: array
          items:
            $ref: '#/components/schemas/Balance'
    FiatInstructions:
      type: object
      required:
        - fiat_account_id
        - identity_id
        - account_id
        - include_fee
      properties:
        fiat_account_id:
          type: string
          format: uuid
          description: The ID of the fiat account to use for the transfer.
          example: ed671d2b-bb9e-4cf5-9eb4-71b6db672207
        identity_id:
          type: string
          format: uuid
          description: The identity ID of the individual submitting the transfer.
          example: b2a99c93-f1ee-41ed-9e9e-ec704cfbca4b
        account_id:
          type: string
          format: uuid
          description: The account ID of the institution submitting the transfer.
          example: b2a99c93-f1ee-41ed-9e9e-ec704cfbca4b
        includes_fee:
          type: boolean
          description: >-
            Indicates whether the transfer amount includes or doesn't include
            the fee.
    CryptoInstructions:
      type: object
      required:
        - address
        - identity_id
        - account_id
        - include_fee
        - network
      properties:
        address:
          type: string
          description: A wallet address (including prefix) to use for the crypto transfer.
          example: '0x4b6f5a3dfc911e992c3d8f38c6bb9d1563b5e9a5'
        fee_id:
          type: string
          format: uuid
          description: The ID of a pre-arranged fee guarantee to use with the transfer.
          example: ed671d2b-bb9e-4cf5-9eb4-71b6db672207
        identity_id:
          type: string
          format: uuid
          description: The identity ID of the institution submitting the transfer.
          example: b2a99c93-f1ee-41ed-9e9e-ec704cfbca4b
        account_id:
          type: string
          format: uuid
          description: The account ID of the institution submitting the transfer.
          example: ed671d2b-bb9e-4cf5-9eb4-71b6db672207
        includes_fee:
          type: boolean
          description: >-
            Indicates whether the transfer amount includes or doesn't include
            the fee.
        network:
          type: string
          enum:
            - BITCOIN
            - ETHEREUM
            - SOLANA
          description: The crypto network to perform the transfer on.
          example: SOLANA
    TransferNew:
      type: object
      required:
        - asset_id
        - client_id
        - amount
        - type
        - platform
      properties:
        asset_id:
          type: string
          example: '1234576970'
          description: Exchange assigned ID of asset.
        client_id:
          type: string
          example: '1234576970'
          description: Exchange assigned ID of client.
        amount:
          type: string
          example: '1000000.00'
          description: Amount of asset to transfer.
        type:
          type: string
          enum:
            - DEPOSIT
            - WITHDRAW
          example: WITHDRAW
          description: |
            Direction of the transfer.
            * **DEPOSIT** Place the amount specified on the exchange.
            * **WITHDRAW** Remove the amount specified from the exchange.
        platform:
          type: string
          enum:
            - FIAT
            - CRYPTO
          example: FIAT
          description: >
            The type of service to use for the transfer. Must match with the
            corresponding instructions defined below.

            * **FIAT** Indicates the transfer should use the traditional banking
            system used to handle the corresponding fiat currency. Note,
            performing a transfer with fiat on a stablecoin asset will result in
            an automatic conversion.

            * **CRYPTO** Indicates the transfer uses a blockchain platform.
        instructions:
          oneOf:
            - $ref: '#/components/schemas/FiatInstructions'
            - $ref: '#/components/schemas/CryptoInstructions'
          description: >
            Platform specific instructions. The defined object must match with
            the platform value.

            * **FiatInstructions** Must be used when setting the platform to
            `FIAT`

            * **CryptoInstructions** Must be used when setting the platform to
            `CRYPTO`
    Transfer:
      type: object
      properties:
        request:
          type: object
          $ref: '#/components/schemas/TransferNew'
    TransferDetails:
      type: object
      properties:
        id:
          type: string
          example: '1234576970'
        status:
          type: string
          enum:
            - INITIALIZED
            - PENDING
            - COMPLETED
            - FAILED
            - REJECTED
          example: INITIALIZED
        request:
          $ref: '#/components/schemas/TransferNew'
    HistoricalTransfer:
      type: object
      properties:
        id:
          type: string
          example: '1234576970'
        status:
          type: string
          enum:
            - INITIALIZED
            - PENDING
            - COMPLETED
            - FAILED
            - REJECTED
          example: INITIALIZED
        request:
          $ref: '#/components/schemas/TransferNew'
        timestamp:
          type: string
          format: int64
          description: Nanosecond timestamp of when the transfer was initiated.
          example: '1740740509058376312'
        updated_timestamp:
          type: string
          format: int64
          description: Nanosecond timestamp of the last update to the transfer.
          example: '1740740509058376312'
    OrderTrade:
      type: object
      properties:
        client_id:
          type: string
          description: A unique identifier assigned to the client.
          example: '1234576970'
        instrument_id:
          type: string
          description: A unique identifier for the trading instrument.
          example: '1234576970'
        order_id:
          type: string
          description: A unique identifier for the order.
          example: '1234576970'
        trade_price:
          type: string
          description: The price at which the trade was executed.
          example: '75000.50'
        trade_qty:
          type: string
          description: The quantity of the asset traded.
          example: '100.00'
        trade_fee_rate:
          type: string
          description: The fee rate applied to the trade.
          example: '0.0005'
        liq_flag:
          type: string
          description: Indicates whether the trade was executed as a taker or a maker.
          enum:
            - TAKER
            - MAKER
          example: TAKER
        match_id:
          type: string
          description: A unique identifier for the trade match event.
          example: '1234576970'
        timestamp:
          type: string
          description: The Unix UTC timestamp (in nanoseconds) when the trade was executed.
          example: '1740740509058376312'
    Problem:
      type: object
      required:
        - type
        - title
        - status
      properties:
        type:
          type: string
          format: uri
          description: A URI reference that identifies the problem type.
          example: about:blank
        title:
          type: string
          description: A short, human-readable summary of the problem type.
          example: An Error Occured
        status:
          type: integer
          format: int32
          description: The HTTP status code generated by the origin server.
        detail:
          type: string
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          example: A more detailed sentence about the error
        instance:
          type: string
          format: uri
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          example: /api/v1/endpoint
        extensions:
          type: object
          additionalProperties: true
          description: A map for extension members (custom fields not defined by the RFC).
  securitySchemes:
    HMAC:
      type: apiKey
      in: header
      name: x-api-key
      description: >
        Clients must compute and send an HMAC signature in
        `x-truex-auth-signature`. The HMAC signature gets applied to the
        following payload:


        `timestamp + method + path + body`



        Note, method is all upper case and path is everything after the domain
        name including the / (e.g. /api/v1/order).

        Additional headers:

        * `x-truex-auth-signature`: The signature generated from processing the
        payload with the HMAC key.

        * `x-truex-auth-token`: The ID of the HMAC key being used.

        * `x-truex-auth-timestamp`: Current time as seconds since epoch.

        * `x-truex-auth-user-id`: Client identifier.
  parameters:
    XAuthUserId:
      in: header
      name: x-truex-auth-userid
      required: true
      schema:
        type: string
      description: Client identifier.
    XAuthTimestamp:
      in: header
      name: x-truex-auth-timestamp
      required: true
      schema:
        type: string
      description: Timestamp when request was made in seconds since epoch.
    XAuthToken:
      in: header
      name: x-truex-auth-token
      required: true
      schema:
        type: string
      description: The UUID affiliated with the HMAC key.
    XAuthSignature:
      in: header
      name: x-truex-auth-signature
      required: true
      schema:
        type: string
      description: The computed HMAC signature.
