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:
| Option | Description |
|---|---|
| "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). |
Request
- Base URLhttps://api.gemini.com
- URLhttps://api.gemini.com/v1/order/new
- AuthAPI key in header X-GEMINI-APIKEY and API key in header X-GEMINI-SIGNATURE and API key in header X-GEMINI-PAYLOAD
Headers
Your API key
HEX-encoded HMAC-SHA384 of payload signed with API secret
Base64-encoded JSON payload
Request body
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
Example response
{
"timestamp": "1495127793000",
"timestampms": "1495127793000"
}Changes
No recorded changes to this operation across all 1 revision of this API.