Orders

List Past Orders

This API retrieves (closed) orders history for an account.

Roles

The API key you use to access this endpoint must have the Trader or Auditor role assigned. See Roles for more information.

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

How to retrieve your order history

To retrieve your full order history walking backwards,

  1. Initial request: POST to https://api.gemini.com/v1/orders/history with a JSON payload including a timestamp key with value 0 and a limit_orders key with value 500
  2. When you receive the list of orders, it will be sorted by timestamp descending - so the first element in the list will have the highest timestamp value. For this example, say that value is X.
  3. Create a second POST request with a JSON payload including a timestamp key with value X+1 and a limit_orders key with value 500.
  4. Take the first element of the list returned with highest timestamp value Y and create a third POST request with a JSON payload including a timestamp key with value Y+1 and a limit_orders key with value 500.
  5. Continue creating POST requests and retrieving orders until an empty list is returned.

Break Types

In the rare event that a trade has been reversed (broken), the trade that is broken will have this flag set. The field will contain one of these values

ValueDescription
manualThe trade was reversed manually. This means that all fees, proceeds, and debits associated with the trade have been credited or debited to the account seperately. That means that this reported trade must be included for order for the account balance to be correct.
fullThe trade was fully broken. The reported trade should not be accounted for. It will be as though the transfer of fund associated with the trade had simply not happened.
post/v1/orders/history

Request

  • Base URL
    https://api.gemini.com
  • URL
    https://api.gemini.com/v1/orders/history
  • 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 API endpoint /v1/orders/history

symbolstring

The symbol to retrieve orders for

limit_ordersinteger

The maximum number of orders to return. Default is 50, max is 500.

accountstring

Required for Master API keys as described in Private API Invocation. The name of the account within the subaccount group.

Example request

{
  "nonce": "1495127793000",
  "timestamp": "1495127793000"
}

Response

Successful operation

order_idstring integer

The order id

client_order_idstring integer

An optional client-specified order id

symbolstring

The symbol of the order

exchangestring

Will always be "gemini"

pricestring decimal

The price the order was issued at

avg_execution_pricestring decimal

The average price at which this order as been executed so far. 0 if the order has not been executed at all.

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

Description of the order

optionsstring[]

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

is_liveboolean

true if the order is active on the book (has remaining quantity and has not been canceled)

is_cancelledboolean

true if the order has been canceled. Note the spelling, "cancelled" instead of "canceled". This is for compatibility reasons.

reasonstring

Populated with the reason your order was canceled, if available.

was_forcedboolean

Will always be false.

executed_amountstring decimal

The amount of the order that has been filled.

remaining_amountstring decimal

The amount of the order that has not been filled.

original_amountstring decimal

The originally submitted amount of the order.

is_hiddenboolean

Will always return false.

Example response

[
  {
    "timestamp": "1495127793000",
    "timestampms": "1495127793000",
    "trades": [
      {
        "timestamp": "1495127793000",
        "timestampms": "1495127793000",
        "type": "Buy",
        "fee_currency": "USD",
        "fee_amount": "1.23",
        "tid": 17379712930,
        "exchange": "gemini"
      }
    ]
  }
]

Changes

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