> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stabyl.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Estimate market order

> Estimates visible-depth execution, slippage, and an optional partner client spread for a market order. The result is non-binding and does not alter Stabyl execution or fees.



## OpenAPI

````yaml /openapi/openapi.json post /partner/exchange/orders/estimate
openapi: 3.1.0
info:
  title: Stabyl API
  description: >-
    REST API for approved Stabyl accounts to automate exchange, wallet, and
    non-production simulation workflows.
  contact:
    name: Stabyl Support
    email: support@stabyl.com
  license:
    name: Proprietary
  version: 1.0.0
servers:
  - url: https://api.stabyl.com/v1
    description: Production
  - url: https://api-staging.stabyl.com/v1
    description: Staging
security: []
tags:
  - name: Exchange
    description: Trading market data and order management for account automation.
  - name: Wallets
    description: >-
      Supported routes, deposit destinations, balances, transactions, and saved
      recipients.
  - name: Webhooks
    description: >-
      Outbound event delivery configuration and eventually consistent delivery
      history. Verify Standard Webhooks webhook-id, webhook-timestamp, and
      webhook-signature headers against the unchanged raw request body before
      parsing JSON.
  - name: Simulation
    description: Non-production endpoints for testing integration behavior.
paths:
  /partner/exchange/orders/estimate:
    post:
      tags:
        - Exchange
      summary: Estimate market order
      description: >-
        Estimates visible-depth execution, slippage, and an optional partner
        client spread for a market order. The result is non-binding and does not
        alter Stabyl execution or fees.
      operationId: post_partner_exchange_orders_estimate
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MarketOrderEstimateRequest'
        required: true
      responses:
        '200':
          description: Market-order estimate
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/MarketOrderEstimateResponse'
                  status:
                    type: string
                    enum:
                      - success
              example:
                data: {}
                status: success
        '400':
          description: Invalid side, quantity, spread, or unavailable liquidity
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: VALIDATION_FAILED
                      message:
                        type: string
                        example: invalid request parameters
                  status:
                    type: string
                    enum:
                      - error
              example:
                error:
                  code: VALIDATION_FAILED
                  message: invalid request parameters
                status: error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: UNAUTHORIZED
                      message:
                        type: string
                        example: missing X-Api-Key header
                  status:
                    type: string
                    enum:
                      - error
              example:
                error:
                  code: UNAUTHORIZED
                  message: missing X-Api-Key header
                status: error
      security:
        - api_key: []
components:
  schemas:
    MarketOrderEstimateRequest:
      type: object
      description: Request for a non-binding market-order execution estimate.
      required:
        - pair_id
        - side
        - quantity
      properties:
        business_bps:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            Optional partner spread applied to the estimated execution price for
            a client quote.

            This does not alter Stabyl execution or fees.
          example: 25
          maximum: 10000
          minimum: 0
        pair_id:
          type: string
          description: Trading pair identifier.
          example: USD/NGN
        quantity:
          type: string
          description: Quantity in base currency.
          example: '100.00'
        side:
          type: string
          description: 'Order side: "buy" consumes asks and "sell" consumes bids.'
          example: buy
    MarketOrderEstimateResponse:
      type: object
      description: Non-binding market-order execution and partner-quote estimate.
      required:
        - pair_id
        - side
        - quantity
        - estimated_fill_quantity
        - sufficient_liquidity
        - reference_price
        - estimated_average_price
        - estimated_slippage_bps
        - business_bps
        - client_quote_price
        - estimated_notional
        - client_quote_notional
        - orderbook_sequence
        - estimated_at
      properties:
        business_bps:
          type: integer
          format: int32
          description: Partner-supplied spread used to calculate `client_quote_price`.
          minimum: 0
        client_quote_notional:
          type: string
          description: Client-facing notional after applying `business_bps`.
        client_quote_price:
          type: string
          description: >-
            Average price with the partner spread applied (buy: add; sell:
            subtract).
        estimated_at:
          type: string
          description: Timestamp of the source order-book snapshot.
        estimated_average_price:
          type: string
          description: Quantity-weighted average execution price across visible levels.
        estimated_fill_quantity:
          type: string
          description: Quantity covered by the currently visible order-book depth.
        estimated_notional:
          type: string
          description: Estimated Stabyl execution notional for the covered quantity.
        estimated_slippage_bps:
          type: integer
          format: int32
          description: Estimated adverse movement from the best price, in basis points.
          minimum: 0
        orderbook_sequence:
          type: integer
          format: int64
          description: Order-book sequence used for the estimate.
          minimum: 0
        pair_id:
          type: string
        quantity:
          type: string
          description: Requested base quantity.
        reference_price:
          type: string
          description: Current best price on the consumed side of the book.
        side:
          type: string
        sufficient_liquidity:
          type: boolean
          description: Whether visible depth covers the entire request.
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        API credential. Withdrawal quote and submit operations additionally
        require the documented Ed25519 timestamp, nonce, and signature headers.
      x-default: sb_test_your_key

````