GeminiGemini
Demo environmentGet API key
  • Overview
  • Crypto Trading
  • Prediction Markets
  • Perpetuals
  • Stocks
  • API Reference
  • SDKs & Tools
Changelog
Gemini logoGemini logo

© 2026 Gemini Space Station, Inc.

Overview
Spot
    OverviewGet started
    Orders API
    Market Data API
    Fund Management API
    Instant Orders API
    WebSocket API
    FIX API
Margin
    Overview
    Margin REST API
      Get Margin Account SummaryGet Margin Interest RatesPreview Margin Order Impact
Staking
    Overview
    Staking REST API
      List Staking BalancesStake Crypto FundsUnstake Crypto FundsList Staking Event HistoryList Staking RatesList Staking Rewards
Clearing
    Clearing REST API
      Clearing Orders
      Broker & Trade Operations
Margin

Margin trading

Margin trading on Gemini

Trade with leverage, monitor margin accounts, review tiered borrow rates, and preview pre-trade order impacts via Gemini REST and WebSocket APIs.

Get API key
Capabilities

Margin Trading Operations

Access margin account summaries, check tiered borrow interest rates, and evaluate pre-trade leverage impact.

Account SummaryMonitor initial margin, maintenance margin, total collateral value, and buying power across currencies.
Interest & Borrow RatesRetrieve active tiered interest rates and hourly borrow fees per supported margin asset.
Order Impact PreviewPreview the impact of a proposed order on account margin, leverage, and liquidation risk before placement.
Risk & Scope RulesReview account-scoped authentication, role requirements, and margin eligibility prerequisites.
Quickstart

Inspect Margin & Preview Orders

Use account-scoped REST endpoints to monitor margin status and validate order risk prior to submission.

1

1. Fetch Account Summary

Query current initial margin, maintenance margin, and buying power.

Python
# Fetch Margin Account Summary
import requests, hmac, hashlib, base64, time, json

API_KEY = "account-xxx"
API_SECRET = "secret-xxx"
URL = "https://api.gemini.com/v1/margin/account"

payload = {
    "request": "/v1/margin/account",
    "nonce": int(time.time() * 1000)
}
encoded_payload = base64.b64encode(json.dumps(payload).encode())
signature = hmac.new(API_SECRET.encode(), encoded_payload, hashlib.sha384).hexdigest()

headers = {
    "Content-Type": "text/plain",
    "Content-Length": "0",
    "X-GEMINI-APIKEY": API_KEY,
    "X-GEMINI-PAYLOAD": encoded_payload.decode(),
    "X-GEMINI-SIGNATURE": signature,
}

response = requests.post(URL, headers=headers)
print(response.json())
Shared Architecture

Spot Endpoints Supported for Margin Trading

Margin trading uses Gemini's core Spot order book and matching engine. You use the exact same Spot order endpoints, authenticated with a Margin-enabled account context.

New Order (`POST /v1/order/new`)

Supports Margin

Submit limit, market, IOC, and stop-limit orders using your margin account credentials or margin account context.

View Endpoint Reference →

Cancel Order (`POST /v1/order/cancel`)

Supports Margin

Cancel resting margin orders on the shared Spot order matching engine.

View Endpoint Reference →

Active & Past Orders (`POST /v1/orders`)

Supports Margin

List open or historical margin orders and trades for the authenticated margin account.

View Endpoint Reference →

WebSocket Order Events Stream

Supports Margin

Subscribe to real-time margin fills, order cancellations, and margin liquidation notifications.

View WebSocket Reference →