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

# Preview Order

> Preview an order.



## OpenAPI

````yaml POST /api/v3/brokerage/orders/preview
openapi: 3.0.0
info:
  title: Coinbase Advanced Trade API
  version: '0.1'
servers:
  - url: https://api.coinbase.com
security:
  - apiKeyAuth: []
paths:
  /api/v3/brokerage/orders/preview:
    post:
      tags:
        - Orders
      summary: Preview Order
      description: Preview an order.
      operationId: RetailBrokerageApi_PreviewOrder
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderPreviewRequest
        required: true
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderPreviewResponse
            text/event-stream:
              schema:
                $ref: >-
                  #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderPreviewResponse
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/grpc.gateway.runtime.Error'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/grpc.gateway.runtime.Error'
components:
  schemas:
    coinbase.public_api.authed.retail_brokerage_api.OrderPreviewRequest:
      type: object
      properties:
        product_id:
          type: string
          description: The trading pair (e.g. 'BTC-USD').
          required:
            - product_id
        side:
          description: The side of the market that the order is on (e.g. 'BUY', 'SELL').
          required:
            - side
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderSide
        order_configuration:
          description: The configuration of the order (e.g. the order type, size, etc).
          required:
            - order_configuration
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration
        leverage:
          type: string
          example: '2.0'
          description: The amount of leverage for the order (default is 1.0).
        margin_type:
          description: Margin Type for this order (default is CROSS).
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MarginType
        retail_portfolio_id:
          type: string
          example: 11111111-1111-1111-1111-111111111111
          description: >-
            **(Deprecated)** The ID of the portfolio to associate the order
            with. Only applicable for legacy keys. CDP keys will default to the
            key's permissioned portfolio.
        attached_order_configuration:
          description: >-
            The configuration of the attached order. Only TriggerBracketGtc is
            eligible. Size field must be omitted as the size of the attached
            order is the same as that of the parent order.
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration
        prediction_metadata:
          description: Request metadata specific to prediction market orders (YES/NO).
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PredictionRequestMetadata
        cost_basis_method:
          description: The method used to calculate the cost basis for the order.
          allOf:
            - $ref: '#/components/schemas/coinbase.positions.CostBasisMethod'
      title: OrderPreview
      required:
        - product_id
        - side
        - commission_rate
        - order_configuration
    coinbase.public_api.authed.retail_brokerage_api.OrderPreviewResponse:
      type: object
      properties:
        order_total:
          type: string
          required:
            - order_total
        commission_total:
          type: string
          description: >-
            Currency amount of the applied commission (so not the rate that was
            used on input)
          required:
            - commission_total
        errs:
          type: array
          items:
            $ref: >-
              #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PreviewFailureReason
          description: List of potential failure reasons were this order to be submitted
          required:
            - errs
        warning:
          type: array
          items:
            $ref: >-
              #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PreviewWarningMsg
          required:
            - warning
        quote_size:
          type: string
          example: 10
          description: >-
            The amount of the second Asset in the Trading Pair. For example, on
            the BTC/USD Order Book, USD is the Quote Asset.
          required:
            - quote_size
        base_size:
          type: string
          example: 0.001
          description: >-
            The amount of the first Asset in the Trading Pair. For example, on
            the BTC-USD Order Book, BTC is the Base Asset.
          required:
            - base_size
        best_bid:
          type: string
          required:
            - best_bid
        best_ask:
          type: string
          required:
            - best_ask
        is_max:
          type: boolean
          description: >-
            Indicates whether tradable_balance should be set to the maximum
            amount.
          required:
            - is_max
        order_margin_total:
          type: string
        leverage:
          type: string
          example: '2.0'
          description: The amount of leverage for the order (default is 1.0).
        long_leverage:
          type: string
        short_leverage:
          type: string
        slippage:
          type: string
        preview_id:
          type: string
        current_liquidation_buffer:
          type: string
        projected_liquidation_buffer:
          type: string
        max_leverage:
          type: string
        pnl_configuration:
          description: >-
            Expected PNL of an order. This value is an estimate and does not
            take into account fees and slippage.
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PnlConfiguration
        twap_bucket_metadata:
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TwapBucketMetadata
        position_notional_limit:
          type: string
        max_notional_at_requested_leverage:
          type: string
        margin_ratio_data:
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MarginRatioData
        commission_detail_total:
          description: Breakdown of commission charges for the order
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CommissionDetailTotal
        scaled_metadata:
          description: Metadata for scaled orders containing the order distribution
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ScaledOrderMetadata
        compliance_limit_data:
          description: Optional compliance limit data
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ComplianceLimitData
        est_average_filled_price:
          type: string
          description: Estimated fill price for order.
        prediction_order_metadata:
          description: Metadata specific to prediction market orders.
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PredictionOrderMetadata
        predicted_liquidation_price:
          type: string
          description: Predicted liquidation price for FCM orders.
      required:
        - order_total
        - commission_total
        - errs
        - warning
        - quote_size
        - base_size
        - best_bid
        - best_ask
        - is_max
    grpc.gateway.runtime.Error:
      type: object
      properties:
        error:
          type: string
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/google.protobuf.Any'
    coinbase.public_api.authed.retail_brokerage_api.OrderSide:
      type: string
      enum:
        - BUY
        - SELL
      default: ''
    coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration:
      type: object
      properties:
        market_market_ioc:
          description: >-
            Buy or sell a specified quantity of an Asset at the current best
            available market price. [Read more on Market
            Orders](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#market-order) 
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MarketMarketIoc
        market_market_fok:
          description: >-
            Buy or sell a specified quantity of an Asset at the current best
            available market price. The Order will only post to the Order Book
            if it is to immediately and completely Fill. [Read more on Market
            Orders](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#market-order)
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MarketMarketFok
        sor_limit_ioc:
          description: >-
            Buy or sell a specified quantity of an Asset at a specified price.
            The Order will only post to the Order Book if it will immediately
            Fill; any remaining quantity is canceled. [Read more on Limit
            Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#limit-order)
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.SorLimitIoc
        limit_limit_gtc:
          description: >-
            Buy or sell a specified quantity of an Asset at a specified price.
            If posted, the Order will remain on the Order Book until canceled.
            [Read more on Limit
            Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#limit-order)
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.LimitLimitGtc
        limit_limit_gtd:
          description: >-
            Buy or sell a specified quantity of an Asset at a specified price.
            If posted, the Order will remain on the Order Book until a certain
            time is reached or the Order is canceled. [Read more on Limit
            Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#limit-order)
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.LimitLimitGtd
        limit_limit_fok:
          description: >-
            Buy or sell a specified quantity of an Asset at a specified price.
            The Order will only post to the Order Book if it is to immediately
            and completely Fill. [Read more on Limit
            Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#limit-order)
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.LimitLimitFok
        twap_limit_gtd:
          description: >-
            A time-weighted average price (TWAP) order type that calculates the
            average price of a product to programmatically execute an order over
            a specified duration.
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TwapLimitGtd
        stop_limit_stop_limit_gtc:
          description: >-
            Posts an Order to buy or sell a specified quantity of an Asset, but
            only if and when the last trade price on the Order Book equals or
            surpasses the Stop Price. If posted, the Order will remain on the
            Order Book until canceled. [Read more on Stop-Limit
            Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#stop-limit-order)
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.StopLimitStopLimitGtc
        stop_limit_stop_limit_gtd:
          description: >-
            Posts an Order to buy or sell a specified quantity of an Asset, but
            only if and when the last trade price on the Order Book equals or
            surpasses the Stop Price. If posted, the Order will remain on the
            Order Book until a certain time is reached or the Order.  [Read more
            on Stop-Limit
            Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#stop-limit-order)
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.StopLimitStopLimitGtd
        trigger_bracket_gtc:
          description: >-
            A Limit Order to buy or sell a specified quantity of an Asset at a
            specified price, with stop limit order parameters embedded in the
            order. If posted, the Order will remain on the Order Book until
            canceled. [Read more on Bracket
            Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#bracket-order)
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TriggerBracketGtc
        trigger_bracket_gtd:
          description: >-
            A Limit Order to buy or sell a specified quantity of an Asset at a
            specified price, with stop limit order parameters embedded in the
            order. If posted, the Order will remain on the Order Book until a
            certain time is reached or the Order is canceled. [Read more on
            Bracket
            Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#bracket-order)
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TriggerBracketGtd
        scaled_limit_gtc:
          description: >-
            A scaled order enables users to divide a large order into multiple
            smaller limit orders, which are placed incrementally across a
            user-defined price range. [Read more on Limit
            Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#limit-order)
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ScaledLimitGtc
    coinbase.public_api.authed.retail_brokerage_api.MarginType:
      type: string
      enum:
        - CROSS
        - ISOLATED
      default: ''
      description: >-
        - CROSS: Cross margin applies margin to the position of the entire
        portfolio
         - ISOLATED: Isolated margin applies margin to a single position
      title: >-
        MarginType reflects the margin type of an order, used for Intx Perps
        trades
    coinbase.public_api.authed.retail_brokerage_api.PredictionRequestMetadata:
      type: object
      properties:
        prediction_side:
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PredictionSide
        preview_order_est_average_filled_price:
          type: string
        supports_fractional_base_size:
          type: boolean
      description: Request metadata specific to prediction market orders.
    coinbase.positions.CostBasisMethod:
      type: string
      enum:
        - COST_BASIS_METHOD_UNSPECIFIED
        - COST_BASIS_METHOD_HIFO
        - COST_BASIS_METHOD_LIFO
        - COST_BASIS_METHOD_FIFO
      default: COST_BASIS_METHOD_UNSPECIFIED
      description: CostBasisMethod specifies the cost basis method for tax lot matching.
    coinbase.public_api.authed.retail_brokerage_api.PreviewFailureReason:
      type: string
      enum:
        - UNKNOWN_PREVIEW_FAILURE_REASON
        - PREVIEW_MISSING_COMMISSION_RATE
        - PREVIEW_INVALID_SIDE
        - PREVIEW_INVALID_ORDER_CONFIG
        - PREVIEW_INVALID_PRODUCT_ID
        - PREVIEW_INVALID_SIZE_PRECISION
        - PREVIEW_INVALID_PRICE_PRECISION
        - PREVIEW_MISSING_PRODUCT_PRICE_BOOK
        - PREVIEW_INVALID_LEDGER_BALANCE
        - PREVIEW_INSUFFICIENT_LEDGER_BALANCE
        - PREVIEW_INVALID_LIMIT_PRICE_POST_ONLY
        - PREVIEW_INVALID_LIMIT_PRICE
        - PREVIEW_INVALID_NO_LIQUIDITY
        - PREVIEW_INSUFFICIENT_FUND
        - PREVIEW_INVALID_COMMISSION_CONFIGURATION
        - PREVIEW_INVALID_STOP_PRICE
        - PREVIEW_INVALID_BASE_SIZE_TOO_LARGE
        - PREVIEW_INVALID_BASE_SIZE_TOO_SMALL
        - PREVIEW_INVALID_QUOTE_SIZE_PRECISION
        - PREVIEW_INVALID_QUOTE_SIZE_TOO_LARGE
        - PREVIEW_INVALID_PRICE_TOO_LARGE
        - PREVIEW_INVALID_QUOTE_SIZE_TOO_SMALL
        - PREVIEW_INSUFFICIENT_FUNDS_FOR_FUTURES
        - PREVIEW_BREACHED_PRICE_LIMIT
        - PREVIEW_BREACHED_ACCOUNT_POSITION_LIMIT
        - PREVIEW_BREACHED_COMPANY_POSITION_LIMIT
        - PREVIEW_INVALID_MARGIN_HEALTH
        - PREVIEW_RISK_PROXY_FAILURE
        - PREVIEW_UNTRADABLE_FCM_ACCOUNT_STATUS
        - PREVIEW_IN_LIQUIDATION
        - PREVIEW_INVALID_MARGIN_TYPE
        - PREVIEW_INVALID_LEVERAGE
        - PREVIEW_UNTRADABLE_PRODUCT
        - PREVIEW_INVALID_FCM_TRADING_SESSION
        - PREVIEW_NOT_ALLOWED_BY_MARKET_STATE
        - PREVIEW_BREACHED_OPEN_INTEREST_LIMIT
        - PREVIEW_GEOFENCING_RESTRICTION
        - PREVIEW_INVALID_END_TIME
        - PREVIEW_OPPOSITE_MARGIN_TYPE_EXISTS
        - PREVIEW_QUOTE_SIZE_NOT_ALLOWED_FOR_BRACKET
        - PREVIEW_INVALID_BRACKET_PRICES
        - PREVIEW_MISSING_MARKET_TRADE_DATA
        - PREVIEW_INVALID_BRACKET_LIMIT_PRICE
        - PREVIEW_INVALID_BRACKET_STOP_TRIGGER_PRICE
        - PREVIEW_BRACKET_LIMIT_PRICE_OUT_OF_BOUNDS
        - PREVIEW_STOP_TRIGGER_PRICE_OUT_OF_BOUNDS
        - PREVIEW_BRACKET_ORDER_NOT_SUPPORTED
        - PREVIEW_INVALID_STOP_PRICE_PRECISION
        - PREVIEW_STOP_PRICE_ABOVE_LIMIT_PRICE
        - PREVIEW_STOP_PRICE_BELOW_LIMIT_PRICE
        - PREVIEW_STOP_PRICE_ABOVE_LAST_TRADE_PRICE
        - PREVIEW_STOP_PRICE_BELOW_LAST_TRADE_PRICE
        - PREVIEW_FOK_DISABLED
        - PREVIEW_FOK_ONLY_ALLOWED_ON_LIMIT_ORDERS
        - PREVIEW_POST_ONLY_NOT_ALLOWED_WITH_FOK
        - PREVIEW_UBO_HIGH_LEVERAGE_QUANTITY_BREACHED
        - PREVIEW_ECOSYSTEM_LEVERAGE_UTILIZATION_BREACHED
        - PREVIEW_CLOSE_ONLY_FAILURE
        - PREVIEW_UBO_HIGH_LEVERAGE_NOTIONAL_BREACHED
        - PREVIEW_END_TIME_TOO_FAR_IN_FUTURE
        - PREVIEW_LIMIT_PRICE_TOO_FAR_FROM_MARKET
        - PREVIEW_FUTURES_AFTER_HOUR_INVALID_ORDER_TYPE
        - PREVIEW_FUTURES_AFTER_HOUR_INVALID_TIME_IN_FORCE
        - PREVIEW_INVALID_ATTACHED_TAKE_PROFIT_PRICE
        - PREVIEW_INVALID_ATTACHED_STOP_LOSS_PRICE
        - PREVIEW_INVALID_ATTACHED_TAKE_PROFIT_PRICE_PRECISION
        - PREVIEW_INVALID_ATTACHED_STOP_LOSS_PRICE_PRECISION
        - PREVIEW_INVALID_ATTACHED_TAKE_PROFIT_PRICE_OUT_OF_BOUNDS
        - PREVIEW_INVALID_ATTACHED_STOP_LOSS_PRICE_OUT_OF_BOUNDS
        - PREVIEW_INVALID_BRACKET_ORDER_SIDE
        - PREVIEW_BRACKET_ORDER_SIZE_EXCEEDS_POSITION
        - PREVIEW_ORDER_SIZE_EXCEEDS_BRACKETED_POSITION
        - PREVIEW_INVALID_LIMIT_PRICE_PRECISION
        - PREVIEW_INVALID_STOP_TRIGGER_PRICE_PRECISION
        - >-
          PREVIEW_INVALID_ATTACHED_TAKE_PROFIT_PRICE_EXCEEDS_MAX_DISTANCE_FROM_ORIGINATING_PRICE
        - PREVIEW_INVALID_ATTACHED_TAKE_PROFIT_SIZE_BELOW_MIN
        - PREVIEW_ATTACHED_ORDER_SIZE_MUST_BE_NIL
        - PREVIEW_BELOW_MIN_SIZE_FOR_DURATION
        - PREVIEW_MAX_DAILY_VOLUME_NOTIONAL_BREACHED
        - PREVIEW_INVALID_SETTLEMENT_CURRENCY
        - PREVIEW_DURATION_TOO_SMALL
        - PREVIEW_INTX_FOK_ONLY_ALLOWED_ON_LIMIT_AND_MARKET_ORDERS
        - PREVIEW_BUCKET_SIZE_SMALLER_THAN_QUOTE_MIN
        - PREVIEW_BUCKET_SIZE_SMALLER_THAN_BASE_MIN
        - PREVIEW_END_TIME_AFTER_CONTRACT_EXPIRATION
        - PREVIEW_START_TIME_MUST_BE_SPECIFIED
        - PREVIEW_ICEBERG_ORDERS_NOT_SUPPORTED
        - PREVIEW_END_TIME_IS_IN_THE_PAST
        - PREVIEW_GTD_ORDERS_MUST_HAVE_END_TIME
        - PREVIEW_ATTACHED_ORDER_MUST_HAVE_POSITIVE_PRICES
        - PREVIEW_INVALID_ORDER_SIDE_FOR_ATTACHED_TPSL
        - PREVIEW_ATTACHED_ORDERS_ONLY_ALLOWED_ON_MARKET_LIMIT
        - PREVIEW_INVALID_ORDER_TYPE_FOR_ATTACHED
        - PREVIEW_PRICE_NOT_ALLOWED_FOR_MARKET_ORDERS
        - PREVIEW_REDUCE_ONLY_NOT_ALLOWED_ON_VENUE
        - PREVIEW_NON_NUMERIC_ORDER_SIZE
        - PREVIEW_INVALID_INTX_CLIENT_ORDER_ID
        - PREVIEW_DURATION_TOO_LARGE
        - PREVIEW_REDUCE_ONLY_NOT_ALLOWED_ON_SPOT_PRODUCTS
        - PREVIEW_LIMIT_ORDER_PRICE_EXCEEDS_PRICE_BAND_ON_BUY
        - PREVIEW_LIMIT_ORDER_PRICE_EXCEEDS_PRICE_BAND_ON_SELL
        - >-
          PREVIEW_INVALID_ATTACHED_TAKE_PROFIT_PRICE_OUT_OF_BOUNDS_ON_AGGRESSIVE_ORDER
        - >-
          PREVIEW_INVALID_ATTACHED_STOP_LOSS_PRICE_OUT_OF_BOUNDS_ON_AGGRESSIVE_ORDER
        - PREVIEW_STOP_TRIGGERED
        - PREVIEW_REPLACE_NOT_SUPPORTED
        - PREVIEW_ORDER_IS_PENDING_CANCEL
        - PREVIEW_POSITION_SIZE_INCREASE_REJECT
        - PREVIEW_ASSET_BALANCE_INCREASE_REJECT
        - PREVIEW_TOO_MANY_PENDING_REPLACES
        - PREVIEW_INVALID_RFQ_BASE_SIZE_TOO_SMALL
        - PREVIEW_INVALID_RFQ_BASE_SIZE_TOO_LARGE
        - PREVIEW_INVALID_RFQ_QUOTE_SIZE_TOO_SMALL
        - PREVIEW_INVALID_RFQ_QUOTE_SIZE_TOO_LARGE
        - PREVIEW_REDUCE_ONLY_INCREASED_POSITION_SIZE
        - PREVIEW_COMPLIANCE_PURCHASE_LIMIT_EXCEEDED
        - PREVIEW_SCALED_PARAM_INFEASIBLE
        - PREVIEW_SCALED_MIN_ORDER_VIOLATION
        - PREVIEW_SCALED_MAX_ORDER_VIOLATION
        - PREVIEW_POST_ONLY_NOT_ALLOWED_WITH_PEG
        - PREVIEW_INVALID_PEG_OFFSET
        - PREVIEW_INVALID_PEG_WIG_LEVEL
        - PREVIEW_INVALID_PEG_VENUE_OPTIONS
        - PREVIEW_PEG_INVALID_ORDER_TYPE
        - PREVIEW_SINGLE_LEGGED_TPSL_NOT_ALLOWED
        - PREVIEW_FRACTIONAL_ORDERS_NOT_ALLOWED_FOR_PRODUCT
        - PREVIEW_QUOTE_ORDERS_NOT_ALLOWED_FOR_PRODUCT
        - PREVIEW_NBBO_NOT_PROVIDED
        - PREVIEW_INVALID_NBBO_BID_PRICE
        - PREVIEW_INVALID_NBBO_ASK_PRICE
        - PREVIEW_NOTIONAL_SIZE_BREACHES_FRACTIONAL_MINIMUM
        - PREVIEW_MARKET_ORDERS_PROHIBITED_DURING_NON_CORE_SESSION
        - PREVIEW_NOTIONAL_ORDERS_PROHIBITED_DURING_NON_CORE_SESSION
        - PREVIEW_MAX_NOTIONAL_PER_ORDER_BREACHED_15C35_CHECK
        - PREVIEW_MAX_SHARES_PER_ORDER_BREACHED_15C35_CHECK
        - PREVIEW_INVALID_EQUITY_TRADING_SESSION
        - PREVIEW_PRODUCT_TRADING_HALTED
        - PREVIEW_TRADING_DISABLED
        - PREVIEW_INVALID_BRACKET_LIMIT_PRICE_PRECISION
        - PREVIEW_SCALED_PARAM_DISCREPANCY
        - PREVIEW_STOP_LOSS_PRICE_TOO_LOW
        - PREVIEW_PREDICTIONS_QUOTE_SIZE_BELOW_MIN_CONTRACT_PRICE
        - PREVIEW_PREDICTIONS_HIGH_PRICE_CONTRACTS_BLOCKED
        - PREVIEW_ATTACHED_STOP_LOSS_PRICE_TOO_LOW
        - PREVIEW_BREACHED_RISK_LIMIT
        - PREVIEW_STOP_LOSS_PRICE_TOO_HIGH
        - PREVIEW_ATTACHED_STOP_LOSS_PRICE_TOO_HIGH
        - PREVIEW_TAKE_PROFIT_PRICE_TOO_HIGH
        - PREVIEW_ATTACHED_TAKE_PROFIT_PRICE_TOO_HIGH
        - PREVIEW_TAKE_PROFIT_PRICE_TOO_LOW
        - PREVIEW_ATTACHED_TAKE_PROFIT_PRICE_TOO_LOW
      default: UNKNOWN_PREVIEW_FAILURE_REASON
    coinbase.public_api.authed.retail_brokerage_api.PreviewWarningMsg:
      type: string
      enum:
        - UNKNOWN
        - BIG_ORDER
        - SMALL_ORDER
        - DURATION_EXTENDED_BY_MARKET_CLOSE
        - OPEN_ORDERS_EXCEED_COMPLIANCE_PURCHASE_LIMIT_MAY_CANCEL
      default: UNKNOWN
    coinbase.public_api.authed.retail_brokerage_api.PnlConfiguration:
      type: object
      properties:
        trigger_bracket_pnl:
          description: PNL configuration for a bracket order.
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TriggerBracketPnl
    coinbase.public_api.authed.retail_brokerage_api.TwapBucketMetadata:
      type: object
      properties:
        bucket_duration:
          type: string
        bucket_size:
          type: string
        number_buckets:
          type: string
        start_time:
          type: string
          format: RFC3339 Timestamp
        end_time:
          type: string
          format: RFC3339 Timestamp
      title: >-
        Twap bucket metadata - size/duration of each suborder into which twap is
        broken into
    coinbase.public_api.authed.retail_brokerage_api.MarginRatioData:
      type: object
      properties:
        current_margin_ratio:
          type: string
        projected_margin_ratio:
          type: string
      title: >-
        New margin ratio fields replacing current_liquidation_buffer and
        projected_liquidation_buffer
    coinbase.public_api.authed.retail_brokerage_api.CommissionDetailTotal:
      type: object
      properties:
        total_commission:
          type: string
          title: |-
            Total commission amount charged for the order
            This is the sum of all commission charged on the order
        gst_commission:
          type: string
          title: Goods and Services Tax (GST) portion of the commission
        withholding_commission:
          type: string
          title: Tax withholding portion of the commission
        client_commission:
          type: string
          title: Client commission on the trade
        venue_commission:
          type: string
          title: Venue Commission
        regulatory_commission:
          type: string
          title: Regulatory Commission
        clearing_commission:
          type: string
          title: Clearing Commission
      title: >-
        CommissionDetailTotal contains the breakdown of commission charges for
        an order
    coinbase.public_api.authed.retail_brokerage_api.ScaledOrderMetadata:
      type: object
      properties:
        scaled_order_distribution:
          type: array
          items:
            $ref: >-
              #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ScaledOrderDistribution
      title: a list of scaled order distributions
    coinbase.public_api.authed.retail_brokerage_api.ComplianceLimitData:
      type: object
      properties:
        total_limit:
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount
        remaining_limits:
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount
      title: Compliance Limit service data
    coinbase.public_api.authed.retail_brokerage_api.PredictionOrderMetadata:
      type: object
      properties:
        contract_subtotal:
          type: string
          description: >-
            The base contract value from user's perspective, adjusted for
            prediction market direction.
        user_net_total:
          type: string
          description: >-
            The net amount user pays (for buys) or receives (for sells),
            accounting for prediction market direction and fees.
        slippage_percentage:
          type: string
          description: Slippage tolerance percentage based on price tier.
        minimum_contracts:
          type: string
          description: >-
            Minimum contracts the user will receive after slippage. Populated
            for BUY orders with quote_size.
        minimum_total:
          description: >-
            Minimum USD the user will receive after slippage. Populated for SELL
            orders with base_size.
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount
        maximum_total:
          description: >-
            Maximum USD the user will pay after slippage. Populated for BUY
            orders with base_size.
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount
        maximum_contracts:
          type: string
          description: >-
            Maximum contracts the user will sell after slippage. Populated for
            SELL orders with quote_size.
      title: Prediction market-specific metadata for the order preview response
    google.protobuf.Any:
      type: object
      properties:
        type_url:
          type: string
          description: >-
            A URL/resource name that uniquely identifies the type of the
            serialized

            protocol buffer message. This string must contain at least

            one "/" character. The last segment of the URL's path must represent

            the fully qualified name of the type (as in

            `path/google.protobuf.Duration`). The name should be in a canonical
            form

            (e.g., leading "." is not accepted).


            In practice, teams usually precompile into the binary all types that
            they

            expect it to use in the context of Any. However, for URLs which use
            the

            scheme `http`, `https`, or no scheme, one can optionally set up a
            type

            server that maps type URLs to message definitions as follows:


            * If no scheme is provided, `https` is assumed.

            * An HTTP GET on the URL must yield a [google.protobuf.Type][]
              value in binary format, or produce an error.
            * Applications are allowed to cache lookup results based on the
              URL, or have them precompiled into a binary to avoid any
              lookup. Therefore, binary compatibility needs to be preserved
              on changes to types. (Use versioned type names to manage
              breaking changes.)

            Note: this functionality is not currently available in the official

            protobuf release, and it is not used for type URLs beginning with

            type.googleapis.com. As of May 2023, there are no widely used type
            server

            implementations and no plans to implement one.


            Schemes other than `http`, `https` (or the empty scheme) might be

            used with implementation specific semantics.
        value:
          type: string
          format: byte
          description: >-
            Must be a valid serialized protocol buffer of the above specified
            type.
      description: >-
        `Any` contains an arbitrary serialized protocol buffer message along
        with a

        URL that describes the type of the serialized message.


        Protobuf library provides support to pack/unpack Any values in the form

        of utility functions or additional generated methods of the Any type.


        Example 1: Pack and unpack a message in C++.

            Foo foo = ...;
            Any any;
            any.PackFrom(foo);
            ...
            if (any.UnpackTo(&foo)) {
              ...
            }

        Example 2: Pack and unpack a message in Java.

            Foo foo = ...;
            Any any = Any.pack(foo);
            ...
            if (any.is(Foo.class)) {
              foo = any.unpack(Foo.class);
            }
            // or ...
            if (any.isSameTypeAs(Foo.getDefaultInstance())) {
              foo = any.unpack(Foo.getDefaultInstance());
            }

         Example 3: Pack and unpack a message in Python.

            foo = Foo(...)
            any = Any()
            any.Pack(foo)
            ...
            if any.Is(Foo.DESCRIPTOR):
              any.Unpack(foo)
              ...

         Example 4: Pack and unpack a message in Go

             foo := &pb.Foo{...}
             any, err := anypb.New(foo)
             if err != nil {
               ...
             }
             ...
             foo := &pb.Foo{}
             if err := any.UnmarshalTo(foo); err != nil {
               ...
             }

        The pack methods provided by protobuf library will by default use

        'type.googleapis.com/full.type.name' as the type URL and the unpack

        methods only use the fully qualified type name after the last '/'

        in the type URL, for example "foo.bar.com/x/y.z" will yield type

        name "y.z".


        JSON

        ====

        The JSON representation of an `Any` value uses the regular

        representation of the deserialized, embedded message, with an

        additional field `@type` which contains the type URL. Example:

            package google.profile;
            message Person {
              string first_name = 1;
              string last_name = 2;
            }

            {
              "@type": "type.googleapis.com/google.profile.Person",
              "firstName": <string>,
              "lastName": <string>
            }

        If the embedded message type is well-known and has a custom JSON

        representation, that representation will be embedded adding a field

        `value` which holds the custom JSON in addition to the `@type`

        field. Example (for message [google.protobuf.Duration][]):

            {
              "@type": "type.googleapis.com/google.protobuf.Duration",
              "value": "1.212s"
            }
    coinbase.public_api.authed.retail_brokerage_api.MarketMarketIoc:
      type: object
      properties:
        quote_size:
          type: string
          example: '10.00'
          description: >-
            The amount of the second Asset in the Trading Pair. For example, on
            the BTC/USD Order Book, USD is the Quote Asset.
        base_size:
          type: string
          example: '0.001'
          description: >-
            The amount of the first Asset in the Trading Pair. For example, on
            the BTC-USD Order Book, BTC is the Base Asset.
        rfq_disabled:
          type: boolean
          description: >-
            If true, or if the user is a non-EU region user, this order will be
            attempted to be routed to the exchange CLOB.
      title: Order entry configurations
    coinbase.public_api.authed.retail_brokerage_api.MarketMarketFok:
      type: object
      properties:
        quote_size:
          type: string
          example: '10.00'
          description: >-
            The amount of the second Asset in the Trading Pair. For example, on
            the BTC/USD Order Book, USD is the Quote Asset.
        base_size:
          type: string
          example: '0.001'
          description: >-
            The amount of the first Asset in the Trading Pair. For example, on
            the BTC-USD Order Book, BTC is the Base Asset.
        rfq_disabled:
          type: boolean
          description: >-
            If true, or if the user is a non-EU region user, this order will be
            attempted to be routed to the exchange CLOB.
    coinbase.public_api.authed.retail_brokerage_api.SorLimitIoc:
      type: object
      properties:
        quote_size:
          type: string
          example: '10.00'
          description: >-
            The amount of the second Asset in the Trading Pair. For example, on
            the BTC/USD Order Book, USD is the Quote Asset.
        base_size:
          type: string
          example: '0.001'
          description: >-
            The amount of the first Asset in the Trading Pair. For example, on
            the BTC-USD Order Book, BTC is the Base Asset.
        limit_price:
          type: string
          example: '10000.00'
          description: >-
            The specified price, or better, that the Order should be executed
            at. A Buy Order will execute at or lower than the limit price. A
            Sell Order will execute at or higher than the limit price.
        rfq_disabled:
          type: boolean
          description: >-
            If true, or if the user is a non-EU region user, this order will be
            attempted to be routed to the exchange CLOB.
    coinbase.public_api.authed.retail_brokerage_api.LimitLimitGtc:
      type: object
      properties:
        quote_size:
          type: string
          example: '10.00'
          description: >-
            The amount of the second Asset in the Trading Pair. For example, on
            the BTC/USD Order Book, USD is the Quote Asset.
        base_size:
          type: string
          example: '0.001'
          description: >-
            The amount of the first Asset in the Trading Pair. For example, on
            the BTC-USD Order Book, BTC is the Base Asset.
        limit_price:
          type: string
          example: '10000.00'
          description: >-
            The specified price, or better, that the Order should be executed
            at. A Buy Order will execute at or lower than the limit price. A
            Sell Order will execute at or higher than the limit price.
        post_only:
          type: boolean
          example: false
          description: >-
            Enable or disable Post-only Mode. When enabled, only Maker Orders
            will be posted to the Order Book. Orders that will be posted as a
            Taker Order will be rejected.
        rfq_disabled:
          type: boolean
          description: >-
            If true, or if the user is a non-EU region user, this order will be
            attempted to be routed to the exchange CLOB.
    coinbase.public_api.authed.retail_brokerage_api.LimitLimitGtd:
      type: object
      properties:
        quote_size:
          type: string
          example: '10.00'
          description: >-
            The amount of the second Asset in the Trading Pair. For example, on
            the BTC/USD Order Book, USD is the Quote Asset.
        base_size:
          type: string
          example: '0.001'
          description: >-
            The amount of the first Asset in the Trading Pair. For example, on
            the BTC-USD Order Book, BTC is the Base Asset.
        limit_price:
          type: string
          example: '10000.00'
          description: >-
            The specified price, or better, that the Order should be executed
            at. A Buy Order will execute at or lower than the limit price. A
            Sell Order will execute at or higher than the limit price.
        end_time:
          type: string
          format: RFC3339 Timestamp
          example: '2021-05-31T09:59:59.000Z'
          description: The time at which the order will be cancelled if it is not Filled.
        post_only:
          type: boolean
          example: false
          description: >-
            Enable or disable Post-only Mode. When enabled, only Maker Orders
            will be posted to the Order Book. Orders that will be posted as a
            Taker Order will be rejected.
    coinbase.public_api.authed.retail_brokerage_api.LimitLimitFok:
      type: object
      properties:
        quote_size:
          type: string
          example: '10.00'
          description: >-
            The amount of the second Asset in the Trading Pair. For example, on
            the BTC/USD Order Book, USD is the Quote Asset.
        base_size:
          type: string
          example: '0.001'
          description: >-
            The amount of the first Asset in the Trading Pair. For example, on
            the BTC-USD Order Book, BTC is the Base Asset.
        limit_price:
          type: string
          example: '10000.00'
          description: >-
            The specified price, or better, that the Order should be executed
            at. A Buy Order will execute at or lower than the limit price. A
            Sell Order will execute at or higher than the limit price.
        rfq_disabled:
          type: boolean
          description: >-
            If true, or if the user is a non-EU region user, this order will be
            attempted to be routed to the exchange CLOB.
    coinbase.public_api.authed.retail_brokerage_api.TwapLimitGtd:
      type: object
      properties:
        quote_size:
          type: string
          example: '10.00'
          description: >-
            The amount of the second Asset in the Trading Pair. For example, on
            the BTC/USD Order Book, USD is the Quote Asset.
        base_size:
          type: string
          example: '0.001'
          description: >-
            The amount of the first Asset in the Trading Pair. For example, on
            the BTC-USD Order Book, BTC is the Base Asset.
        start_time:
          type: string
          format: RFC3339 Timestamp
          example: '2021-05-31T07:59:59.000Z'
          description: Time at which the order should begin executing.
        end_time:
          type: string
          format: RFC3339 Timestamp
          example: '2021-05-31T09:59:59.000Z'
          description: The time at which the order will be cancelled if it is not Filled.
        limit_price:
          type: string
          example: '10000.00'
          description: >-
            The specified price, or better, that the Order should be executed
            at. A Buy Order will execute at or lower than the limit price. A
            Sell Order will execute at or higher than the limit price.
        number_buckets:
          type: string
          example: '5'
          description: >-
            The number of smaller buckets/suborders over which the entire order
            will be broken into. Each suborder will be executed over a duration
            calculated based on the end_time
        bucket_size:
          type: string
          example: '2.00'
          description: >-
            The size of each suborder. bucket_size multiplied by number_buckets
            should match the size of the entire twap order)
        bucket_duration:
          type: string
          example: 300s
          description: The duration over which each sub order was executed
    coinbase.public_api.authed.retail_brokerage_api.StopLimitStopLimitGtc:
      type: object
      properties:
        base_size:
          type: string
          example: '0.001'
          description: >-
            The amount of the first Asset in the Trading Pair. For example, on
            the BTC-USD Order Book, BTC is the Base Asset.
        limit_price:
          type: string
          example: '10000.00'
          description: >-
            The specified price, or better, that the Order should be executed
            at. A Buy Order will execute at or lower than the limit price. A
            Sell Order will execute at or higher than the limit price.
        stop_price:
          type: string
          example: '20000.00'
          description: The specified price that will trigger the placement of the Order.
        stop_direction:
          example: '20000.00'
          description: >-
            The direction of the stop limit Order. If Up, then the Order will
            trigger when the last trade price goes above the stop_price. If
            Down, then the Order will trigger when the last trade price goes
            below the stop_price.
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.StopPriceDirection
    coinbase.public_api.authed.retail_brokerage_api.StopLimitStopLimitGtd:
      type: object
      properties:
        base_size:
          type: string
          example: 0.001
          description: >-
            The amount of the first Asset in the Trading Pair. For example, on
            the BTC-USD Order Book, BTC is the Base Asset.
        limit_price:
          type: string
          example: '10000.00'
          description: >-
            The specified price, or better, that the Order should be executed
            at. A Buy Order will execute at or lower than the limit price. A
            Sell Order will execute at or higher than the limit price.
        stop_price:
          type: string
          example: '20000.00'
          description: The specified price that will trigger the placement of the Order.
        end_time:
          type: string
          format: RFC3339 Timestamp
          example: '2021-05-31T09:59:59.000Z'
          description: The time at which the order will be cancelled if it is not Filled.
        stop_direction:
          example: '20000.00'
          description: >-
            The direction of the stop limit Order. If Up, then the Order will
            trigger when the last trade price goes above the stop_price. If
            Down, then the Order will trigger when the last trade price goes
            below the stop_price.
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.StopPriceDirection
    coinbase.public_api.authed.retail_brokerage_api.TriggerBracketGtc:
      type: object
      properties:
        base_size:
          type: string
          example: 0.001
          description: >-
            The amount of the first Asset in the Trading Pair. For example, on
            the BTC-USD Order Book, BTC is the Base Asset.
        limit_price:
          type: string
          example: '10000.00'
          description: >-
            The specified price, or better, that the Order should be executed
            at. A Buy Order will execute at or lower than the limit price. A
            Sell Order will execute at or higher than the limit price.
        stop_trigger_price:
          type: string
          example: '20000.00'
          description: >-
            The price level (in quote currency) where the position will be
            exited. When triggered, a stop limit order is automatically placed
            with a limit price 5% higher for BUYS and 5% lower for SELLS.
    coinbase.public_api.authed.retail_brokerage_api.TriggerBracketGtd:
      type: object
      properties:
        base_size:
          type: string
          example: 0.001
          description: >-
            The amount of the first Asset in the Trading Pair. For example, on
            the BTC-USD Order Book, BTC is the Base Asset.
        limit_price:
          type: string
          example: '10000.00'
          description: >-
            The specified price, or better, that the Order should be executed
            at. A Buy Order will execute at or lower than the limit price. A
            Sell Order will execute at or higher than the limit price.
        stop_trigger_price:
          type: string
          example: '20000.00'
          description: >-
            The price level (in quote currency) where the position will be
            exited. When triggered, a stop limit order is automatically placed
            with a limit price 5% higher for BUYS and 5% lower for SELLS.
        end_time:
          type: string
          format: RFC3339 Timestamp
          example: '2021-05-31T09:59:59.000Z'
          description: The time at which the order will be cancelled if it is not Filled.
    coinbase.public_api.authed.retail_brokerage_api.ScaledLimitGtc:
      type: object
      properties:
        orders:
          type: array
          items:
            $ref: >-
              #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.LimitLimitGtc
        quote_size:
          type: string
        base_size:
          type: string
        num_orders:
          type: integer
          format: int32
        min_price:
          type: string
          title: >-
            infer the start / end price of the scaled orders based on the min /
            max price + distribution
        max_price:
          type: string
        price_distribution:
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ScaledPriceDistribution
        size_distribution:
          description: 'Size distribution across the child orders. '
          allOf:
            - $ref: >-
                #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ScaledSizeDistribution
        size_diff:
          type: string
        size_ratio:
          type: string
      title: >-
        scaled limit order allows user to specify the order size and price on
        the child
    coinbase.public_api.authed.retail_brokerage_api.PredictionSide:
      type: string
      enum:
        - PREDICTION_SIDE_UNKNOWN
        - PREDICTION_SIDE_YES
        - PREDICTION_SIDE_NO
      default: PREDICTION_SIDE_UNKNOWN
      description: >-
        Prediction market orders can be either a YES or NO.


        Under the hood, there is only a YES order book; NO orders are
        technically

        short positions on the YES order book.
    coinbase.public_api.authed.retail_brokerage_api.TriggerBracketPnl:
      type: object
      properties:
        take_profit_pnl:
          type: string
          description: PNL if an attached order fills at the take profit price.
        stop_loss_pnl:
          type: string
          description: PNL if an attached order fills at the stop loss price
      title: PNL Configurations
    coinbase.public_api.authed.retail_brokerage_api.ScaledOrderDistribution:
      type: object
      properties:
        size:
          type: string
        price:
          type: string
        errs:
          type: array
          items:
            $ref: >-
              #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PreviewFailureReason
        warning:
          type: array
          items:
            $ref: >-
              #/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PreviewWarningMsg
      title: represents size / price of a scaled order in core proto
    coinbase.public_api.authed.retail_brokerage_api.Amount:
      type: object
      properties:
        value:
          type: string
          example: '1.23'
          description: Amount of currency that this object represents.
          required:
            - value
        currency:
          type: string
          example: BTC
          description: Denomination of the currency.
          required:
            - currency
      required:
        - value
        - currency
    coinbase.public_api.authed.retail_brokerage_api.StopPriceDirection:
      type: string
      enum:
        - STOP_DIRECTION_STOP_UP
        - STOP_DIRECTION_STOP_DOWN
      default: ''
      title: >-
        - STOP_DIRECTION_STOP_UP: Order will trigger if the last trade price
        goes above the stop price
         - STOP_DIRECTION_STOP_DOWN: Order will trigger if the last trade price goes below the stop price
    coinbase.public_api.authed.retail_brokerage_api.ScaledPriceDistribution:
      type: string
      enum:
        - FLAT
        - LINEAR_INCREASING
        - LINEAR_DECREASING
        - CUSTOM_PRICE_DISTRIBUTION
      default: FLAT
      title: Defines the distribution of prices for scaled orders
    coinbase.public_api.authed.retail_brokerage_api.ScaledSizeDistribution:
      type: string
      enum:
        - UNKNOWN_DISTRIBUTION
        - INCREASING
        - DECREASING
        - EVENLY_SPLIT
        - CUSTOM_SIZE_DISTRIBUTION
      default: UNKNOWN_DISTRIBUTION
      title: Defines the distribution of sizes for scaled orders
  securitySchemes:
    apiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        A JWT signed using your CDP API Key Secret, encoded in base64. Refer to
        the [Creating API
        Keys](/coinbase-app/authentication-authorization/api-key-authentication)
        section of our Coinbase App Authentication docs for information on how
        to generate your Bearer Token.

````