Gemini trading api
When you connect, you get a book of your active orders. Then in real time you'll get information about order events like:. You can use optional subscription filters to tailor your WebSocket feed to suit your individual needs. You can even create multiple WebSocket feeds for multiple purposes.
Your order is now visible on the Gemini order book. Under certain conditions, when you place an order you will not receive a booked event. Filtering is completely optional. If you don't specify any filters when you connect, you'll see all your order events: If you want to filter, it's simple. Filtering works by whitelisting.
You can filter on any combination of the following criteria:. To provide a list of arguments, repeat the parameter once for each argument you want to provide:. If you wanted to create a dropcopy-like event feed, to see order fills for all orders associated with your account on all symbols, connect using:. In general, if you create a custom event type filter, Gemini recommends always including initial: The API key you use to access this endpoint must have the Trader role assigned.
See Roles for more information. Compare the filters to the ones you requested to make sure your request was parsed as you expected. Gemini will send a heartbeat every five seconds so you'll know your WebSocket connection is active. Gemini recommends logging and retaining all heartbeat messages. If your WebSocket connection is unreliable, please contact Gemini support with this log. The next group of messages you receive shows all your current active orders at the time you subscribed.
Unless you've chosen to filter out the initial order event type, in which case you will not receive these messages. Indication of Interest i. When you place an order on the exchange, Gemini acknowledges that your order has been accepted for initial processing by sending you an accepted event.
This order was rejected because its price does not conform to the market price tick specified in Symbols and minimums. If your order cannot be accepted by the exchange, you will receive a single rejected event.
When limit orders are booked , they have a non-zero quantity visible on the exchange. These orders remain on the exchange until they are completed filled or cancelled. A fill event indicates a partial or a complete fill. The quantity filled by this specific trade is fill. Similarly, price is an optional field that denotes the original price of a limit order absent for market buys and sells , while fill. When one of your active orders is cancelled, you will receive a notification via a cancelled event.
The closed event is the last event in the workflow of any order that has been accepted on the exchange. When you receive this event, you will know that your order has been removed from the book. The initial response message will show the existing state of the order book. Subsequent messages will show all executed trades, as well as all other changes to the order book from orders placed or canceled. Note that every trade will trigger a message with entries of both types trade and change.
The initial response message will contain all the change events necessary to populate your order book from scratch. An auction open event advertises that an auction for this symbol is now open and accepting orders. If a response is in error, then the HTTP response code will be set to reflect this, and a JSON body will be returned that will contain information about the failure. In the event of an error, a non error code will be returned, and the response body will be a json object with three fields:.
For general information about how the WebSocket protocol works, refer to: Sandbox Gemini's sandbox site is an instance of the Gemini Exchange that offers full exchange functionality using test funds. Gemini has an automated system that makes trades on the exchange to simulate normal exchange activity all funds are for testing purposes only, no deposits or withdrawals hourly auctions Sandbox URLs Website https: Payload The payload of the requests will be a JSON object, which will be described in the documentation below.
If you try to access an endpoint that requires a role you did not assign to your API key, you will get back a response with: Endpoint URI Trader can access? Fund Manager can access? Visibility Your client order ids are only visible to the Gemini exchange and you.
Uniqueness Gemini recommends that your client order IDs should be unique per trading session. The contents will be a series of digits, followed by an optional decimal point and additional digits.
This is usually provided for compatibility; implementors should use the more precise timestampms when available. This will be transmitted as a JSON number, not a string. Each element contains a payload that will be described. Timestamps The timestamp data type describes a date and time as a whole number in Unix Time format, as the number of seconds or milliseconds since UTC. Requests When timestamp is supplied as a request parameter, the following two values are supported in order of preference: Responses In a JSON response, the key timestamp denotes the number of seconds since UTC timestampms denotes the number of milliseconds since UTC For backwards compatibility, some but not all timestamp values will be supplied in seconds.
WebSocket connection is established Optional: If you see a gap in this sequence number, then you should disconnect and reconnect. Each time you reconnect, the sequence number resets to zero.
If you have multiple WebSocket connections, each will have a separate sequence number beginning with zero - make sure to keep track of each sequence number separately! Order Events Order events is a private API that gives you information about your orders in real time. Then in real time you'll get information about order events like: Event Types Entry Type Can be filtered?
Each active order will have the initial event type. You only see this event type at the beginning of each subscription. An order which cannot be accepted for initial processing receives a rejected event. When placing a hidden order type, such as an auction-only order or an indication of interest for block trading When your order is completely filled after being accepted When your order is accepted for initial processing but then immediately cancelled because some condition cannot be fulfilled for instance, if you submit a maker-or-cancel order but your order would cross fill Y When an order is filled.
Reasons this might happen include: The order cannot be found You're trying to cancel an auction-only order after the last simulation closed Y The last event in the order lifecycle: Workflow Client submits order to Gemini exchange Is the order accepted? Yes, order is accepted Gemini sends an accepted order event Gemini sends zero or more initial fill events Does the order have non-zero remaining quantity? Yes, the order has non-zero remaining quantity Gemini sends a booked event the order rests until client sends a cancel request Is the order cancelled?
The order continues to rest on the books a trade executes, partially or completely filling the order Gemini sends a fill event with details about the trade, including remaining quantity Is the order completely filled?
See Client Order ID for more information. How Filtering Works Filtering is completely optional. You can filter on any combination of the following criteria: To provide a list of arguments, repeat the parameter once for each argument you want to provide: If you wanted to create a dropcopy-like event feed, to see order fills for all orders associated with your account on all symbols, connect using: The customer requesting the cross-connect is known as the "A-side". After connecting and logging on, the client can either request a security list or subscribe to market data.
Gemini does not resend messages on a market data channel. Gemini offers a security list that supplies the definitive list of symbols traded on the exchange. When a client disconnects for any reason, the market data subscription is terminated. The following security symbols are valid values for a Symbol field. Quantity and price on incoming orders are strictly held to the minimums and increments on the table shown above. However, once on the exchange, quantities and notional values may exhibit additional precision down to two decimal places past the "minimum order increment" listed above.
For instance, it is possible that a btcusd trade could execute for a quantity of 0. This is due to:. Client supplied FIX identifier field values must contain between at least one and up to one hundred allowed characters. Client supplied identifier values should match against this PCRE regular expression: The Standard Header is required on every message. PossResend is not supported. The client should assume that any events that the server requests to be replayed have not been acted upon: The Standard Trailer is required on every message.
Gemini runs the server side of the FIX connection "acceptor". Gemini never resets sequence numbers on the server side during the logon workflow unless the client explicitly requests it. Gemini recommends that client consider configuring the FIX initiator to automatically reset sequence numbers under the following conditions:. The resend request is sent by the receiving application to initiate the retransmission of messages. This function is utilized if a sequence number gap is detected, if the receiving application lost a message, or as a function of the initialization process.
The resend request can be used to request a single message, a range of messages or all messages subsequent to a particular message. This latter approach is strongly recommended to recover from out of sequence conditions as it allows for faster recovery in the presence of certain race conditions when both sides are simultaneously attempting to recover a gap.
A reject is typically a serious error in the trading application's session logic. Auctions for more information. This signifies an indicative auction event. This signifies a final auction event.
Introduction These are the messages that can be sent and received for market data. Gemini supports the following network connectivity choices: See the Gemini Fee Schedule for more information. Gemini reserves the right to charge for one-time setup and monthly recurring fees incurred connecting Members or extranets. Extranet Currently Perseus Telecom is an approved vendor, we are working hard to broaden the choices for you on this option. See the Gemini Fee schedule for more information.
Contact your Carrier of choice to arrange connectivity to Gemini. The following information will be required in order to establish a connection: