NAV

Gemini Clearing™

Gemini Clearing allows two parties to settle a trade off the order book. The initiator enters the trade details for any supported symbol and generates a clearing_id (OrderID <37>). If a counterparty_id is supplied, only the specified counterparty can confirm the order. If a counterparty_id is not supplied, then Gemini will generate a clearing_id (OrderID <37>) that can filled by any counterparty.

Workflow

Bilateral Trade

  1. Initiator places a clearing order with the order details
  2. Did the initiator use a counterparty_id?
    • Yes, only the Gemini account associated with the counterparty_id will be able to complete the order.
    • No, anybody with the clearing_id will be able to confirm the order.
  3. The counterparty will be able to confirm the order on the web interface, via FIX, or via REST
    • The order initiator can cancel the order if the counterparty has not yet confirmed. Cancellation can be performed on the web interface, via FIX, and REST.
  4. Once confirmed, Gemini will attempt settlement. Settlement can only occur when both parties have the funds required in their account to fill the trade.
    • If any party does not post the funds required to settle the trade before the expiration time, then the order will expire.

Broker Trade

  1. The broker submits a clearing order with the order details and both counterparty_ids of the buyer and seller.
  2. The buyer and seller can both review the trade details and confirm the order on the web interface, via FIX, or via REST
    • Either side can cancel the trade if both the buyer and seller have yet to confirm the order. Cancellation can be done via the web interface, FIX, and REST
    • The broker will be able to see the status of the order on the web interface and over the /v1/clearing/status endpoint on the REST API
  3. Once confirmed, Gemini will attempt settlement. Settlement can only occur when both parties have the funds required in their account to fill the trade.
    • If any party does not post the funds required to settle the trade before the expiration time, then the order will expire.

Initiator enters order

The initiator of the order places an order with the following details:

The clearing order will remain awaiting confirmation until the order is confirmed by a counterparty or the expiration time passes. The initiator does not have to have to requisite funds in their account to initiate an order but will need to post the funds before expiration for the trade to settle.

Broker enters order

The broker of the trade places an order with the following details

Order Confirmation

A counterparty can confirm the order on the web interface, sending a POST to https://api.gemini.com/v1/clearing/confirm, or sending a New Order Cross <s> via a FIX order entry session. The counterparty can confirm the order without having the funds needed to fill the order, but will need to post the funds for the trade to settle.

Confirmation via REST and FIX requires the following details to match the initiator's order:

Settlement

After the counterparty confirms the order, the system will attempt to settle the funds. Each party has until the exipiration time to post the required funds to settle the order. If either party does not post the funds to settle the order before the expiration, then the order will expire.

After settlement occurs, the order will show in transaction history.

Cancellation

In a bilateral trade the initiator can cancel the order before it is confirmed. In a broker trade, either counterparty may cancel the trade before it is confirmed by both sides. Cancellation can be done using the web interface, sending a POST to https://api.gemini.com/v1/clearing/cancel, or sending a Cross Order Cancel Request <u>.

Cancellation via REST only requires the clearing_id and FIX requires the following details:

Testing

Gemini Clearing is available in our sandbox environment. Start by creating a sandbox account.

Email trading@gemini.com to coordinate a testing session to go over the Gemini Clearing workflow.

Symbols and minimums

Symbols are formatted as CCY1CCY2 where prices are in CCY2 and quantities are in CCY1. CCY1 is in the Currency column and CCY2 is in the respective CCY2 Price Increment column:

Symbol Minimum Order Size Tick Size Quote Currency Price Increment
btcusd 0.00001 BTC (1e-5) 0.00000001 BTC (1e-8) 0.01 USD
btceur 0.00001 BTC (1e-5) 0.00000001 BTC (1e-8) 0.01 EUR
btcgbp 0.00001 BTC (1e-5) 0.00000001 BTC (1e-8) 0.01 GBP
btcsgd 0.00001 BTC (1e-5) 0.00000001 BTC (1e-8) 0.01 SGD
ethbtc 0.001 ETH (1e-3) 0.000001 ETH (1e-6) 0.00001 BTC (1e-5)
ethusd 0.001 ETH (1e-3) 0.000001 ETH (1e-6) 0.01 USD
etheur 0.001 ETH (1e-3) 0.000001 ETH (1e-6) 0.01 EUR
ethgbp 0.001 ETH (1e-3) 0.000001 ETH (1e-6) 0.01 GBP
ethsgd 0.001 ETH (1e-3) 0.000001 ETH (1e-6) 0.01 SGD
bchusd 0.001 BCH (1e-3) 0.000001 BCH (1e-6) 0.01 USD
bchbtc 0.001 BCH (1e-3) 0.000001 BCH (1e-6) 0.00001 BTC (1e-5)
bcheth 0.001 BCH (1e-3) 0.000001 BCH (1e-6) 0.0001 ETH (1e-4)
ltcusd 0.01 LTC (1e-2) 0.00001 LTC (1e-5) 0.01 USD
ltcbtc 0.01 LTC (1e-2) 0.00001 LTC (1e-5) 0.0000001 BTC (1e-7)
ltceth 0.01 LTC (1e-2) 0.00001 LTC (1e-5) 0.00001 ETH (1e-5)
ltcbch 0.01 LTC (1e-2) 0.00001 LTC (1e-5) 0.0001 BCH (1e-4)
batusd 1.0 BAT (1e0) 0.000001 BAT (1e-6) 0.00001 USD (1e-5)
daiusd 0.1 DAI (1e-1) 0.000001 DAI (1e-6) 0.00001 USD (1e-5)
linkusd 0.1 LINK (1e-1) 0.000001 LINK (1e-6) 0.00001 USD (1e-5)
oxtusd 1.0 OXT (1e0) 0.000001 OXT (1e-6) 0.00001 USD (1e-5)
linkbtc 0.1 LINK (1e-1) 0.000001 LINK (1e-6) 0.00000001 BTC (1e-8)
linketh 0.1 LINK (1e-1) 0.000001 LINK (1e-6) 0.0000001 ETH (1e-7)
ampusd 10.0 AMP (1e1) 0.000001 AMP (1e-6) 0.00001 USD (1e-5)
compusd 0.001 COMP (1e-3) 0.000001 COMP (1e-6) 0.01 USD
paxgusd 0.0001 PAXG (1e-4) 0.00000001 PAXG (1e-8) 0.01 USD
mkrusd 0.001 MKR (1e-3) 0.000001 MKR (1e-6) 0.01 USD
zrxusd 0.1 ZRX (1e-1) 0.000001 ZRX (1e-6) 0.00001 USD (1e-5)
kncusd 0.1 KNC (1e-1) 0.000001 KNC (1e-6) 0.00001 USD (1e-5)
manausd 1.0 MANA (1e0) 0.000001 MANA (1e-6) 0.00001 USD (1e-5)
storjusd 0.1 STORJ (1e-1) 0.000001 STORJ (1e-6) 0.00001 USD (1e-5)
snxusd 0.01 SNX (1e-2) 0.000001 SNX (1e-6) 0.0001 USD (1e-4)
crvusd 0.1 CRV (1e-1) 0.000001 CRV (1e-6) 0.0001 USD (1e-4)
balusd 0.01 BAL (1e-2) 0.000001 BAL (1e-6) 0.0001 USD (1e-4)
uniusd 0.01 UNI (1e-2) 0.000001 UNI (1e-6) 0.0001 USD (1e-4)
renusd 0.01 REN (1e-2) 0.000001 REN (1e-6) 0.00001 USD (1e-5)
umausd 0.01 UMA (1e-2) 0.000001 UMA (1e-6) 0.0001 USD (1e-4)
yfiusd 0.00001 YFI (1e-5) 0.000001 YFI (1e-6) 0.01 USD
aaveusd 0.001 AAVE (1e-3) 0.000001 AAVE (1e-6) 0.0001 USD (1e-4)
filusd 0.1 FIL (1e-1) 0.000001 FIL (1e-6) 0.0001 USD (1e-4)
sklusd 0.1 SKL (1e-1) 0.000001 SKL (1e-6) 0.00001 USD (1e-5)
grtusd 0.1 GRT (1e-1) 0.000001 GRT (1e-6) 0.0001 USD (1e-4)
bntusd 0.01 BNT (1e-2) 0.000001 BNT (1e-6) 0.0001 USD (1e-4)
1inchusd 0.01 1INCH (1e-2) 0.000001 1INCH (1e-6) 0.0001 USD (1e-4)
lrcusd 0.1 LRC (1e-1) 0.000001 LRC (1e-6) 0.00001 USD (1e-5)
sandusd 0.1 SAND (1e-1) 0.000001 SAND (1e-6) 0.00001 USD (1e-5)
cubeusd 0.01 CUBE (1e-2) 0.000001 CUBE (1e-6) 0.0001 USD (1e-4)
lptusd 0.001 LPT (1e-3) 0.000001 LPT (1e-6) 0.0001 USD (1e-4)
bondusd 0.001 BOND (1e-3) 0.000001 BOND (1e-6) 0.0001 USD (1e-4)
maticusd 0.1 MATIC (1e-1) 0.000001 MATIC (1e-6) 0.00001 USD (1e-5)
injusd 0.01 INJ (1e-2) 0.000001 INJ (1e-6) 0.0001 USD (1e-4)
sushiusd 0.01 SUSHI (1e-2) 0.000001 SUSHI (1e-6) 0.0001 USD (1e-4)
dogeusd 0.1 DOGE (1e-1) 0.000001 DOGE (1e-6) 0.00001 USD (1e-5)
alcxusd 0.00001 ALCX (1e-5) 0.000001 ALCX (1e-6) 0.01 USD (1e-2)
ftmusd 0.03 FTM (3e-2) 0.000001 FTM (1e-6) 0.0001 USD (1e-4)
ankrusd 0.1 ANKR (1e-1) 0.000001 ANKR (1e-6) 0.00001 USD (1e-5)
btcgusd 0.00001 BTC (1e-5) 0.00000001 BTC (1e-8) 0.01 GUSD
ethgusd 0.001 ETH (1e-3) 0.000001 ETH (1e-6) 0.01 GUSD
ctxusd 0.002 CTX (2e-3) 0.000001 CTX (1e-6) 0.0001 USD (1e-4)
xtzusd 0.02 XTZ (2e-2) 0.000001 XTZ (1e-6) 0.0001 USD (1e-4)
axsusd 0.003 AXS (3e-3) 0.000001 AXS (1e-6) 0.01 USD (1e-2)
slpusd 0.5 SLP (5e-1) 0.000001 SLP (1e-6) 0.0000001 USD (1e-7)
lunausd 1 LUNA (1e0) 0.000001 LUNA (1e-6) 0.00000001 USD (1e-8)
mco2usd 0.02 MCO2 (2e-2) 0.000001 MCO2 (1e-6) 0.001 USD (1e-3)
dogebtc 1.0 DOGE (1e0) 0.00000001 DOGE (1e-8) 0.000000001 BTC (1e-9)
dogeeth 1.0 DOGE (1e0) 0.00000001 DOGE (1e-8) 0.00000001 ETH (1e-8)
wcfgusd 0.05 WCFG (5e-2) 0.000001 WCFG (1e-6) 0.00001 USD (1e-5)
rareusd 0.1 RARE (1e-1) 0.000001 RARE (1e-6) 0.001 USD (1e-3)
radusd 0.01 RAD (1e-2) 0.000001 RAD (1e-6) 0.001 USD (1e-3)
qntusd 0.0004 QNT (4e-4) 0.000001 QNT (1e-6) 0.01 USD (1e-2)
nmrusd 0.003 NMR (3e-3) 0.000001 NMR (1e-6) 0.001 USD (1e-3)
maskusd 0.01 MASK (1e-2) 0.000001 MASK (1e-6) 0.001 USD (1e-3)
fetusd 0.1 FET (1e-1) 0.000001 FET (1e-6) 0.00001 USD (1e-5)
ashusd 0.005 ASH (5e-3) 0.000001 ASH (1e-6) 0.001 USD (1e-3)
audiousd 0.05 AUDIO (5e-2) 0.000001 AUDIO (1e-6) 0.00001 USD (1e-5)
api3usd 0.03 API3 (3e-2) 0.000001 API3 (1e-6) 0.001 USD (1e-3)
usdcusd 0.1 USDC (1e-1) 0.000001 USDC (1e-6) 0.00001 USD (1e-5)
shibusd 1000.0 SHIB (1e3) 0.000001 SHIB (1e-6) 0.000000001 USD (1e-9)
rndrusd 0.02 RNDR (2e-2) 0.000001 RNDR (1e-6) 0.001 USD (1e-3)
galausd 0.4 GALA (4e-1) 0.000001 GALA (1e-6) 0.00001 USD (1e-5)
ensusd 0.002 ENS (2e-3) 0.000001 ENS (1e-6) 0.001 USD (1e-3)
kp3rusd 0.0001 KP3R (1e-4) 0.000001 KP3R (1e-6) 0.01 USD (1e-2)
cvcusd 0.2 CVC (2e-1) 0.000001 CVC (1e-6) 0.00001 USD (1e-5)
elonusd 60000.0 ELON (6e4) 0.000001 ELON (1e-6) 0.00000000001 USD (1e-11)
mimusd 0.1 MIM (1e-1) 0.000001 MIM (1e-6) 0.0001 USD (1e-4)
spellusd 5.0 SPELL (5e0) 0.000001 SPELL (1e-6) 0.0000001 USD (1e-7)
tokeusd 0.002 TOKE (2e-3) 0.000001 TOKE (1e-6) 0.001 USD (1e-3)
ldousd 0.02 LDO (2e-2) 0.000001 LDO (1e-6) 0.001 USD (1e-3)
rlyusd 0.2 RLY (2e-1) 0.000001 RLY (1e-6) 0.00001 USD (1e-5)
solusd 0.001 SOL (1e-3) 0.000001 SOL (1e-6) 0.001 USD (1e-3)
rayusd 0.03 RAY (3e-2) 0.000001 RAY (1e-6) 0.001 USD (1e-3)
sbrusd 1.0 SBR (1e0) 0.000001 SBR (1e-6) 0.000001 USD (1e-6)
apeusd 0.02 APE (2e-2) 0.000001 APE (1e-6) 0.001 USD (1e-3)
dpiusd 0.0006 DPI (6e-4) 0.000001 DPI (1e-6) 0.01 USD (1e-2)
indexusd 0.02 INDEX (2e-2) 0.000001 INDEX (1e-6) 0.001 USD (1e-3)
gusdsgd 0.1 GUSD 0.000001 GUSD (1e-6) 0.001 SGD (1e-3)
qrdousd 0.04 QRDO (4e-2) 0.000001 QRDO (1e-6) 0.00001 USD (1e-5)
zbcusd 3.0 ZBC (3e0) 0.000001 ZBC (1e-6) 0.00001 USD (1e-5)
chzusd 0.5 CHZ (5e-1) 0.000001 CHZ (1e-6) 0.00001 USD (1e-5)
revvusd 1.0 REVV (1e0) 0.000001 REVV (1e-6) 0.00001 USD (1e-5)
jamusd 10.0 JAM (1e1) 0.000001 JAM (1e-6) 0.0000001 USD (1e-7)
fidausd 0.06 FIDA (6e-2) 0.000001 FIDA (1e-6) 0.00001 USD (1e-5)
gmtusd 0.1 GMT (1e-1) 0.000001 GMT (1e-6) 0.00001 USD (1e-5)
orcausd 0.05 ORCA (5e-2) 0.000001 ORCA (1e-6) 0.001 USD (1e-3)
aliusd 2.0 ALI (2e0) 0.000001 ALI (1e-6) 0.000001 USD (1e-6)
truusd 0.8 TRU (8e-1) 0.000001 TRU (1e-6) 0.00001 USD (1e-5)
gusdgbp 0.1 GUSD (1e-1) 0.0001 GUSD (1e-4) 0.001 GBP (1e-3)
dotusd 0.01 DOT (1e-2) 0.000001 DOT (1e-6) 0.0001 USD (1e-4)
ernusd 0.05 ERN (5e-2) 0.000001 ERN (1e-6) 0.0001 USD (1e-4)
galusd 0.04 GAL (4e-2) 0.000001 GAL (1e-6) 0.0001 USD (1e-4)
eulusd 0.03 EUL (3e-2) 0.000001 EUL (1e-6) 0.0001 USD (1e-4)
samousd 10.0 SAMO (1e+1) 0.000001 SAMO (1e-6) 0.0000001 USD (1e-7)
bicousd 0.2 BICO (2e-1) 0.000001 BICO (1e-6) 0.00001 USD (1e-5)
imxusd 0.1 IMX (1e-1) 0.000001 IMX (1e-6) 0.00001 USD (1e-5)
plausd 0.3 PLA (3e-1) 0.000001 PLA (1e-6) 0.00001 USD (1e-5)
iotxusd 3.0 IOTX (3e+0) 0.000001 IOTX (1e-6) 0.000001 USD (1e-6)
avaxusd 0.005 AVAX (5e-3) 0.000001 AVAX (1e-6) 0.001 USD (1e-3)
atomusd 0.01 ATOM (1e-2) 0.000001 ATOM (1e-6) 0.001 USD (1e-3)
usdtusd* 0.1 USDT (1e-1) 0.000001 USDT (1e-6) 0.0001 USD (1e-4)
btcusdt* 0.00001 BTC (1e-5) 0.00000001 BTC (1e-8) 0.01 USDT (1e-2)
ethusdt* 0.001 ETH (1e-3) 0.000001 ETH (1e-6) 0.01 USDT (1e-2)
pepeusd 1000 PEPE (1e3) 0.000001 PEPE (1e-6) 0.000000001 USD (1e-9)
xrpusd 0.1 XRP (1e-1) 0.000001 XRP (1e-6) 0.00001 USD (1e-5)
hntusd 0.04 HNT (4e-1) 0.000001 HNT (1e-6) 0.0001 USD (1e-4)
wifusd 0.07 WIF (7e-2) 0.000001 WIF (1e-6) 0.0001 USD (1e-4)

*Note: Not available to trade for customers in New York

All Supported Symbols

btcusd ethbtc ethusd bchusd bchbtc bcheth ltcusd ltcbtc ltceth ltcbch batusd daiusd linkusd oxtusd linkbtc linketh ampusd compusd paxgusd mkrusd zrxusd kncusd manausd storjusd snxusd crvusd balusd uniusd renusd umausd yfiusd aaveusd filusd btceur btcgbp etheur ethgbp btcsgd ethsgd sklusd grtusd bntusd 1inchusd lrcusd sandusd cubeusd lptusd bondusd maticusd injusd sushiusd dogeusd alcxusd ftmusd ankrusd btcgusd ethgusd ctxusd xtzusd axsusd slpusd lunausd mco2usd dogebtc dogeeth wcfgusd rareusd radusd qntusd nmrusd maskusd fetusd ashusd audiousd api3usd usdcusd shibusd rndrusd galausd ensusd kp3rusd cvcusd elonusd mimusd spellusd tokeusd ldousd rlyusd solusd rayusd sbrusd apeusd dpiusd indexusd gusdsgd qrdousd zbcusd chzusd revvusd jamusd fidausd gmtusd orcausd aliusd truusd gusdgbp dotusd ernusd galusd eulusd samousd bicousd imxusd plausd iotxusd avaxusd atomusd usdtusd btcusdt ethusdt pepeusd xrpusd hntusd wifusd

FIX

Initiate a Clearing Order

New Order Cross

To submit a new Gemini Clearing order, send a New Order Cross <s> message with OrdType <40> as type Limit.

Gemini will respond to a New Order Cross <s> with an Execution Report <8>. The Execution Report <8> will have OrderID <37> populated with the clearing_id which the counterparty will need to confirm the order.

RAW
8=FIX.4.4|9=204|35=s|34=2|49=TESTOE001|52=20190807-19:28:38.078|56=GEMINI|40=2|44=12000|55=BTCUSD|60=20190807-19:28:38.078|126=20190807-21:28:38.078|548=26990504|549=1|550=0|552=1|54=1|11=87749738|38=2.22222|10=023|

HEADER
        8                   BeginString: FIX.4.4
        9                    BodyLength: 204
        35                      MsgType: NewOrderCross (s)
        34                    MsgSeqNum: 2
        49                 SenderCompID: TESTOE001
        52                  SendingTime: 20190807-19:28:38.078
        56                 TargetCompID: GEMINI
BODY
        40                      OrdType: LIMIT (2)
        44                        Price: 12000
        55                       Symbol: BTCUSD
        60                 TransactTime: 20190807-19:28:38.078
        126                  ExpireTime: 20190807-21:28:38.078
        548                     CrossID: 26990504
        549                   CrossType: Cross trade which is either completely executed or not executed at all (1)
        550         CrossPrioritization: No priority (0)
        552                     NoSides: One Side (1)
        54                         Side: BUY (1)
        11                      ClOrdID: 87749738
        38                       OrderQty: 2.22222
TRAILER
        10                     CheckSum: 023

New Order Cross Execution Report <8>

RAW
8=FIX.4.4|9=197|35=8|34=2|49=GEMINI|52=20190807-19:28:38.251|56=TESTOE001|6=12000|11=87749738|14=2.22222|17=1565206118250|37=2DZ4MPQM|39=0|44=12000|54=1|55=BTCUSD|60=20190807-19:28:38.250|150=0|151=2.22222|10=009|

HEADER
        8                   BeginString: FIX.4.4
        9                    BodyLength: 197
        35                      MsgType: ExecutionReport (8)
        34                    MsgSeqNum: 2
        49                 SenderCompID: GEMINI
        52                  SendingTime: 20190807-19:28:38.251
        56                 TargetCompID: TESTOE001
BODY
        6                         AvgPx: 12000
        11                      ClOrdID: 87749738
        14                       CumQty: 2.22222
        17                       ExecID: 1565206118250
        37                      OrderID: 2DZ4MPQM
        39                    OrdStatus: NEW (0)
        44                        Price: 12000
        54                         Side: BUY (1)
        55                       Symbol: BTCUSD
        60                 TransactTime: 20190807-19:28:38.250
        150                    ExecType: NEW (0)
        151                   LeavesQty: 2.22222
TRAILER
        10                     CheckSum: 009

Clearing Order Confirmation

New Order Cross Confirmation

To confirm a Gemini Clearing order, the counterparty must login and confirm the order. The order must be confirmed with the same details provided in the initial order.

Gemini will respond to a New Order Cross <s> with an Execution Report <8>.

RAW
8=FIX.4.4|9=191|35=s|34=2|49=TESTOE002|52=20190806-18:49:03.689|56=GEMINI|40=2|44=12000|55=btcusd|60=20190806-18:49:03.689|117=4KZ306ZG|548=86478800|549=1|550=0|552=1|54=2|11=46081666|38=2.22222|10=103|

HEADER
        8                   BeginString: FIX.4.4
        9                    BodyLength: 191
        35                      MsgType: NewOrderCross (s)
        34                    MsgSeqNum: 2
        49                 SenderCompID: TESTOE002
        52                  SendingTime: 20190806-18:49:03.689
        56                 TargetCompID: GEMINI
BODY
        40                      OrdType: LIMIT (2)
        44                        Price: 12000
        55                       Symbol: BTCUSD
        60                 TransactTime: 20190806-18:49:03.689
        117                     QuoteID: 2DZ4MPQM
        548                     CrossID: 86478800
        549                   CrossType: 1
        550         CrossPrioritization: 0
        552             Number of sides: 1
        54                         Side: SELL (2)
        11                      ClOrdID: 46081666
        38                       OrderQty: 2.22222
TRAILER
        10                     CheckSum: 103

New Order Cross Confirmation Execution Report <8>

See Execution Report <8> for more details on execution report tags.

RAW
8=FIX.4.4|9=205|35=8|34=2|49=GEMINI|52=20190806-18:49:03.839|56=TESTOE002|6=12000|11=46081666|14=2.22222|17=1565117343839|37=4KZ306ZG|39=0|44=12000|54=2|55=BTCUSD|58=ORDER_CONFIRMED|60=20190806-18:49:03.839|150=0|151=2.22222|10=057|

HEADER
        8                   BeginString: FIX.4.4
        9                    BodyLength: 205
        35                      MsgType: ExecutionReport (8)
        34                    MsgSeqNum: 2
        49                 SenderCompID: GEMINI
        52                  SendingTime: 20190806-18:49:03.839
        56                 TargetCompID: TESTOE002
BODY
        6                         AvgPx: 12000
        11                      ClOrdID: 46081666
        14                       CumQty: 2.22222
        17                       ExecID: 1565117343839
        37                      OrderID: 4KZ306ZG
        39                    OrdStatus: New (0)
        44                        Price: 12000
        54                         Side: SELL (2)
        55                       Symbol: BTCUSD
        58                         Text: ORDER_CONFIRMED
        60                 TransactTime: 20190806-18:49:03.839
        150                    ExecType: NEW (0)
        151                 LeavesQty: 2.22222
TRAILER
        10 CheckSum: 057

Clearing Order Cancellation

Cross Order Cancel Request

Once an initiator places a New Order Cross, a Cross Order Cancellation Request<35=u> can be placed to cancel the order before it is confirmed by the counterparty. If the order has already been confirmed by the counterparty, it can no longer be cancelled.

RAW
8=FIX.4.4|9=201|34=3|35=u|49=TESTOE001|52=20190806-20:30:28.898|56=GEMINI|37=2DZ4MPQM|55=BTCUSD|60=20190806-20:30:28.898|548=73180000|549=1|550=0|551=26990504|552=1|54=2|41=87749738|11=76494933|38=2.22222|10=128|

HEADER
        8                   BeginString: FIX.4.4
        9                    BodyLength: 201
        34                    MsgSeqNum: 3
        35                      MsgType: Cross Order Cancel Request
        49                 SenderCompID: TESTOE001
        52                  SendingTime: 20190806-20:30:28.898
        56                 TargetCompID: GEMINI
BODY
        37                      OrderID: 2DZ4MPQM
        55                       Symbol: BTCUSD
        60                 TransactTime: 20190806-20:30:28.898
        548                     CrossID: 73180000
        549                   CrossType: 1
        550         CrossPrioritization: 0
        551                 OrigCrossID: 26990504
        552                     NoSides: 1
        54                         Side: SELL (2)
        41                  OrigClOrdID: 87749738
        11                      ClOrdID: 76494933
        38                       OrderQty: 2.22222
TRAILER
        10                     CheckSum: 066

Cross Order Cancel Request Execution Report

RAW
8=FIX.4.4|9=202|35=8|34=3|49=GEMINI|52=20190806-20:30:28.947|56=TESTOE001|6=0|11=76494933|14=2.22222|17=1565123428947|37=2DZ4MPQM|39=4|54=2|55=BTCUSD|58=ORDER_CANCELED|60=20190806-20:30:28.947|150=4|151=2.22222|10=127|

HEADER
        8                   BeginString: FIX.4.4
        9                    BodyLength: 202
        35                      MsgType: ExecutionReport (8)
        34                    MsgSeqNum: 3
        49                 SenderCompId: GEMINI
        52                  SendingTime: 20190806-20:30:28.947
        56                 TargetCompID: TESTOE001
BODY
        6                         AvgPx: 0
        11                      ClOrdID: 76494933
        14                       CumQty: 2.22222
        17                       ExecID: 1565123428947
        37                      OrderID: 2DZ4MPQM
        39                    OrdStatus: CANCELED (4)
        54                         Side: SELL (2)
        55                       Symbol: BTCUSD
        58                         Text: ORDER_CANCELLED
        60                 TransactTime: 20190806-20:30:28.947
        150                    ExecType: CANCELED (4)
        151                   LeavesQty: 2.22222
TRAILER
        10                     CheckSum: 127

FIX Broker Support

Gemini Clearing also allows for brokers to facilitate trades between two Gemini customers. A broker can submit a new Gemini Clearing order that must then be confirmed by each counterparty before settlement.

Broker New Order Cross

RAW
8=FIX.4.4|9=247|35=s|34=2|49=TESTOE001|52=20190905-13:29:45.762|56=GEMINI|40=2|44=10000|55=btcusd|60=20190905-13:29:45.762|548=49382061|549=1|550=0|552=2|54=1|11=63216195|583=R485E04Q|38=25.01|54=2|11=44996792|583=7467JVXP|38=25.01|126=20190905-15:29:45.762|10=236|

HEADER
        8                   BeginString: FIX.4.4
        9                    BodyLength: 247
        35                      MsgType: NewOrderCross (s)
        34                    MsgSeqNum: 2
        49                 SenderCompID: TESTOE001
        52                  SendingTime: 20190905-13:29:45.762
        56                 TargetCompID: GEMINI
BODY
        40                      OrdType: LIMIT (2)
        44                        Price: 10000
        55                       Symbol: BTCUSD
        60                 TransactTime: 20190905-13:29:45.762
        548                     CrossID: 49382061
        549                   CrossType: Cross trade which is either completely executed or not executed at all (1)
        550         CrossPrioritization: No priority (0)
        552                     NoSides: Two Sides (2)
        126                  ExpireTime: 20190905-15:29:45.762
REPEATING GROUPS
        54                         Side: BUY (1)
        11                      ClOrdID: 63216195
        583                 ClOrdLinkID: R485E04Q
        38                     OrderQty: 25.01
        54                         Side: SELL (2)
        11                      ClOrdID: 44996792
        583                 ClOrdLinkID: 7467JVXP
        38                     OrderQty: 25.01
TRAILER
        10                     CheckSum: 236

Broker New Order Cross Execution Report

After submitting a new order cross as a broker, 2 execution reports will be sent (one for each side of the trade).

RAW
8=FIX.4.4|9=211|35=8|34=2|49=GEMINI|52=20190905-13:29:45.928|56=TESTOE001|6=10000|11=63216195|14=25.01|17=1567690185928|37=G9LVQOX5|39=0|44=10000|54=1|55=btcusd|60=20190905-13:29:45.928|150=0|151=25.01|583=R485E04Q|10=239|
8=FIX.4.4|9=211|35=8|34=3|49=GEMINI|52=20190905-13:29:45.929|56=TESTOE001|6=10000|11=44996792|14=25.01|17=1567690185928|37=G9LVQOX5|39=0|44=10000|54=2|55=btcusd|60=20190905-13:29:45.928|150=0|151=25.01|583=7467JVXP|10=054|

HEADER
        8                   BeginString: FIX.4.4
        9                    BodyLength: 211
        35                      MsgType: ExecutionReport (8)
        34                    MsgSeqNum: 2
        49                 SenderCompID: GEMINI
        52                  SendingTime: 20190905-13:29:45.928
        56                 TargetCompID: TESTOE001
BODY
        6                         AvgPx: 10000
        11                      ClOrdID: 63216195
        14                       CumQty: 25.01
        17                       ExecID: 1567690185928
        37                      OrderID: G9LVQOX5
        39                    OrdStatus: NEW (0)
        44                        Price: 10000
        54                         Side: BUY (1)
        55                       Symbol: BTCUSD
        60                 TransactTime: 20190905-13:29:45.928
        150                    ExecType: NEW (0)
        151                   LeavesQty: 25.01
        583                 ClOrdLinkID: Clearing ID for corresponding Gemini account (R485E04Q)
Trailer
        10                     CheckSum: 239

HEADER
        8                   BeginString: FIX.4.4
        9                    BodyLength: 211
        35                      MsgType: ExecutionReport (8)
        34                    MsgSeqNum: 3
        49                 SenderCompID: GEMINI
        52                  SendingTime: 20190905-13:29:45.929
        56                 TargetCompID: TESTOE001
BODY
        6                         AvgPx: 10000
        11                      ClOrdID: 44996792
        14                       CumQty: 25.01
        17                       ExecID: 1567690185928
        37                      OrderID: G9LVQOX5
        39                    OrdStatus: NEW (0)
        44                        Price: 10000
        54                         Side: SELL (2)
        55                       Symbol: BTCUSD
        60                 TransactTime: 20190905-13:29:45.928
        150                    ExecType: NEW (0)
        151                   LeavesQty: 25.01
        583                 ClOrdLinkID: Clearing ID for corresponding Gemini account (7467JVXP)
Trailer
        10                     CheckSum: 054

REST API

Gemini Clearing allows two parties to settle a trade off the order book. The initiator enters the trade details for any supported symbol and generates a trade_id. If a counterparty_id is supplied, only the specified counterparty can confirm the order. If a counterparty_id is not supplied, the ticket will generate a trade_id that can filled by any counterparty.

New Clearing Order

Roles

The API key you use to access this endpoint must have the Trader role assigned. See Roles for more information. You can also retrieve the clearing counterparty ID associated with the API key by posting a request to either the roles or account/list endpoints.

The OAuth scope must have clearing:create assigned to access /v1/clearing/new, /v1/clearing/cancel and /v1/clearing/confirm. The OAuth scope must have clearing:read to access /v1/clearing/status. See OAuth Scopes for more information.

HTTP Request

POST https://api.gemini.com/v1/clearing/new

Sandbox

Base url can be changed to https://api.sandbox.gemini.com for test purposes. Please reach out to trading@gemini.com to enable Gemini Clearing on your sandbox account and test workflows.

Parameters

Parameter Type Description
request string The literal string "/v1/clearing/new"
nonce integer The nonce, as described in Private API Invocation
counterparty_id string An optional symbol that corresponds with a counterparty to which you are directing the trade. Can be retrieved from roles or account/list endpoints.
expires_in_hrs integer The number of hours before the trade expires. Your counterparty will need to confirm the order before this time expires.
symbol string The symbol of the order
amount string Quoted decimal amount to purchase
price string Quoted decimal amount to spend per unit
side string "buy" or "sell"

New Clearing Order example

import requests
import json
import base64
import hmac
import hashlib
import time

base_url = "https://api.gemini.com"
endpoint = "/v1/clearing/new"
url = base_url + endpoint

gemini_api_key = "mykey"
gemini_api_secret = "1234abcd".encode()
counterparty_id = "OM9VNL1G"
payload_nonce = time.time()

payload = {
    "request": endpoint,
    "nonce": payload_nonce,
    "counterparty_id": counterparty_id,
    "expires_in_hrs": 24,
    "symbol": "btcusd",
    "amount": "100",
    "price": "9500.00",
    "side": "buy"
}

encoded_payload = json.dumps(payload).encode()
b64 = base64.b64encode(encoded_payload)
signature = hmac.new(gemini_api_secret, b64, hashlib.sha384).hexdigest()

request_headers = { 'Content-Type': "text/plain",
                    'Content-Length': "0",
                    'X-GEMINI-APIKEY': gemini_api_key,
                    'X-GEMINI-PAYLOAD': b64,
                    'X-GEMINI-SIGNATURE': signature,
                    'Cache-Control': "no-cache" }

response = requests.post(url,
                        data=None,
                        headers=request_headers)

new_clearing_order = response.json()
print(new_clearing_order)

Sample payload

{
    "request": "v1/clearing/new",
    "nonce": <nonce>,
    "counterparty_id": "OM9VNL1G",
    "expires_in_hrs": 24,
    "symbol": "btcusd",
    "amount": "100",
    "price": "9500.00",
    "side": "buy"
}

JSON response

{
    "result": "AwaitConfirm",
    "clearing_id": "0OQGOZXW"
}

Response

The response will be an object

Field Type Description
result string A description of the status of the clearing order. Because this is the reponse to an order initiation the response will be AwaitConfirm upon order placement success. Failures will show a brief description of the error in this field or the reason and message fields.
clearing_id string A unique identifier for the clearing order. The clearing_id can be used to check the status of your order or by the counterparty to confirm the order.

New Broker Order

Gemini Clearing also allows for brokers to facilitate trades between two Gemini customers. A broker can submit a new Gemini Clearing order that must then be confirmed by each counterparty before settlement.

Sample payload for broker order initiation

{
    "request": "v1/clearing/broker/new",
    "nonce": <nonce>,
    "source_counterparty_id": "R485E04Q",
    "target_counterparty_id": "Z4929ZDY",
    "symbol": "ethusd",
    "amount": "175.00",
    "expires_in_hrs": 1.0,
    "price": "200",
    "side": "sell"
}

Parameters

Parameter Type Description
request string The literal string "v1/clearing/broker/new"
nonce integer The nonce, as described in Private API Invocation
source_counterparty_id string A symbol that corresponds with the counterparty sourcing the clearing trade
target_counterparty_id string A symbol that corresponds with the counterparty where the clearing trade is targeted
symbol string The symbol of the order
amount string Quoted decimal amount to purchase
expires_in_hrs integer The number of hours before the trade expires. Your counterparty will need to confirm the order before this time expires.
price string Quoted decimal amount to spend per unit
side string "buy" or "sell". This side will be assigned to the source_counterparty_id. The opposite side will be sent to the target_counterparty_id.

JSON response to broker clearing order

{
    "result": "AwaitSourceTargetConfirm",
    "clearing_id": "8EM7NVXD"
}

Response

The reponse will be an object

Field Type Description
result string Will return AwaitSourceTargetConfirm, meaning the order is waiting for both the source and the target parties to confirm the order
clearing_id string A unique identifier for the clearing order.

Clearing Order Status

HTTP Request

POST https://api.gemini.com/v1/clearing/status

Sample order cancel payload

{
    "request": "v1/clearing/status",
    "nonce": <nonce>,
    "clearing_id": "OM9VNL1G"
}

Parameters

Parameter Type Description
request string The literal string "v1/clearing/status"
nonce integer The nonce, as described in Private API Invocation
clearing_id string A unique identifier for the clearing order. The clearing_id can be used to check the status of, cancel or confirm the order.

JSON response for confirmed clearing order

{
    "result": "ok",
    "status": "Confirmed"
}

Response

The response will be an object

Field Type Description
result string Will return "ok"
status string A description of the status of the order give in the clearing_id field. See order status descriptions for more information

Order status description

Status Description
AwaitConfirm Indicates that a bilateral trade order has been successfully initiated but has not yet been confirmed by the counterparty
AwaitSourceTargetConfirm Indicates that a broker trade has been successfully initiated but has not yet been confirmed by the target nor source counterparty
AwaitTargetConfirm The source counterparty has confirmed the clearing order but the target counterparty has not yet confirmed
AwaitSourceConfirm The target counterparty has confirmed the clearing order but the source counterparty has not yet confirmed
Confirmed The counterparty has confirmed the clearing order but the trade has not attempted settlement yet.
AttemptSettlement The counterparty has not yet funded their account to the required amount to settle the trade.
Settled The order has been settled and the funds have successfully moved between accounts.
Expired The order expiration time has come before the counterparty confirmed the order or. If the counterparty did confirm the order, then they did not have enough funds to settle the order before the expiration time.
Canceled The order was canceled by the order initiator.
Not Found The clearing_id given in the payload was not successfully matched to a pending clearing order.

Cancel Clearing Order

HTTP Request

POST https://api.gemini.com/v1/clearing/cancel

Sample order cancel payload

{
    "request": "v1/clearing/cancel",
    "nonce": <nonce>,
    "clearing_id": "P0521QDV"
}

Parameters

Parameter Type Description
request string The literal string "v1/clearing/cancel"
nonce integer The nonce, as described in Private API Invocation
clearing_id string A unique identifier for the clearing order. The clearing_id can be used to check the status of, cancel or confirm the order.

JSON response - successful cancel

{
    "result": "ok",
    "details": "P0521QDV order canceled"
}

JSON response - failed cancel

{
    "result": "failed",
    "details": "Unable to cancel order P0521QDV"
}

Response

The response will be an object

Field Type Description
result string A description of the status of the clearing order. This reponse will return the string "ok" upon success, or "failed" upon failure.
details string Provides more detailed description on the result. Will either return "P0521QDV order canceled" or "Unable to cancel order P0521QDV".

Confirm Clearing Order

POST https://api.gemini.com/v1/clearing/confirm

Sample order confirmation payload

{
    "request": "v1/clearing/confirm",
    "nonce": <nonce>,
    "clearing_id": "OM9VNL1G",
    "symbol": "btcusd",
    "amount": "100",
    "price": "9500.00",
    "side": "sell"
}

Parameters

Parameter Type Description
request string The literal string "v1/clearing/confirm"
nonce integer The nonce, as described in Private API Invocation
clearing_id string A unique identifier for the clearing order. The clearing_id can be used to check the status of your order or by the counterparty to confirm the order.
symbol string The symbol of the order
amount string Quoted decimal amount to purchase
price string Quoted decimal amount to spend per unit
side string "buy" or "sell". Must be the opposite side of the initiator's side

JSON response - clearing order confirmation success

{
    "result": "confirmed"
}

JSON response - clearing order confirmation failure

{
    "result": "error",
    "reason": "InvalidSide",
    "message": "Invalid side for symbol BTCUSD: 'buy'"
}

Response

The reponse will be an object

Field Type Description
result sring A brief description of the result. Will return "confirmed" upon success and "error" upon failure
reason string Will only populate upon failure. Gives the reason for the confirmation error
message string Will only populate upon failure. A more detailed description of the reason for failure

Clearing Order List

HTTP Request

POST https://api.gemini.com/v1/clearing/list

Sample clearing list payload

{
    "request": "/v1/clearing/list",
    "nonce": <nonce>,
    "symbol": "BTCEUR",
    "counterparty": "KQ4P3XWE",
    "side": "buy",
    "expiration_start": 1642222800000,
    "expiration_end": 1642309200000,
    "submission_start": 1641790800000,
    "submission_end": 1641791100000,
    "funded": false
}

Parameters

Parameter Type Description
request string The literal string "/v1/clearing/list"
nonce integer The nonce, as described in Private API Invocation
symbol string Optional. Trading pair
counterparty string Optional. counterparty_id or counterparty_alias
side string "buy" or "sell"
expiration_start timestamp Optional. UTC timestamp. Requires expiration_end if set
expiration_end timestamp Optional. UTC timestamp. Requires expiration_start if set
submission_start timestamp Optional. UTC timestamp. Requires submission_end if set
submission_end timestamp Optional. UTC timestamp. Requires submission_start if set
funded boolean Optional. Default value false if not set
account string Optional. Required for Master API keys as described in Private API Invocation. The name of the account within the subaccount group. Only available for exchange accounts.

JSON response - successful list

{
    "result": "success",
    "orders": [
    {
        "clearing_id": "9LVQE9X5",
        "counterparty_id": "YZ43LX81",
        "symbol": "BTCEUR",
        "side": "sell",
        "price": 2,
        "quantity": 10,
        "status": "AwaitTargetConfirm",
        "submission": 1641790800020,
        "expiration": 1641963600000
    }, {
        "clearing_id": "2MYR07XP",
        "order_id": "trade1SrcOrderId",
        "counterparty_id": "KQ4P3XWE",
        "broker_id": "WV4V1DGN",
        "symbol": "BTCEUR",
        "side": "buy",
        "price": 1,
        "quantity": 50,
        "status": "AwaitSourceConfirm",
        "submission": 1641790800016,
        "expiration": 1642222800000
    }, {
        "clearing_id": "EM8WO7LQ",
        "order_id": "trade4SrcOrderId",
        "broker_id": "WV4V1DGN",
        "symbol": "BTCEUR",
        "side": "buy",
        "price": 4,
        "quantity": 8,
        "status": "AwaitSourceTargetConfirm",
        "submission": 1641790800028,
        "expiration": 1642136400000
    }
  ]
}

Response

The response will be an object containing clearing list

Field Type Description
result string A description of the status of the clearing list. This reponse will return the string "success" upon success, or "failed" upon failure.
orders array Array of JSON objects with clearing details
-- -- clearing_id string A unique identifier for the clearing order. Always set.
-- -- order_id string Optional. Only provided if order was submitted with it.
-- -- counterparty_id string Optional. A symbol that corresponds with a counterparty to which you completed the trade with.
-- -- counterparty_alias string Optional. Counterparty alias
-- -- broker_id string Optional. A symbol that corresponds with a broker id.
-- -- symbol string Trading pair. Always set.
-- -- side string "buy" or "sell". Always set.
-- -- price decimal The price the clearing order was executed at
-- -- quantity decimal The amount that was executed
-- -- status string A description of the status of the order given in the clearing_id field. See order status descriptions for more information
-- -- submission timestamp UTC timestamp. Always set.
-- -- expiration timestamp UTC timestamp. Always set.

Clearing Broker List

HTTP Request

POST https://api.gemini.com/v1/clearing/broker/list

Sample clearing broker list payload

{
    "request": "/v1/clearing/broker/list",
    "nonce": <nonce>,
    "symbol": "BTCEUR",
    "expiration_start": 1642222800000,
    "expiration_end": 1642309200000,
    "submission_start": 1641790800000,
    "submission_end": 1641791100000,
    "funded": false
}

Parameters

Parameter Type Description
request string The literal string "/v1/clearing/broker/list"
nonce integer The nonce, as described in Private API Invocation
symbol string Optional. Trading pair
expiration_start timestamp Optional. UTC timestamp. Requires expiration_end if set
expiration_end timestamp Optional. UTC timestamp. Requires expiration_start if set
submission_start timestamp Optional. UTC timestamp. Requires submission_end if set
submission_end timestamp Optional. UTC timestamp. Requires submission_start if set
funded boolean Optional. Default value false if not set
account string Optional. Required for Master API keys as described in Private API Invocation. The name of the account within the subaccount group. Only available for exchange accounts.

JSON response - successful broker list

{
    "result": "success",
    "orders": [
    {
        "clearing_id": "9LVQ98X5",
        "source_counterparty_id": "R54L3DG1",
        "source_order_id": "trade1SrcOrderId",
        "target_counterparty_id": "KQ4P3XWE",
        "target_order_id": "trade1TgtOrderId",
        "symbol": "BTCEUR",
        "source_side": "buy",
        "price": 1,
        "quantity": 50,
        "status": "AwaitSourceConfirm",
        "submission": 1641790800016,
        "expiration": 1642222800000
    }, {
        "clearing_id": "VXQ341X4",
        "source_counterparty_id": "R54L3DG1",
        "source_order_id": "trade4SrcOrderId",
        "symbol": "BTCEUR",
        "source_side": "buy",
        "price": 4,
        "quantity": 8,
        "status": "AwaitSourceTargetConfirm",
        "submission": 1641790800028,
        "expiration": 1642136400000
    }
  ]
}

Response

The response will be an object containing clearing broker list

Field Type Description
result string A description of the status of the clearing broker list. This reponse will return the string "success" upon success, or "failed" upon failure.
orders array Array of JSON objects with clearing broker list details
-- -- clearing_id string A unique identifier for the clearing order. Always set.
-- -- source_counterparty_id string Source counterparty id. Always set.
-- -- source_order_id string Optional. Only provided if order was submitted with it.
-- -- target_counterparty_id string Optional. Only provided if target counterparty was already set.
-- -- target_order_id string Optional. Only provided if target counterparty set this field.
-- -- symbol string Trading pair. Always set.
-- -- source_side string "buy" or "sell". Always set.
-- -- price decimal The price the clearing order was executed at
-- -- quantity decimal The amount that was executed
-- -- status string A description of the status of the order given in the clearing_id field. See order status descriptions for more information
-- -- submission timestamp UTC timestamp. Always set.
-- -- expiration timestamp UTC timestamp. Always set.

Clearing Trades

Roles

The API key you use to access this endpoint must have the Master account scope assigned. See Roles for more information. You can also retrieve the clearing counterparty ID associated with the API key by posting a request to either the roles or account/list endpoints.

HTTP Request

POST https://api.gemini.com/v1/clearing/trades

Sample clearing trades payload

{
    "request": "/v1/clearing/trades",
    "nonce": <nonce>,
    "timestamp_nanos": 1630382206000000000,
    "limit": 50,
}

Parameters

Parameter Type Description
request string The literal string "/v1/clearing/trades"
nonce integer or timestamp The nonce, as described in Private API Invocation
timestamp_nanos timestamp Optional. Only return transfers on or after this timestamp in nanos.
limit_per_account integer Optional. The maximum number of clearing trades to return. The default is 100 and the maximum is 300.
account string Optional. Only required when using a master api-key. The name of the account within the subaccount group. Master API keys can get all account names using the Get Accounts endpoint. Only available for exchange accounts.

JSON response - successful clearing trades

{
  "results": [
    {
      "sourceAccount": "primary",
      "targetAccount": "primary",
      "pair": "BTCUSD",
      "sourceSide": "buy",
      "price": "1",
      "quantity": "1000",
      "clearingId": "41M23L5Q",
      "status": "Settled",
      "expirationTimeMs": 1662567706120,
      "createdMs": 1662481306139,
      "lastUpdatedMs": 1662481561668,
      "hasBroker": false,
      "wasNotified": false
    },
    {
      "sourceAccount": "primary",
      "targetAccount": "primary",
      "pair": "BTCUSD",
      "sourceSide": "buy",
      "price": "12",
      "quantity": "1000",
      "clearingId": "0EMOYLJ5",
      "status": "AwaitTargetConfirm",
      "expirationTimeMs": 1662567728123,
      "createdMs": 1662481328126,
      "lastUpdatedMs": 1662481561415,
      "hasBroker": false,
      "wasNotified": true
    }
  ]
}

Response

The response will be an object containing clearing trades

Field Type Description
sourceAccount string A account that corresponds with the counterparty sourcing the clearing trade.
targetAccount string A account that corresponds with the counterparty where the clearing trade is targeted.
pair string The trading pair of the clearing trade.
sourceSide string "buy" or "sell". Always set.
price string The price the clearing order was executed at.
quantity string The amount that was executed.
clearingId string The clearing ID.
status string A description of the status of the order given in the clearing_id field. See order status descriptions for more information.
expirationTimeMs timestampms The time that the clearing trade expires.
createdMs timestampms The time that the clearing trade was created.
lastUpdatedMs timestampms The last time the clearing trade was updated.
hasBroker boolean Broker trade.
wasNotified boolean Broker was notified.

Websockets

Gemini Clearing orders will be available on the order events API because clearing orders are not published to the exchange. All Gemini Clearing orders are cleared just between the initiating party and counterparty.

The orders will only show up in order events stream when the order is settled.

The following python code sample will open a private websocket stream.

import ssl
import websocket
import json
import base64
import hmac
import hashlib
import time

def on_message(ws, message):
    print(message)

def on_error(ws, error):
    print(error)

def on_close(ws):
    print("### closed ###")

gemini_api_key = "apikey"
gemini_api_secret = "apisecret".encode()

payload = {"request": "/v1/order/events","nonce": time.time()}
encoded_payload = json.dumps(payload).encode()
b64 = base64.b64encode(encoded_payload)
signature = hmac.new(gemini_api_secret, b64, hashlib.sha384).hexdigest()


ws = websocket.WebSocketApp("wss://api.gemini.com/v1/order/events",
                            on_message=on_message,
                            header={
                                'X-GEMINI-PAYLOAD': b64.decode(),
                                'X-GEMINI-APIKEY': gemini_api_key,
                                'X-GEMINI-SIGNATURE': signature
                            })
ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE})

Sample JSON response for settled Clearing Order

This clearing order was settled on the Web UI. Please see common fields for more information on the expected fields.

[
  {
    "type": "fill",
    "order_id": "263424597",
    "api_session": "UI",
    "symbol": "ltcusd",
    "side": "buy",
    "order_type": "exchange limit",
    "timestamp": "1565273156",
    "timestampms": 1565273156891,
    "is_live": false,
    "is_cancelled": false,
    "is_hidden": true,
    "avg_execution_price": "90.00",
    "executed_amount": "15000",
    "remaining_amount": "0",
    "original_amount": "15000",
    "price": "90.00",
    "fill": {
      "trade_id": "263424597",
      "liquidity": "GTS",
      "price": "90.00",
      "amount": "15000",
      "fee": "0.00",
      "fee_currency": "USD"
    },
    "socket_sequence": 87
  }
]
Field Type Description
type string
order event type
fill
order_type string will always be exchange limit for clearing orders
fill.trade_id string the event id the order was filled at
fill.liquidity string will return GTS for clearing orders
fill.price decimal the price the trade filled at
fill.amount decimal the amount of the trade fill
fill.fee decimal the fee associated with this side of the trade
fill.fee_currency string the three-letter code of the currency associated with the fee

Revision History

Date Notes
2019/08/08 Initial Gemini Clearing API Documentation
2020/04/09 Documentation for new token support: BAT, DAI, LINK, OXT
2020/08/28 Removing DAIBTCand DAIETH trading pairs
2020/09/11 Documentation for new token support: AMP, COMP, PAXG
2020/09/24 Documentation for new token support: MKR, ZRX, KNC, MANA, STORJ, SNX, CRV, BAL, UNI, REN, UMA, YFI
2020/10/05 Documentation for new order book support: BTCDAI and ETHDAI
2020/10/07 Documentation for new token support: AAVE
2020/10/14 Documentation for new token support: FIL
2020/10/26 Documentation for new fiat support: GBP and EUR
2020/03/22 Documentation for new token support: SKL, GRT, BNT, 1INCH, ENJ, LRC, SAND
2021/04/27 Documentation for new token support: CUBE, LPT, BOND, MATIC, INJ, SUSHI
2021/05/05 Documentation for new token support: DOGE
2021/06/16 Documentation for new token support: ALCX, MIR, FTM, ANKR
2021/07/14 Documentation for new token support: CTX
2021/07/21 Documentation for new token support: XTZ
2021/09/15 Documentation for new token support: AXS, SLP, LUNA, UST, MCO2
2021/11/13 Documentation for new token support: WCFG, RARE, RAD, QNT, NMR, MASK, FET, ASH, AUDIO, API3, USDC, SHIB
2021/12/20 Documentation for new token support: RNDR, MC, GALA, ENS, KP3R, CVC, ELON, MIM, SPELL
2022/02/01 Documentation for new token support: TOKE, LDO, RLY
2022/02/28 Documentation for new token support: SOL
2022/03/01 Documentation for new token support: RAY, SBR
2022/03/16 Documentation for new token support: APE
2022/03/29 Documentation for new token support: RBN, FXS, DPI, LQTY, LUSD, FRAX, INDEX, MPL
2022/04/26 Documentation for new token support: GUSDSGD
2022/04/27 Documentation for new token support: METIS, QRDO, ZBC, CHZ, REVV, JAM, FIDA, GMT
2022/05/17 Documentation for new token support: GFI, ORCA
2022/05/18 New Feature Documentation for Clearing Order List and Clearing Broker List
2022/06/14 Documentation for new token support: ALI, TRU
2022/06/22 Documentation for new token support: GUSDGBP
2022/07/06 Documentation for new token support: DOT, ERN
2022/08/01 Documentation for new token support: GAL, EUL, SAMO
2022/08/23 Documentation for new token support: BICO, IMX, PLA, IOTX
2022/09/07 Documentation for new token support: BUSD
2022/10/11 Documentation for new token support: AVAX
2023/01/10 Documentation for new token support: ATOM, USDT
2023/08/04 Documentation for token delist: ENJ
2023/08/10 Documentation for new token support: XRP
2023/09/11 Documentation for new token support: HNT
2023/09/18 Removed Documentation for new token support: MPL, MC, METIS, RBN, GFI, LQTY, and LUSD
2023/11/15 Remove Documentation for delisted token: MIR, UST, FXS, FRAX, BUSD
2024/04/23 Remove Documentation for delisted token: ZEC
2024/05/05 Remove Documentation for delisted token: OXT-BTC,OXT-ETH,BAT-BTC,BAT-ETH, BTC-DAI, ETH-DAI
2024/09/18 Documentation for new token support: WIF
2024/09/20 Remove Documentation for delisted token: LUNA,SNX,QRDO,ZBC