### Get Risk Stats Request (Go) Source: https://docs.gemini.com/rest/derivatives Example of how to request risk statistics for a symbol using Go. This demonstrates using the net/http package to make a GET request. ```go package main import ( "fmt" "io/ioutil" "net/http" ) func main() { resp, err := http.Get("https://api.gemini.com/v1/riskstats/{symbol}") if err != nil { fmt.Println("Error making request:", err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println("Error reading response body:", err) return } fmt.Println(string(body)) } ``` -------------------------------- ### Get Risk Stats Request (Kotlin) Source: https://docs.gemini.com/rest/derivatives Example of how to request risk statistics for a symbol using Kotlin. This demonstrates using the OkHttp library to make a GET request. ```kotlin import okhttp3.OkHttpClient import okhttp3.Request fun main() { val client = OkHttpClient() val request = Request.Builder() .url("https://api.gemini.com/v1/riskstats/{symbol}") .build() client.newCall(request).execute().use { response -> if (!response.isSuccessful) throw IOException("Unexpected code $response") println(response.body?.string()) } } ``` -------------------------------- ### Get Risk Stats Request (Swift) Source: https://docs.gemini.com/rest/derivatives Example of how to request risk statistics for a symbol using Swift. This demonstrates using URLSession to make a GET request. ```swift import Foundation let url = URL(string: "https://api.gemini.com/v1/riskstats/{symbol}") let task = URLSession.shared.dataTask(with: url!) { data, response, error in if let error = error { print("Error: \(error.localizedDescription)\n") return } if let data = data { if let responseString = String(data: data, encoding: .utf8) { print("Response: \(responseString)\n") } } } task.resume() ``` -------------------------------- ### Get Risk Stats Request (C#) Source: https://docs.gemini.com/rest/derivatives Example of how to request risk statistics for a symbol using C#. This demonstrates using the HttpClient class to make a GET request. ```csharp using System; using System.Net.Http; using System.Threading.Tasks; public class RiskStats { public static async Task GetRiskStatsAsync() { using (var client = new HttpClient()) { var url = "https://api.gemini.com/v1/riskstats/{symbol}"; var response = await client.GetAsync(url); response.EnsureSuccessStatusCode(); // Throw if HTTP status code is not 2xx var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } } public static void Main(string[] args) { GetRiskStatsAsync().Wait(); } } ``` -------------------------------- ### Get Risk Stats Request (cURL) Source: https://docs.gemini.com/rest/derivatives Example of how to request risk statistics for a symbol using cURL. This demonstrates the GET request method and the endpoint structure. ```shell curl --request GET \ --url https://api.gemini.com/v1/riskstats/:symbol ``` -------------------------------- ### Get Risk Stats Request (Ruby) Source: https://docs.gemini.com/rest/derivatives Example of how to request risk statistics for a symbol using Ruby. This demonstrates using the Net::HTTP library to make a GET request. ```ruby require 'net/http' require 'uri' uri = URI.parse("https://api.gemini.com/v1/riskstats/{symbol}") response = Net::HTTP.get(uri) puts response ``` -------------------------------- ### Get Risk Stats Request (Objective-C) Source: https://docs.gemini.com/rest/derivatives Example of how to request risk statistics for a symbol using Objective-C. This demonstrates using NSURLSession to make a GET request. ```objectivec #import int main(int argc, const char * argv[]) { @autoreleasepool { NSURL *url = [NSURL URLWithString:@"https://api.gemini.com/v1/riskstats/{symbol}"]; NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionDataTask *task = [session dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error) { NSLog(@"Error: %@\n", error.localizedDescription); return; } NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"Response: %@\n", responseString); }]; [task resume]; // Keep the main thread alive to allow the task to complete CFRunLoopRun(); } return 0; } ``` -------------------------------- ### Get Risk Stats Request (Python) Source: https://docs.gemini.com/rest/derivatives Example of how to request risk statistics for a symbol using Python. This demonstrates using the requests library to make a GET request. ```python import requests url = "https://api.gemini.com/v1/riskstats/{symbol}" response = requests.get(url) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") ``` -------------------------------- ### Get Risk Stats Request (PHP) Source: https://docs.gemini.com/rest/derivatives Example of how to request risk statistics for a symbol using PHP. This demonstrates using cURL to make a GET request. ```php ``` -------------------------------- ### Get Risk Stats Request (JavaScript) Source: https://docs.gemini.com/rest/derivatives Example of how to request risk statistics for a symbol using JavaScript. This demonstrates using the fetch API to make a GET request. ```javascript fetch('https://api.gemini.com/v1/riskstats/{symbol}') .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Get Risk Stats Request (Java) Source: https://docs.gemini.com/rest/derivatives Example of how to request risk statistics for a symbol using Java. This demonstrates using the HttpURLConnection class to make a GET request. ```java import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class RiskStats { public static void main(String[] args) { try { URL url = new URL("https://api.gemini.com/v1/riskstats/{symbol}"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; StringBuilder response = new StringBuilder(); while ((line = reader.readLine()) != null) { response.append(line); } reader.close(); System.out.println(response.toString()); } catch (Exception e) { e.printStackTrace(); } } } ``` -------------------------------- ### FX Rate API JSON Response Example Source: https://docs.gemini.com/rest/market-data An example of a successful JSON response when querying the FX Rate API. It includes the currency pair, exchange rate, timestamp, data provider, and benchmark market. ```json { "fxPair": "AUDUSD", "rate": "0.69", "asOf": 1594651859000, "provider": "bcb", "benchmark": "Spot" } ``` -------------------------------- ### List Past Trades Request Headers Example Source: https://docs.gemini.com/rest/orders Example of HTTP headers required for authenticating and sending requests to the Gemini List Past Trades endpoint. This includes API key, signature, and payload details. ```http POST /v1/mytrades HTTP/1.1 Host: api.gemini.com Content-Type: text/plain X-GEMINI-APIKEY: YOUR_API_KEY X-GEMINI-SIGNATURE: YOUR_SIGNATURE X-GEMINI-PAYLOAD: YOUR_BASE64_ENCODED_PAYLOAD Cache-Control: no-cache ``` -------------------------------- ### Transaction History Request Body Example (JSON) Source: https://docs.gemini.com/rest/fund-management This is an example of the JSON payload required for the Get Transaction History API request. It specifies the request path, a nonce, timestamp for filtering, a limit for the number of results, and an optional continuation token for pagination. ```json { "request": "/v1/transactions", "nonce": "", "timestamp_nanos": 1630382206000000000, "limit": 50, "continuation_token": "daccgrp_123421:n712621873886999872349872349:a71289723498273492374978424:m2:iForward" } ``` -------------------------------- ### List Past Orders Response Body Example Source: https://docs.gemini.com/rest/orders An example of a successful response (200 OK) when listing past orders. It details the structure of an order object, including its ID, symbol, price, execution details, timestamps, and status flags. ```json { "order_id": "123456789", "client_order_id": "abcdefghij", "symbol": "btcusd", "exchange": "gemini", "price": "10000.00", "avg_execution_price": "10000.00", "side": "buy", "type": "exchange limit", "options": [], "timestamp": "2020-02-20T10:00:00.000Z", "timestampms": 1582147200000, "is_live": false, "is_cancelled": false, "reason": null, "was_forced": false, "executed_amount": "0.001", "remaining_amount": "0.000", "original_amount": "0.001", "is_hidden": false, "trades": [] } ``` -------------------------------- ### Wrap Order Successful Response Example - JSON Source: https://docs.gemini.com/rest/orders An example of a successful 200 OK response from the Wrap Order endpoint. This JSON object details the order ID, trading pair, price, quantity, and associated fees. ```json { "orderId": 429135395, "pair": "GUSDUSD", "price": "1", "priceCurrency": "USD", "side": "buy", "quantity": "1", "quantityCurrency": "GUSD", "totalSpend": "1", "totalSpendCurrency": "USD", "fee": "0", "feeCurrency": "USD", "depositFee": "0", "depositFeeCurrency": "USD" } ``` -------------------------------- ### Unstake Crypto Funds Successful Response Example (JSON) Source: https://docs.gemini.com/rest/staking An example of a successful response (HTTP 200) when unstaking crypto funds. It includes details about the transaction, such as transactionId, amount, currency, and when the request was initiated. ```json { "transactionId": "MPZ7LDD8", "amount": 20, "amountPaidSoFar": 20, "amountRemaining": 0, "currency": "MATIC", "requestInitiated": "2022-11-02T19:49:20.153Z" } ``` -------------------------------- ### Unstake Crypto Funds Request Body Example (JSON) Source: https://docs.gemini.com/rest/staking A JSON representation of the request body for unstaking crypto funds. This object contains the necessary fields and example values for a successful request. ```json { "request": "v1/staking/unstake", "nonce": "", "providerId": "62b21e17-2534-4b9f-afcf-b7edb609dd8d", "currency": "MATIC", "amount": 20 } ``` -------------------------------- ### Transaction History Response Example (JSON) Source: https://docs.gemini.com/rest/fund-management This JSON structure represents a successful response (200 OK) from the Get Transaction History API. It contains a list of transaction results, each with details like account, amount, price, and timestamp. A continuationToken is included for fetching subsequent pages of results. ```json { "results": [ { "account": "primary", "amount": "0.001", "price": "1730.95", "timestampms": 1659201465069, "side": "SIDE_TYPE_BUY", "isAggressor": true, "feeAssetCode": "ETH", "feeAmount": "0.000000000000000605", "orderId": 73716687406755680, "exchange": "Gemini Trust Co", "isAuctionFill": false, "isClearingFill": false, "symbol": "ETHUSD", "type": "trade" }, { "account": "primary", "amount": "0.001", "price": "1679.02", "timestampms": 1659201465222, "side": "SIDE_TYPE_SELL", "isAggressor": true, "feeAssetCode": "ETH", "feeAmount": "0.00000000000000000587", "orderId": 73716687406755680, "exchange": "Gemini Trust Co", "isAuctionFill": false, "isClearingFill": false, "symbol": "ETHUSD", "type": "trade" } ], "continuationToken": "daccgrp_1500611:n7126218738869976937315434496:a7126216029949884380085223424:m2:iForward" } ``` -------------------------------- ### Get Open Positions Source: https://docs.gemini.com/rest/derivatives Retrieves the current open positions for the authenticated user. ```APIDOC ## Get Open Positions ### Description This endpoint retrieves a list of the user's current open positions. ### Method POST ### Endpoint https://api.gemini.com/v1/positions ### Parameters (Note: Specific parameters for this endpoint were not detailed in the provided text. Typically, authentication headers like X-GEMINI-APIKEY, X-GEMINI-SIGNATURE, and X-GEMINI-PAYLOAD would be required, along with a nonce in the payload.) ### Request Example (Authentication headers and payload structure would be similar to other POST endpoints.) ### Response (Specific response structure for open positions was not detailed in the provided text.) ``` -------------------------------- ### Execute Instant Order Request (cURL) Source: https://docs.gemini.com/rest/instant Example of how to execute an instant order using cURL. This includes the API endpoint, necessary headers for authentication and content type, and the JSON payload specifying order details like symbol, side, quantity, and price. ```shell curl --request POST \ --url https://api.gemini.com/v1/instant/execute \ --header 'Content-Type: application/json' \ --header 'X-GEMINI-APIKEY: ' \ --header 'X-GEMINI-PAYLOAD: ' \ --header 'X-GEMINI-SIGNATURE: ' \ --data ' { "request": "/v1/instant/execute", "nonce": "", "symbol": "BTCUSD", "side": "buy", "quantity": "0.01505181", "price": "6445.07", "fee": "2.9900309233", "quoteId": 1328 } ' ``` -------------------------------- ### Execute Instant Order Request Body Example (JSON) Source: https://docs.gemini.com/rest/instant A sample JSON object representing the request body for executing an instant order. This structure defines the parameters required by the API, such as the API request path, a unique nonce, the trading symbol, order side, quantity, price, fee, and quote ID. ```json { "request": "/v1/instant/execute", "nonce": "", "symbol": "BTCUSD", "side": "buy", "quantity": "0.01505181", "price": "6445.07", "fee": "2.9900309233", "quoteId": 1328 } ``` -------------------------------- ### Get Available Balances - JSON Response Source: https://context7.com/context7/gemini_rest/llms.txt Example JSON response for available balances, showing currency, total amount, available, pending withdrawal, and pending deposit amounts. ```json [ { "type": "exchange", "currency": "BTC", "amount": 10.5, "available": 9, "availableForWithdrawal": 9, "pendingWithdrawal": 1, "pendingDeposit": 0.5 }, { "type": "exchange", "currency": "USD", "amount": 50000, "available": 45000, "availableForWithdrawal": 45000, "pendingWithdrawal": 5000, "pendingDeposit": 0 } ] ``` -------------------------------- ### Get Order Status - JSON Response Source: https://context7.com/context7/gemini_rest/llms.txt Example JSON response detailing a specific order's status, including amounts, prices, and associated trade history if requested. ```json { "order_id": "123456789012345", "client_order_id": "my-order-123", "symbol": "BTCUSD", "exchange": "gemini", "price": "3633.00", "avg_execution_price": "3632.50", "side": "buy", "type": "exchange limit", "timestamp": 1593561600, "timestampms": 1593561600000, "is_live": false, "is_cancelled": false, "executed_amount": "5", "remaining_amount": "0", "original_amount": "5", "trades": [ { "price": "3632.50", "amount": "5", "timestamp": 1593561605, "fee_amount": "0.0175" } ] } ``` -------------------------------- ### Get Available Balances - JSON Request Source: https://context7.com/context7/gemini_rest/llms.txt JSON payload for the get available balances request, specifying the API path, nonce, and account type. ```json { "request": "/v1/balances", "nonce": 1234567896, "account": "primary" } ``` -------------------------------- ### GET FX Rate with cURL Source: https://docs.gemini.com/rest/market-data Demonstrates how to fetch foreign exchange rates using the cURL command-line tool. Requires API key, payload, and signature headers for authentication. It retrieves rate data for a specified currency pair and timestamp. ```shell curl --request GET \ --url https://api.gemini.com/v2/fxrate/:symbol/:timestamp \ --header 'X-GEMINI-APIKEY: ' \ --header 'X-GEMINI-PAYLOAD: ' \ --header 'X-GEMINI-SIGNATURE: ' ``` -------------------------------- ### Clearing Trades JSON Response Example Source: https://docs.gemini.com/rest/clearing An example of a successful JSON response when listing clearing trades from the Gemini API. This includes details for each trade such as price, quantity, status, and timestamps. ```json { "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 } ] } ``` -------------------------------- ### POST /v1/instant/execute Source: https://docs.gemini.com/rest/instant Executes an instant order on the Gemini exchange. This endpoint allows users to buy or sell cryptocurrency at the current market price. ```APIDOC ## POST /v1/instant/execute ### Description Executes an instant order on the Gemini exchange. This endpoint allows users to buy or sell cryptocurrency at the current market price. ### Method POST ### Endpoint /v1/instant/execute ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **request** (string) - Required - The API endpoint path, e.g., "/v1/instant/execute". - **nonce** (string) - Required - A unique identifier for the request. - **symbol** (string) - Required - The trading pair symbol, e.g., "BTCUSD". - **side** (string) - Required - The order side, either "buy" or "sell". - **quantity** (string) - Required - The amount of the base currency to trade. - **price** (string) - Optional - The price at which to execute the order. If omitted, the order will be executed at the current market price. - **fee** (string) - Optional - The fee for the order. - **quoteId** (integer) - Optional - An identifier for a quote. ### Request Example ```json { "request": "/v1/instant/execute", "nonce": "", "symbol": "BTCUSD", "side": "buy", "quantity": "0.01505181", "price": "6445.07", "fee": "2.9900309233", "quoteId": 1328 } ``` ### Response #### Success Response (200) - **orderId** (integer) - The ID for the executed order. - **pair** (string) - The symbol for the order. - **price** (string) - The price at which the order was executed. - **priceCurrency** (string) - The currency in which the order is priced. - **side** (string) - Either "buy" or "sell". - **quantity** (string) - The quantity of the asset bought or sold. - **quantityCurrency** (string) - The currency label for the `quantity` field. - **totalSpend** (string) - Total quantity to spend for the order. - **totalSpendCurrency** (string) - Currency of the `totalSpend`. - **fee** (string) - The fee quantity charged for the order. - **feeCurrency** (string) - The currency label for the fee. - **depositFee** (string) - The deposit fee quantity. Returns 0 if no deposit fee applies. - **depositFeeCurrency** (string) - Currency in which `depositFee` is taken. #### Response Example ```json { "orderId": 375089415, "pair": "BTCUSD", "price": "6445.07", "priceCurrency": "USD", "side": "buy", "quantity": "0.01505181", "quantityCurrency": "BTC", "totalSpend": "100", "totalSpendCurrency": "USD", "fee": "2.9900309233", "feeCurrency": "USD", "depositFee": "0", "depositFeeCurrency": "USD" } ``` ``` -------------------------------- ### Get Order Status - JSON Request Source: https://context7.com/context7/gemini_rest/llms.txt JSON payload for the get order status request. Includes the order ID and an option to include trade history. ```json { "request": "/v1/order/status", "nonce": 1234567893, "order_id": 123456789012345, "include_trades": true } ``` -------------------------------- ### Get Open Positions Request Headers Source: https://docs.gemini.com/rest/derivatives Headers required for the Get Open Positions API endpoint. This includes API key, signature, payload, content type, content length, and cache control. ```HTTP X-GEMINI-APIKEY: string (required) X-GEMINI-SIGNATURE: string (required) X-GEMINI-PAYLOAD: string (required) Content-Type: string (default: text/plain) Content-Length: string (default: 0) Cache-Control: string (default: no-cache) ``` -------------------------------- ### Successful Instant Order Execution Response (JSON) Source: https://docs.gemini.com/rest/instant Example of a successful JSON response after executing an instant order. It includes details such as the order ID, the trading pair, execution price and quantity, associated currencies, total amount spent, and any fees incurred. ```json { "orderId": 375089415, "pair": "BTCUSD", "price": "6445.07", "priceCurrency": "USD", "side": "buy", "quantity": "0.01505181", "quantityCurrency": "BTC", "totalSpend": "100", "totalSpendCurrency": "USD", "fee": "2.9900309233", "feeCurrency": "USD", "depositFee": "0", "depositFeeCurrency": "USD" } ``` -------------------------------- ### POST /v1/wrap/{symbol} Source: https://docs.gemini.com/rest/orders Wraps a given amount of a cryptocurrency into another, effectively creating a new order. This endpoint requires specific headers for authentication and payload signing. ```APIDOC ## POST /v1/wrap/{symbol} ### Description Wraps a specified amount of a given symbol. Requires trader role and `orders:create` OAuth scope. ### Method POST ### Endpoint /v1/wrap/{symbol} ### Parameters #### Path Parameters - **symbol** (string) - Required - The trading pair symbol (e.g., `BTCUSD`). #### Headers - **X-GEMINI-APIKEY** (string) - Required - Your API key. - **X-GEMINI-SIGNATURE** (string) - Required - HEX-encoded HMAC-SHA384 of payload signed with API secret. - **X-GEMINI-PAYLOAD** (string) - Required - Base64-encoded JSON payload. - **Content-Type** (string) - Optional - Defaults to `text/plain`. - **Content-Length** (string) - Optional - Defaults to `0`. - **Cache-Control** (string) - Optional - Defaults to `no-cache`. #### Request Body - **request** (string) - Required - The literal string `/v1/wrap/symbol`. - **nonce** (required) - Required - The nonce, as described in Private API Invocation. - **amount** (string) - Required - The amount to wrap. - **side** (string) - Optional - Enum: `"buy"` or `"sell"`. - **client_order_id** (string) - Optional - A client-specified order ID. - **account** (string) - Optional - Required for Master API keys; the name of the account within the subaccount group. ### Request Example ```json { "request": "/v1/wrap/GUSDUSD", "nonce": "", "amount": "1", "side": "buy", "client_order_id": "4ac6f45f-baf1-40f8-83c5-001e3ea73c7f" } ``` ### Response #### Success Response (200) - **orderId** (string) - The order ID. - **pair** (string) - Trading pair symbol. - **price** (string) - The price of the order. - **priceCurrency** (string) - The currency in which the order is priced. - **side** (string) - Either "buy" or "sell". - **quantity** (string) - The amount that was executed. - **quantityCurrency** (string) - The currency label for the quantity field. - **totalSpend** (string) - Total quantity spent for the order. - **totalSpendCurrency** (string) - Currency of the totalSpend. - **fee** (string) - The amount charged. - **feeCurrency** (string) - Currency that the fee was paid in. - **depositFee** (string) - The deposit fee quantity. - **depositFeeCurrency** (string) - Currency in which depositFee is taken. #### Response Example ```json { "orderId": 429135395, "pair": "GUSDUSD", "price": "1", "priceCurrency": "USD", "side": "buy", "quantity": "1", "quantityCurrency": "GUSD", "totalSpend": "1", "totalSpendCurrency": "USD", "fee": "0", "feeCurrency": "USD", "depositFee": "0", "depositFeeCurrency": "USD" } ``` ``` -------------------------------- ### List Clearing Trades Request (Python) Source: https://docs.gemini.com/rest/clearing A Python example for listing clearing trades via the Gemini API. It shows how to construct the request, sign it, and send it using common libraries. ```python import requests import json import time import hmac import hashlib api_key = '' api_secret = '' url = 'https://api.gemini.com/v1/clearing/trades' payload = { 'request': '/v1/clearing/trades', 'nonce': str(int(time.time() * 1000)) } encoded_payload = json.dumps(payload).encode('utf-8') signature = hmac.new(api_secret.encode('utf-8'), encoded_payload, hashlib.sha384).hexdigest() headers = { 'Content-Type': 'application/json', 'X-GEMINI-APIKEY': api_key, 'X-GEMINI-PAYLOAD': encoded_payload, 'X-GEMINI-SIGNATURE': signature } response = requests.post(url, headers=headers, data=encoded_payload) print(response.json()) ``` -------------------------------- ### Account Structure Source: https://docs.gemini.com/rest/~schemas Details the structure for account information, including name, ID, default status, and creation date. ```APIDOC ## Account Structure ### Description Represents an account with its associated details. ### Fields - **name** (string) - The account name. - **account_id** (string) - The account ID. - **is_default** (boolean) - Whether the account is the default account. - **created** (string) - The creation date. ``` -------------------------------- ### Get Risk Stats Response (200 OK) Source: https://docs.gemini.com/rest/derivatives A successful response (200 OK) for the Get Risk Stats API endpoint, containing product type, mark price, index price, open interest, and open interest notional. ```json { "product_type": "PerpetualSwapContract", "mark_price": "30080.00", "index_price": "30079.046", "open_interest": "14.439", "open_interest_notional": "434325.12" } ``` -------------------------------- ### Wrap Order Request - cURL Source: https://docs.gemini.com/rest/orders Example of how to make a Wrap Order request using cURL. This includes the endpoint, headers, and a sample JSON payload. The payload requires a unique nonce and specifies the amount, side, and client order ID. ```shell curl --request POST \ --url https://api.gemini.com/v1/wrap/:symbol \ --header 'Content-Type: application/json' \ --header 'X-GEMINI-APIKEY: ' \ --header 'X-GEMINI-PAYLOAD: ' \ --header 'X-GEMINI-SIGNATURE: ' \ --data ' { "request": "/v1/wrap/GUSDUSD", "nonce": "", "amount": "1", "side": "buy", "client_order_id": "4ac6f45f-baf1-40f8-83c5-001e3ea73c7f" } ' ``` -------------------------------- ### Unstake Crypto Funds Request (cURL) Source: https://docs.gemini.com/rest/staking Example of an unstake crypto funds request using cURL. This includes the POST method, URL, required headers, and the JSON payload with parameters like request, nonce, providerId, currency, and amount. ```shell curl --request POST \ --url https://api.gemini.com/v1/staking/unstake \ --header 'Content-Type: application/json' \ --header 'X-GEMINI-APIKEY: ' \ --header 'X-GEMINI-PAYLOAD: ' \ --header 'X-GEMINI-SIGNATURE: ' \ --data ' { "request": "v1/staking/unstake", "nonce": "", "providerId": "62b21e17-2534-4b9f-afcf-b7edb609dd8d", "currency": "MATIC", "amount": 20 }' ``` -------------------------------- ### Get Open Positions Request Body Source: https://docs.gemini.com/rest/derivatives The request body for the Get Open Positions API endpoint. It requires a request parameter specifying the endpoint and a nonce for private API invocation. An optional account parameter is available for master API keys. ```JSON { "request": string (required, literal: "/v1/positions"), "nonce": required, "account": string (optional) } ``` -------------------------------- ### POST /v1/positions Source: https://docs.gemini.com/rest/derivatives Retrieves a list of open positions for a given account. Requires specific API key roles and OAuth scopes. ```APIDOC ## POST /v1/positions ### Description Retrieves a list of open positions for a given account. Requires specific API key roles and OAuth scopes. ### Method POST ### Endpoint /v1/positions ### Parameters #### Headers - **X-GEMINI-APIKEY** (string) - Required - Your API key - **X-GEMINI-SIGNATURE** (string) - Required - HEX-encoded HMAC-SHA384 of payload signed with API secret - **X-GEMINI-PAYLOAD** (string) - Required - Base64-encoded JSON payload - **Content-Type** (string) - Optional - Default: text/plain - **Content-Length** (string) - Optional - Default: 0 - **Cache-Control** (string) - Optional - Default: no-cache #### Request Body - **request** (string) - Required - The literal string "/v1/positions" - **nonce** (integer) - Required - The nonce, as described in Private API Invocation - **account** (string) - Optional - Required for Master API keys. The name of the account within the subaccount group. ### Request Example ```json { "request": "/v1/positions", "nonce": 1316335941075, "account": "subaccount_name" } ``` ### Response #### Success Response (200) - **openPositions** (array) - An array of open position objects. #### Response Example ```json { "openPositions": [ { "symbol": "btcusd", "amount": "0.01", "rate": "40000.00", "trades": [] } ] } ``` ``` -------------------------------- ### Get Network API Source: https://docs.gemini.com/rest/market-data Retrieves the associated network for a given token. ```APIDOC ## Get Network ### Description Retrieves the associated network for a requested token. ### Method GET ### Endpoint https://api.gemini.com/v1/network/{token} ### Parameters #### Path Parameters - **token** (string) - Required - Token identifier (e.g., `BTC`, `ETH`). #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **token** (string) - The requested token. - **network** (string[]) - Network of the requested token. #### Response Example ```json { "token": "BTC", "network": ["bitcoin"] } ``` ``` -------------------------------- ### Create New Order (Bash) Source: https://context7.com/context7/gemini_rest/llms.txt Places a new order (limit or stop-limit) on the Gemini exchange. Requires authentication headers including API key, payload, and signature. The payload contains order details like symbol, amount, price, side, and type. ```bash curl -X POST https://api.gemini.com/v1/order/new \ -H "Content-Type: text/plain" \ -H "X-GEMINI-APIKEY: mykey" \ -H "X-GEMINI-PAYLOAD: payload_base64" \ -H "X-GEMINI-SIGNATURE: signature_hex" ``` -------------------------------- ### GET /v2/candles/{symbol}/{time_frame} Source: https://docs.gemini.com/rest/market-data Retrieves time-intervaled data for a provided symbol. ```APIDOC ## GET /v2/candles/{symbol}/{time_frame} ### Description This endpoint retrieves time-intervaled data for the provided symbol. ### Method GET ### Endpoint https://api.gemini.com/v2/candles/{symbol}/{time_frame} ### Parameters #### Path Parameters - **symbol** (string) - Required - Trading pair symbol - **time_frame** (string) - Required - Time range for each candle. Enum values: `1m`, `5m`, `15m`, `30m`, `1h`, `6h`, `1day` ### Request Example ```json { "example": "Request for 1-hour candles for BTCUSD" } ``` ### Response #### Success Response (200) - **Candle** (array) - An array of arrays, where each inner array represents a candle with timestamp, open, high, low, close, and volume. #### Response Example ```json { "Candle": [ [1559755800000, 7781.6, 7820.23, 7776.56, 7819.39, 34.7624802159], [1559755800000, 7781.6, 7829.46, 7776.56, 7817.28, 43.4228281059] ] } ``` ``` -------------------------------- ### Wrap Order Request Body Example - JSON Source: https://docs.gemini.com/rest/orders A JSON representation of the request body for the Wrap Order endpoint. This defines the structure for submitting wrap order details, including the request path, nonce, amount, side, and an optional client order ID. ```json { "request": "/v1/wrap/GUSDUSD", "nonce": "", "amount": "1", "side": "buy", "client_order_id": "4ac6f45f-baf1-40f8-83c5-001e3ea73c7f" } ``` -------------------------------- ### Roles Endpoint Successful Response Example - JSON Source: https://docs.gemini.com/rest/account-administration A JSON object illustrating a successful response from the Gemini API's Roles endpoint. It indicates the assigned roles (isAuditor, isFundManager, isTrader) for the API key. ```json { "isAuditor": false, "isFundManager": true, "isTrader": true } ``` -------------------------------- ### StakingRateProvider Object Details Source: https://docs.gemini.com/rest/~schemas Details about staking rate providers. ```APIDOC ## StakingRateProvider ### Description Represents staking rate providers. ### Fields * **currency_symbol** (object) - Show properties. ```