Orders

Create New Order

If you wish orders to be automatically cancelled when your session ends, see the require heartbeat section, or manually send the cancel all session orders message.

<div class="p-4 text-sm section-icon section-info rounded-sm" role="alert"> <div class="flex"> <svg view-box="0 0 24 24" > <path fill-rule="evenodd" clip-rule="evenodd" d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z" /> </svg> Master API keys do not support cancelation on disconnect via heartbeat. </div>

Enabled for perpetuals accounts from July 10th, 0100hrs ET onwards.

</div>

Roles

The API key you use to access this endpoint must have the Trader role assigned. See <a href="/roles#roles">Roles</a> for more information.

The OAuth scope must have orders:create assigned to access this endpoint. See OAuth Scopes for more information.

Margin Orders

Set margin_order: true to place an order using borrowed funds on a margin-enabled account. This allows you to trade with leverage beyond your available balance.

Important: Margin trading amplifies both gains and losses. Monitor your account using the Margin Account Summary endpoint and preview order impacts with Order Preview before placing margin orders.

Stop-Limit Orders

A Stop-Limit order is an order type that allows for order placement when a price reaches a specified level. Stop-Limit orders take in both a price and and a stop_price as parameters. The stop_price is the price that triggers the order to be placed on the continous live order book at the price. For buy orders, the stop_price must be below the price while sell orders require the stop_price to be greater than the price.

What about market orders?

The API doesn't directly support market orders because they provide you with no price protection.

Instead, use the “immediate-or-cancel” order execution option, coupled with an aggressive limit price (i.e. very high for a buy order or very low for a sell order), to achieve the same result.

Order execution options

Note that options is an array. If you omit options or provide an empty array, your order will be a standard limit order - it will immediately fill against any open orders at an equal or better price, then the remainder of the order will be posted to the order book.

If you specify more than one option (or an unsupported option) in the options array, the exchange will reject your order.

No options can be applied to stop-limit orders at this time.

The available limit order options are:

OptionDescription
"maker-or-cancel"This order will only add liquidity to the order book.<br><br>If any part of the order could be filled immediately, the whole order will instead be canceled before any execution occurs.<br><br> If that happens, the response back from the API will indicate that the order has already been canceled ("is_cancelled": true in JSON).<br><br>Note: some other exchanges call this option "post-only".
"immediate-or-cancel"This order will only remove liquidity from the order book.<br><br>It will fill whatever part of the order it can immediately, then cancel any remaining amount so that no part of the order is added to the order book.<br><br>If the order doesn't fully fill immediately, the response back from the API will indicate that the order has already been canceled ("is_cancelled": true in JSON).
"fill-or-kill"This order will only remove liquidity from the order book.<br><br>It will fill the entire order immediately or cancel.<br><br>If the order doesn't fully fill immediately, the response back from the API will indicate that the order has already been canceled ("is_cancelled": true in JSON).
post/v1/order/new

Request

  • Base URL
    https://api.gemini.com
  • URL
    https://api.gemini.com/v1/order/new
  • Auth
    API key in header X-GEMINI-APIKEY and API key in header X-GEMINI-SIGNATURE and API key in header X-GEMINI-PAYLOAD

Headers

X-GEMINI-APIKEYstring required

Your API key

X-GEMINI-SIGNATUREstring required

HEX-encoded HMAC-SHA384 of payload signed with API secret

X-GEMINI-PAYLOADstring required

Base64-encoded JSON payload

Content-Typestring
Content-Lengthstring
Cache-Controlstring

Request body

requeststring required

The literal string "/v1/order/new"

noncenumber required

The nonce, as described in Private API Invocation

client_order_idstring

Recommended. A client-specified order id

symbolstring required

The symbol for the new order

amountstring required

Quoted decimal amount to purchase

pricestring required

Quoted decimal amount to spend per unit

side'buy' | 'sell' required
type'exchange limit' | 'exchange stop limit' | 'exchange market' required

The order type. "exchange limit" for all order types except for stop-limit orders. "exchange stop limit" for stop-limit orders.

optionsstring[]

An optional array containing at most one supported order execution option. See Order execution options for details.

stop_pricestring

The price to trigger a stop-limit order. Only available for stop-limit orders.

margin_orderboolean

Set to true to place this order on a margin account using borrowed funds. Defaults to false. Only available for margin-enabled accounts. See Margin Trading for details.

accountstring

Required for Master API keys as described in Private API Invocation. The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts.

Example request

{
  "request": "/v1/order/new",
  "symbol": "BTCUSD",
  "amount": "5",
  "price": "3633.00",
  "side": "buy",
  "type": "exchange limit",
  "options": [
    "maker-or-cancel"
  ]
}

Response

Response will be the fields included in Order Status

OR

Example response

{
  "timestamp": "1495127793000",
  "timestampms": "1495127793000"
}

Changes

No recorded changes to this operation across all 1 revision of this API.