Trading
Matching Engine
Private

Modifies an existing order by changing its price, amount, and/or other properties such as time-in-force, post-only, reduce-only, trigger conditions, or advanced order type.

The order is identified by its order ID. Only open orders can be edited. Changes take effect immediately and may result in the order being filled if the new price matches the market.

Note: For spot orders routed to Coinbase Exchange, fills come back asynchronously. It is recommended to receive fills from the user.trades channel.

📖 Related Articles:

Scope: trade:read_write

Try in API console

get/private/edit

Request

  • Base URL
    https://test.deribit.com/api/v2
  • URL
    https://test.deribit.com/api/v2/private/edit
  • Auth
    none declared

Query parameters

order_idstring required

Unique order identifier

Example:ETH-100234

The order id

amountnumber

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.

contractsnumber

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.

pricenumber
<p>The order price in the instrument's price units (quote currency for futures and spot).</p> <p>When editing an option order with advanced=usd, the field price should be the option price value in USD.</p> <p>When editing an option 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>
post_onlyboolean
<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 or above the spread (accordingly to the original order type).</p> <p>Omitted means unchanged. Only valid for non-market, non-advanced orders with time_in_force=good_til_cancelled or good_til_day.</p> <p>For spot trading routed to Coinbase Exchange, the price is never adjusted: `"post_only"` must be combined with `"reject_post_only"` set to true, and the order is rejected if it would be matched instantly.</p>
reduce_onlyboolean

If true, the order is considered reduce-only which is intended to only reduce a current position

reject_post_onlyboolean
<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> <p>For spot trading routed to Coinbase Exchange, this must be set to true whenever `"post_only"` is true; otherwise the request is rejected with `post_only_not_allowed`.</p>
advanced'usd' | 'implv'

advanced type: "usd" or "implv" (Only for options; field is omitted if not applicable).

Advanced option order type. If you have posted an advanced option order, it is necessary to re-supply this parameter when editing it (Only for options)

trigger_pricenumber

Trigger price, required for trigger orders only (Stop-loss or Take-profit orders)

trigger_offsetnumber

Positive deviation from the price peak at which the order triggers; required for trailing_stop.

mmpboolean

Order MMP flag, only for order_type 'limit'

valid_untilinteger

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.

display_amountnumber

Initial visible amount for an iceberg order. Must meet the instrument's minimum iceberg amount and amount step, not exceed total amount, and satisfy the instrument's maximum total-to-display ratio.

Iceberg orders are not supported for option, future_combo, and option_combo instruments.

Response

Success response

jsonrpc'2.0' required

The JSON-RPC version (2.0)

idinteger

The id that was sent in the request

Example response

{
  "result": {
    "order": {
      "order_id": "ETH-100234",
      "instrument_name": "BTC-PERPETUAL",
      "creation_timestamp": 1536569522277,
      "last_update_timestamp": 1536569522277,
      "starbase_last_update_timestamp": 1536569522277000000,
      "block_trade": true,
      "trigger_order_id": "SLIB-370",
      "combo_order_id": "103148386169",
      "starbase_order_id": 103148386170,
      "app_name": "Example Application",
      "mmp_cancelled": true,
      "oto_order_ids": [
        "ETH-100234"
      ],
      "primary_order_id": "ETH-100234"
    },
    "trades": [
      {
        "instrument_name": "BTC-PERPETUAL",
        "timestamp": 1517329113791,
        "starbase_timestamp": 1536569522277000000,
        "starbase_order_id": 103148386170,
        "block_trade_id": "154",
        "block_trade_leg_count": 3
      }
    ]
  }
}

Changes

    • breaking

      for the query request parameter display_amount, default value 1 was removed

    • breaking

      for the query request parameter post_only, default value true was removed

    • breaking

      the response property /// became nullable for the status

    • breaking

      the response property /// became nullable for the status

    • breaking

      the response property /// became nullable for the status

    • breaking

      the /// response's property type changed from string to boolean for status

    • breaking

      the /// response's property type changed from string to boolean for status

    • info

      added the optional property /// to the response with the status