> ## 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.

# private/buy

> Places a buy order for an instrument. Supports various order types including limit, market, stop, and advanced order types (stop-limit, take-profit, take-profit-limit, trailing-stop, etc.).

You can specify order parameters such as price, quantity, time-in-force, post-only, reduce-only, and trigger conditions. Orders can be labeled for easier management and tracking.

**📖 Related Article:** [Order Management Best Practices](https://docs.deribit.com/articles/order-management-best-practices)

**Scope:** `rat#trade` or `wallet:buys:create`

[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fbuy)





## OpenAPI

````yaml /api-reference/coinbase-deribit-app-api/adv-starbase-openapi.json get /private/buy
openapi: 3.0.0
info:
  description: Coinbase Retail Advanced Trade API for derivatives trading.
  title: Coinbase Retail Advanced Trade (Deribit) API
  version: 2.1.1
servers:
  - url: https://drb.coinbase.com/api/v2
security: []
tags:
  - description: Can only be used over websockets.
    name: WebSocket Only
  - description: Public methods can be used without authentication.
    name: Public
  - description: >-
      <p>Private methods require authentication. All requests must include a
      valid OAuth2 token.</p>

      <p>A token can be requested using the <a
      href="#public-auth">/public/auth</a> method.</p>

      <p>When using the websockets protocol, the token must be included as a
      parameter <code>access_token</code> in the message. When using REST (HTTP
      GET), the token may also be passed in the <code>Authorization</code>
      header.</p>
    name: Private
  - name: Authentication
  - name: Session Management
  - description: >-
      Subscription works as [notifications](#notifications), so users will
      automatically (after subscribing) receive messages from the server.
      Overview for each channel response format is described in
      [subscriptions](#subscriptions) section.
    name: Subscription Management
  - name: Account Management
  - name: Trading
  - name: Market Data
paths:
  /private/buy:
    get:
      tags:
        - Trading
        - Matching Engine
        - Private
      description: >+
        Places a buy order for an instrument. Supports various order types
        including limit, market, stop, and advanced order types (stop-limit,
        take-profit, take-profit-limit, trailing-stop, etc.).


        You can specify order parameters such as price, quantity, time-in-force,
        post-only, reduce-only, and trigger conditions. Orders can be labeled
        for easier management and tracking.


        **📖 Related Article:** [Order Management Best
        Practices](https://docs.deribit.com/articles/order-management-best-practices)


        **Scope:** `rat#trade` or `wallet:buys:create`


        [Try in API
        console](https://test.deribit.com/api_console?method=%2Fprivate%2Fbuy)

      parameters:
        - description: Instrument name
          in: query
          name: instrument_name
          required: true
          schema:
            $ref: '#/components/schemas/instrument_name'
        - description: >-
            It represents the requested order size. For perpetual and inverse
            futures the amount is in USD units. For options and linear futures
            it is the underlying base currency coin. The `amount` is a mandatory
            parameter if `contracts` parameter is missing. If both `contracts`
            and `amount` parameter are passed they must match each other
            otherwise error is returned.
          in: query
          name: amount
          required: false
          schema:
            type: number
        - description: >-
            It represents the requested order size in contract units and can be
            passed instead of `amount`. The `contracts` is a mandatory parameter
            if `amount` parameter is missing. If both `contracts` and `amount`
            parameter are passed they must match each other otherwise error is
            returned.
          in: query
          name: contracts
          required: false
          schema:
            type: number
        - description: 'The order type, default: `"limit"`'
          in: query
          name: type
          required: false
          schema:
            enum:
              - limit
              - stop_limit
              - take_limit
              - market
              - stop_market
              - take_market
              - market_limit
              - trailing_stop
            type: string
        - description: user defined label for the order (maximum 64 characters)
          in: query
          name: label
          required: false
          schema:
            type: string
        - description: >-
            <p>The order price in base currency (Only for limit and stop_limit
            orders)</p> <p>When adding an order with advanced=usd, the field
            price should be the option price value in USD.</p> <p>When adding an
            order with advanced=implv, the field price should be a value of
            implied volatility in percentages. For example,  price=100, means
            implied volatility of 100%</p>
          in: query
          name: price
          required: false
          schema:
            type: number
        - description: >-
            <p>Specifies how long the order remains in effect. Default
            `"good_til_cancelled"`</p> <ul> <li>`"good_til_cancelled"` -
            unfilled order remains in order book until cancelled</li>
            <li>`"good_til_day"` - unfilled order remains in order book till the
            end of the trading session</li> <li>`"fill_or_kill"` - execute a
            transaction immediately and completely or not at all</li>
            <li>`"immediate_or_cancel"` - execute a transaction immediately, and
            any portion of the order that cannot be immediately filled is
            cancelled</li> </ul>
          in: query
          name: time_in_force
          required: false
          schema:
            default: good_til_cancelled
            enum:
              - good_til_cancelled
              - good_til_day
              - fill_or_kill
              - immediate_or_cancel
            type: string
        - description: >-
            Initial display amount for iceberg order. Has to be at least 100
            times minimum amount for instrument and ratio of hidden part vs
            visible part has to be less than 100 as well.
          in: query
          name: display_amount
          required: false
          schema:
            default: 1
            type: number
        - description: >-
            <p>If true, the order is considered post-only. If the new price
            would cause the order to be filled immediately (as taker), the price
            will be changed to be just below the spread.</p> <p>Only valid in
            combination with time_in_force=`"good_til_cancelled"`</p>
          in: query
          name: post_only
          required: false
          schema:
            default: true
            type: boolean
        - description: >-
            <p>If an order is considered post-only and this field is set to true
            then the order is put to the order book unmodified or the request is
            rejected.</p> <p>Only valid in combination with `"post_only"` set to
            true</p>
          in: query
          name: reject_post_only
          required: false
          schema:
            default: false
            type: boolean
        - description: >-
            If `true`, the order is considered reduce-only which is intended to
            only reduce a current position
          in: query
          name: reduce_only
          required: false
          schema:
            default: false
            type: boolean
        - description: >-
            Trigger price, required for trigger orders only (Stop-loss or
            Take-profit orders)
          in: query
          name: trigger_price
          required: false
          schema:
            type: number
        - description: >-
            The maximum deviation from the price peak beyond which the order
            will be triggered
          in: query
          name: trigger_offset
          required: false
          schema:
            type: number
        - description: >-
            Defines the trigger type. Required for `"Stop-Loss"`,
            `"Take-Profit"` and `"Trailing"` trigger orders
          in: query
          name: trigger
          required: false
          schema:
            $ref: '#/components/schemas/trigger'
        - description: >-
            Advanced option order type. (Only for options. Advanced USD orders
            are not supported for linear options.)
          in: query
          name: advanced
          required: false
          schema:
            $ref: '#/components/schemas/advanced'
        - description: Order MMP flag, only for order_type 'limit'
          in: query
          name: mmp
          required: false
          schema:
            default: false
            type: boolean
        - description: >-
            Timestamp, when provided server will start processing request in
            Matching Engine only before given timestamp, in other cases
            `timed_out` error will be responded. Remember that the given
            timestamp should be consistent with the server's time, use <a
            href='#public-get_time'>/public/time</a> method to obtain current
            server time.
          in: query
          name: valid_until
          required: false
          schema:
            type: integer
        - description: >-
            <p>The type of the linked order.</p> <ul> <li>`"one_triggers_other"`
            - Execution of primary order triggers the placement of one or more
            secondary orders.</li> <li>`"one_cancels_other"` -  The execution of
            one order in a pair automatically cancels the other, typically used
            to set a stop-loss and take-profit simultaneously.</li>
            <li>`"one_triggers_one_cancels_other"` - The execution of a primary
            order triggers two secondary orders (a stop-loss and take-profit
            pair), where the execution of one secondary order cancels the
            other.</li> </ul>
          in: query
          name: linked_order_type
          required: false
          schema:
            enum:
              - one_triggers_other
              - one_cancels_other
              - one_triggers_one_cancels_other
            type: string
        - description: >-
            <p>The fill condition of the linked order (Only for linked order
            types), default: `first_hit`.</p> <ul> <li>`"first_hit"` - any
            execution of the primary order will fully cancel/place all secondary
            orders.</li> <li>`"complete_fill"` - a complete execution (meaning
            the primary order no longer exists) will cancel/place the secondary
            orders.</li> <li>`"incremental"` - any fill of the primary order
            will cause proportional partial cancellation/placement of the
            secondary order. The amount that will be subtracted/added to the
            secondary order will be rounded down to the contract size.</li>
            </ul>
          in: query
          name: trigger_fill_condition
          required: false
          schema:
            default: first_hit
            enum:
              - first_hit
              - complete_fill
              - incremental
            type: string
        - description: List of orders to create or cancel when this order is filled.
          explode: true
          in: query
          name: otoco_config
          required: false
          schema:
            items:
              properties:
                amount:
                  $ref: '#/components/schemas/amount'
                  description: >-
                    It represents the requested order size. For perpetual and
                    inverse futures the amount is in USD units. For options and
                    linear futures it is the underlying base currency coin.
                direction:
                  $ref: '#/components/schemas/direction'
                  description: Direction of trade from the maker perspective
                label:
                  description: user defined label for the order (maximum 64 characters)
                  type: string
                post_only:
                  default: false
                  description: >-
                    If true, the order is considered post-only. If the new price
                    would cause the order to be filled immediately (as taker),
                    the price will be changed to be just below or above the
                    spread (according to the direction of the order).
                  type: boolean
                price:
                  description: >-
                    The order price in base currency (Only for limit and
                    stop_limit orders)
                  type: number
                reduce_only:
                  default: false
                  description: >-
                    If true, the order is considered reduce-only which is
                    intended to only reduce a current position
                  type: boolean
                reject_post_only:
                  default: false
                  description: >-
                    If an order is considered post-only and this field is set to
                    true then the order is put to the order book unmodified or
                    the request is rejected.
                  type: boolean
                time_in_force:
                  default: good_til_cancelled
                  description: >-
                    Specifies how long the order remains in effect. Default
                    "good_til_cancelled"
                  enum:
                    - good_til_cancelled
                    - good_til_day
                    - fill_or_kill
                    - immediate_or_cancel
                  type: string
                trigger:
                  $ref: '#/components/schemas/trigger'
                  description: >-
                    Defines the trigger type. Required for "Stop-Loss",
                    "Take-Profit" and "Trailing" trigger orders
                trigger_offset:
                  description: >-
                    The maximum deviation from the price peak beyond which the
                    order will be triggered
                  type: number
                trigger_price:
                  description: >-
                    Trigger price, required for trigger orders only (Stop-loss
                    or Take-profit orders)
                  type: number
                type:
                  description: 'The order type, default: "limit"'
                  enum:
                    - limit
                    - stop_limit
                    - take_limit
                    - market
                    - stop_market
                    - take_market
                    - market_limit
                    - trailing_stop
                  type: string
              type: object
            type: array
          style: form
      requestBody:
        content:
          application/json:
            examples:
              request:
                description: JSON-RPC Request Example
                value:
                  id: 5275
                  jsonrpc: '2.0'
                  method: private/buy
                  params:
                    amount: 40
                    instrument_name: ETH-PERPETUAL
                    label: market0000234
                    type: market
        description: JSON-RPC request body
      responses:
        '200':
          $ref: '#/components/responses/PrivateBuyAndSellResponse'
components:
  schemas:
    instrument_name:
      description: Unique instrument identifier
      example: BTC-PERPETUAL
      type: string
    trigger:
      description: >-
        Trigger type (only for trigger orders). Allowed values: `"index_price"`,
        `"mark_price"`, `"last_price"`.
      enum:
        - index_price
        - mark_price
        - last_price
      type: string
    advanced:
      description: >
        advanced type: `"usd"` or `"implv"` (Only for options; field is omitted
        if not applicable).
      enum:
        - usd
        - implv
      type: string
    amount:
      description: >-
        It represents the requested order size. For perpetual and inverse
        futures the amount is in USD units. For options and linear futures it is
        the underlying base currency coin.
      type: number
    direction:
      description: 'Direction: `buy`, or `sell`'
      enum:
        - buy
        - sell
      type: string
    PrivateBuyAndSellResponse:
      properties:
        id:
          description: The id that was sent in the request
          type: integer
        jsonrpc:
          description: The JSON-RPC version (2.0)
          enum:
            - '2.0'
          type: string
        result:
          properties:
            order:
              $ref: '#/components/schemas/order'
            trades:
              items:
                $ref: '#/components/schemas/user_trade'
              type: array
          required:
            - order
            - trades
          type: object
      required:
        - jsonrpc
        - result
      type: object
    order:
      properties:
        advanced:
          $ref: '#/components/schemas/advanced'
        amount:
          $ref: '#/components/schemas/amount'
        api:
          $ref: '#/components/schemas/api'
        app_name:
          description: >-
            The name of the application that placed the order on behalf of the
            user (optional).
          example: Example Application
          type: string
        auto_replaced:
          description: >-
            Options, advanced orders only - `true` if last modification of the
            order was performed by the pricing engine, otherwise `false`.
          type: boolean
        average_price:
          $ref: '#/components/schemas/average_price'
        block_trade:
          $ref: '#/components/schemas/block_trade_order'
        cancel_reason:
          $ref: '#/components/schemas/cancel_reason'
        contracts:
          $ref: '#/components/schemas/contracts'
        creation_timestamp:
          $ref: '#/components/schemas/timestamp'
        direction:
          $ref: '#/components/schemas/direction'
        display_amount:
          $ref: '#/components/schemas/display_amount'
        filled_amount:
          $ref: '#/components/schemas/filled_amount'
        implv:
          $ref: '#/components/schemas/implv'
        instrument_name:
          $ref: '#/components/schemas/instrument_name'
        is_liquidation:
          description: >-
            Optional (not added for spot). `true` if order was automatically
            created during liquidation
          type: boolean
        is_primary_otoco:
          description: >-
            `true` if the order is an order that can trigger an OCO pair,
            otherwise not present.
          type: boolean
        is_rebalance:
          description: >-
            Optional (only for spot). `true` if order was automatically created
            during cross-collateral balance restoration
          type: boolean
        is_secondary_oto:
          $ref: '#/components/schemas/is_secondary_oto'
        label:
          $ref: '#/components/schemas/label'
        last_update_timestamp:
          $ref: '#/components/schemas/timestamp'
        mmp:
          description: '`true` if the order is a MMP order, otherwise `false`.'
          type: boolean
        mmp_cancelled:
          description: '`true` if order was cancelled by mmp trigger (optional)'
          example: true
          type: boolean
        mmp_group:
          description: >-
            Name of the MMP group supplied in the `private/mass_quote` request.
            Only present for quote orders.
          type: string
        mobile:
          $ref: '#/components/schemas/mobile'
        oco_ref:
          $ref: '#/components/schemas/oco_ref'
        order_id:
          $ref: '#/components/schemas/order_id'
        order_state:
          $ref: '#/components/schemas/order_state'
        order_type:
          $ref: '#/components/schemas/order_type'
        original_order_type:
          $ref: '#/components/schemas/original_order_type'
        oto_order_ids:
          description: The Ids of the orders that will be triggered if the order is filled
          items:
            $ref: '#/components/schemas/order_id'
            description: Order Id
          type: array
        post_only:
          $ref: '#/components/schemas/post_only'
        price:
          $ref: '#/components/schemas/open_order_price'
        primary_order_id:
          $ref: '#/components/schemas/order_id'
          description: ID of the order that triggered this order.
        quote:
          description: If order is a quote. Present only if true.
          type: boolean
        quote_id:
          description: >-
            The same QuoteID as supplied in the `private/mass_quote` request.
            Only present for quote orders.
          type: string
        quote_set_id:
          description: >-
            Identifier of the QuoteSet supplied in the `private/mass_quote`
            request. Only present for quote orders.
          type: string
        reduce_only:
          $ref: '#/components/schemas/reduce_only'
        refresh_amount:
          $ref: '#/components/schemas/refresh_amount'
        reject_post_only:
          $ref: '#/components/schemas/reject_post_only'
        replaced:
          description: >-
            `true` if the order was edited (by user or - in case of advanced
            options orders - by pricing engine), otherwise `false`.
          type: boolean
        risk_reducing:
          description: >-
            `true` if the order is marked by the platform as a risk reducing
            order (can apply only to orders placed by PM users), otherwise
            `false`.
          type: boolean
        time_in_force:
          $ref: '#/components/schemas/time_in_force'
        trigger:
          $ref: '#/components/schemas/trigger'
        trigger_fill_condition:
          $ref: '#/components/schemas/trigger_fill_condition'
        trigger_offset:
          $ref: '#/components/schemas/trigger_offset'
        trigger_order_id:
          description: >-
            Id of the trigger order that created the order (Only for orders that
            were created by triggered orders).
          example: SLIB-370
          type: string
        trigger_price:
          $ref: '#/components/schemas/trigger_price'
        trigger_reference_price:
          $ref: '#/components/schemas/trigger_reference_price'
        triggered:
          $ref: '#/components/schemas/triggered'
        usd:
          $ref: '#/components/schemas/usd'
        web:
          $ref: '#/components/schemas/web'
      required:
        - order_id
        - order_state
        - order_type
        - time_in_force
        - instrument_name
        - creation_timestamp
        - last_update_timestamp
        - direction
        - price
        - label
        - post_only
        - api
      type: object
    user_trade:
      properties:
        advanced:
          description: >-
            Advanced type of user order: `"usd"` or `"implv"` (only for options;
            omitted if not applicable)
          enum:
            - usd
            - implv
          type: string
        amount:
          description: >-
            Trade amount. For perpetual and inverse futures the amount is in USD
            units. For options and linear futures it is the underlying base
            currency coin.
          type: number
        api:
          description: '`true` if user order was created with API'
          type: boolean
        block_rfq_id:
          description: ID of the Block RFQ - when trade was part of the Block RFQ
          type: integer
        block_rfq_quote_id:
          description: ID of the Block RFQ quote - when trade was part of the Block RFQ
          type: integer
        block_trade_id:
          $ref: '#/components/schemas/block_trade_id_in_result'
        combo_id:
          description: >-
            Optional field containing combo instrument name if the trade is a
            combo trade
          type: string
        combo_trade_id:
          description: >-
            Optional field containing combo trade identifier if the trade is a
            combo trade
          type: number
        contracts:
          description: >-
            Trade size in contract units (optional, may be absent in historical
            trades)
          type: number
        direction:
          $ref: '#/components/schemas/direction'
          description: Trade direction of the taker
        fee:
          description: User's fee in units of the specified `fee_currency`
          type: number
        fee_currency:
          $ref: '#/components/schemas/currency'
        index_price:
          description: Index Price at the moment of trade
          type: number
        instrument_name:
          $ref: '#/components/schemas/instrument_name'
        iv:
          description: Option implied volatility for the price (Option only)
          type: number
        label:
          $ref: '#/components/schemas/label_presentation'
        legs:
          description: >-
            Optional field containing leg trades if trade is a combo trade
            (present when querying for **only** combo trades and in
            `combo_trades` events)
          type: array
        liquidation:
          description: >-
            Optional field (only for trades caused by liquidation): `"M"` when
            maker side of trade was under liquidation, `"T"` when taker side was
            under liquidation, `"MT"` when both sides of trade were under
            liquidation
          enum:
            - M
            - T
            - MT
          type: string
        liquidity:
          description: >-
            Describes what was role of users order: `"M"` when it was maker
            order, `"T"` when it was taker order
          enum:
            - M
            - T
          type: string
        mark_price:
          description: Mark Price at the moment of trade
          type: number
        matching_id:
          description: Always `null`
          type: string
        mmp:
          description: '`true` if user order is MMP'
          type: boolean
        order_id:
          description: >-
            Id of the user order (maker or taker), i.e. subscriber's order id
            that took part in the trade
          type: string
        order_type:
          description: 'Order type: `"limit`, `"market"`, or `"liquidation"`'
          enum:
            - limit
            - market
            - liquidation
          type: string
        post_only:
          description: '`true` if user order is post-only'
          type: string
        price:
          $ref: '#/components/schemas/price'
          description: The price of the trade
        profit_loss:
          $ref: '#/components/schemas/profit_loss'
        quote_id:
          description: >-
            QuoteID of the user order (optional, present only for orders placed
            with `private/mass_quote`)
          type: string
        quote_set_id:
          description: >-
            QuoteSet of the user order (optional, present only for orders placed
            with `private/mass_quote`)
          type: string
        reduce_only:
          description: '`true` if user order is reduce-only'
          type: string
        risk_reducing:
          description: >-
            `true` if user order is marked by the platform as a risk reducing
            order (can apply only to orders placed by PM users)
          type: boolean
        state:
          $ref: '#/components/schemas/order_state_in_user_trade'
        tick_direction:
          $ref: '#/components/schemas/tick_direction'
        timestamp:
          $ref: '#/components/schemas/trade_timestamp'
        trade_allocations:
          description: >-
            List of allocations for Block RFQ pre-allocation. Each allocation
            specifies `user_id`, `amount`, and `fee` for the allocated part of
            the trade. For broker client allocations, a `client_info` object
            will be included.
          items:
            properties:
              amount:
                description: Amount allocated to this user.
                type: number
              client_info:
                description: Optional client allocation info for brokers.
                properties:
                  client_id:
                    description: >-
                      ID of a client; available to broker. Represents a group of
                      users under a common name.
                    type: integer
                  client_link_id:
                    description: >-
                      ID assigned to a single user in a client; available to
                      broker.
                    type: integer
                  name:
                    description: >-
                      Name of the linked user within the client; available to
                      broker.
                    type: string
                type: object
              fee:
                description: Fee for the allocated part of the trade.
                type: number
              user_id:
                description: >-
                  User ID to which part of the trade is allocated. For brokers
                  the User ID is obstructed.
                type: integer
            required:
              - amount
              - fee
            type: object
          type: array
        trade_id:
          $ref: '#/components/schemas/trade_id'
        trade_seq:
          $ref: '#/components/schemas/trade_seq'
        underlying_price:
          description: Underlying price for implied volatility calculations (Options only)
          type: number
      required:
        - trade_id
        - trade_seq
        - instrument_name
        - timestamp
        - order_id
        - matching_id
        - direction
        - tick_direction
        - index_price
        - price
        - amount
        - fee
        - fee_currency
        - state
        - mark_price
      type: object
    api:
      description: '`true` if created with API'
      type: boolean
    average_price:
      description: Average fill price of the order
      type: number
    block_trade_order:
      description: '`true` if order made from block_trade trade, added only in that case.'
      example: true
      type: boolean
    cancel_reason:
      description: >-
        Enumerated reason behind cancel `"user_request"`, `"autoliquidation"`,
        `"cancel_on_disconnect"`, `"risk_mitigation"`, `"pme_risk_reduction"`
        (portfolio margining risk reduction), `"pme_account_locked"` (portfolio
        margining account locked per currency), `"position_locked"`,
        `"mmp_trigger"` (market maker protection), `"mmp_config_curtailment"`
        (market maker configured quantity decreased), `"edit_post_only_reject"`
        (cancelled on edit because of `reject_post_only` setting),
        `"oco_other_closed"` (the oco order linked to this order was closed),
        `"oto_primary_closed"` (the oto primary order that was going to trigger
        this order was cancelled), `"settlement"` (closed because of a
        settlement)
      enum:
        - user_request
        - autoliquidation
        - cancel_on_disconnect
        - risk_mitigation
        - pme_risk_reduction
        - pme_account_locked
        - position_locked
        - mmp_trigger
        - mmp_config_curtailment
        - edit_post_only_reject
        - oco_other_closed
        - oto_primary_closed
        - settlement
      type: string
    contracts:
      description: >-
        It represents the order size in contract units. (Optional, may be absent
        in historical data).
      type: number
    timestamp:
      description: The timestamp (milliseconds since the Unix epoch)
      example: 1536569522277
      type: integer
    display_amount:
      description: >-
        The actual display amount of iceberg order. Absent for other types of
        orders.
      type: number
    filled_amount:
      description: >-
        Filled amount of the order. For perpetual and futures the filled_amount
        is in USD units, for options - in units or corresponding cryptocurrency
        contracts, e.g., BTC or ETH.
      type: number
    implv:
      description: Implied volatility in percent. (Only if `advanced="implv"`)
      type: number
    is_secondary_oto:
      description: >-
        `true` if the order is an order that can be triggered by another order,
        otherwise not present.
      type: boolean
    label:
      description: User defined label (up to 64 characters)
      type: string
    mobile:
      description: >-
        Optional field with value `true` added only when created with Mobile
        Application
      type: boolean
    oco_ref:
      description: Unique reference that identifies a one_cancels_others (OCO) pair.
      type: string
    order_id:
      description: Unique order identifier
      example: ETH-100234
      type: string
    order_state:
      description: >-
        Order state: `"open"`, `"filled"`, `"rejected"`, `"cancelled"`,
        `"untriggered"`
      enum:
        - open
        - filled
        - rejected
        - cancelled
        - untriggered
        - triggered
      type: string
    order_type:
      description: >-
        Order type: `"limit"`, `"market"`, `"stop_limit"`, `"stop_market"`,
        `"take_limit"`, `"take_market"`, `"trailing_stop"`
      enum:
        - market
        - limit
        - stop_market
        - stop_limit
        - take_market
        - take_limit
        - trailing_stop
      type: string
    original_order_type:
      description: Original order type. Optional field
      enum:
        - market
        - market_limit
      type: string
    post_only:
      description: '`true` for post-only orders only'
      type: boolean
    open_order_price:
      description: >-
        Price in base currency or "market_price" in case of open trigger market
        orders
      oneOf:
        - type: number
        - enum:
            - market_price
          type: string
    reduce_only:
      description: Optional (not added for spot). '`true` for reduce-only orders only'
      type: boolean
    refresh_amount:
      description: >-
        The initial display amount of iceberg order. Iceberg order display
        amount will be refreshed to that value after match consuming actual
        display amount. Absent for other types of orders
      type: number
    reject_post_only:
      description: >-
        `true` if order has `reject_post_only` flag (field is present only when
        `post_only` is `true`)
      type: boolean
    time_in_force:
      description: >-
        Order time in force: `"good_til_cancelled"`, `"good_til_day"`,
        `"fill_or_kill"` or `"immediate_or_cancel"`
      enum:
        - good_til_cancelled
        - good_til_day
        - fill_or_kill
        - immediate_or_cancel
      type: string
    trigger_fill_condition:
      description: >-
        <p>The fill condition of the linked order (Only for linked order types),
        default: `first_hit`.</p> <ul> <li>`"first_hit"` - any execution of the
        primary order will fully cancel/place all secondary orders.</li>
        <li>`"complete_fill"` - a complete execution (meaning the primary order
        no longer exists) will cancel/place the secondary orders.</li>
        <li>`"incremental"` - any fill of the primary order will cause
        proportional partial cancellation/placement of the secondary order. The
        amount that will be subtracted/added to the secondary order will be
        rounded down to the contract size.</li> </ul>
      enum:
        - first_hit
        - complete_fill
        - incremental
      type: string
    trigger_offset:
      description: >-
        The maximum deviation from the price peak beyond which the order will be
        triggered (Only for trailing trigger orders)
      type: number
    trigger_price:
      description: Trigger price (Only for future trigger orders)
      type: number
    trigger_reference_price:
      description: >-
        The price of the given trigger at the time when the order was placed
        (Only for trailing trigger orders)
      type: number
    triggered:
      description: Whether the trigger order has been triggered
      type: boolean
    usd:
      description: Option price in USD (Only if `advanced="usd"`)
      type: number
    web:
      description: '`true` if created via Deribit frontend (optional)'
      type: boolean
    block_trade_id_in_result:
      description: Block trade id - when trade was part of a block trade
      example: '154'
      type: string
    currency:
      description: Currency, i.e `"BTC"`, `"ETH"`, `"USDC"`
      enum:
        - BTC
        - ETH
        - USDC
        - USDT
        - EURR
      type: string
    label_presentation:
      description: >-
        User defined label (presented only when previously set for order by
        user)
      type: string
    price:
      description: Price in base currency
      type: number
    profit_loss:
      description: Profit and loss in base currency.
      type: number
    order_state_in_user_trade:
      description: >-
        Order state: `"open"`, `"filled"`, `"rejected"`, `"cancelled"`,
        `"untriggered"` or `"archive"` (if order was archived)
      enum:
        - open
        - filled
        - rejected
        - cancelled
        - untriggered
        - archive
      type: string
    tick_direction:
      description: >-
        Direction of the "tick" (`0` = Plus Tick, `1` = Zero-Plus Tick, `2` =
        Minus Tick, `3` = Zero-Minus Tick).
      enum:
        - 0
        - 1
        - 2
        - 3
      type: integer
    trade_timestamp:
      description: The timestamp of the trade (milliseconds since the UNIX epoch)
      example: 1517329113791
      type: integer
    trade_id:
      description: Unique (per currency) trade identifier
      type: string
    trade_seq:
      description: The sequence number of the trade within instrument
      type: integer
  responses:
    PrivateBuyAndSellResponse:
      content:
        application/json:
          examples:
            response:
              description: Response example
              value:
                id: 6130
                jsonrpc: '2.0'
                result:
                  order:
                    amount: 21
                    api: true
                    average_price: 202.8
                    creation_timestamp: 1590486335742
                    direction: sell
                    filled_amount: 21
                    instrument_name: ETH-PERPETUAL
                    is_liquidation: false
                    is_rebalance: false
                    label: ''
                    last_update_timestamp: 1590486335742
                    max_show: 21
                    order_id: ETH-584864807
                    order_state: filled
                    order_type: limit
                    post_only: false
                    price: 198.75
                    reduce_only: true
                    replaced: false
                    time_in_force: good_til_cancelled
                    web: false
                  trades:
                    - amount: 21
                      direction: sell
                      fee: 0.00007766
                      fee_currency: ETH
                      index_price: 202.86
                      instrument_name: ETH-PERPETUAL
                      liquidity: T
                      mark_price: 202.79
                      matching_id: null
                      order_id: ETH-584864807
                      order_type: limit
                      post_only: false
                      price: 202.8
                      reduce_only: true
                      state: filled
                      tick_direction: 0
                      timestamp: 1590486335742
                      trade_id: ETH-2696097
                      trade_seq: 1966068
          schema:
            $ref: '#/components/schemas/PrivateBuyAndSellResponse'
      description: Success response

````