Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jbms/finance-dl/llms.txt

Use this file to discover all available pages before exploring further.

The finance_dl.gemini scraper retrieves trade history, transfer history, and current balance snapshots from the Gemini cryptocurrency exchange using Gemini’s authenticated REST API. Unlike the browser-based scrapers, this module uses the requests library directly — no Selenium or ChromeDriver is required. Downloads are incremental: the scraper inspects existing files to determine the most recent timestamp already on disk and fetches only newer records.

Configuration Parameters

credentials
dict
required
A dict containing your Gemini API key and secret. These are REST API credentials generated in your Gemini account settings, not your login username and password.
output_directory
string
required
Path to the local directory where downloaded CSV files will be written. The directory will be created if it does not exist.

API Endpoints Used

This scraper communicates with the following Gemini REST API endpoints:
EndpointPurpose
https://api.gemini.com/v1/balancesFetches current balances for all currencies held
https://api.gemini.com/v1/mytradesFetches trade history, paginated by timestamp
https://api.gemini.com/v1/transfersFetches deposit and withdrawal history
https://api.gemini.com/v2/ticker/{symbol}Fetches current bid/ask prices per currency for USD valuation in balance snapshots
All authenticated requests use HMAC-SHA384 signatures over a base64-encoded JSON payload, following the Gemini private API authentication scheme.

Output Format

All output files are written directly into output_directory:
output_directory/
  trades.1632852595934.csv
  transfers.1632752595924.csv
  balances.2024-01-15.csv
  balances.2024-02-01.csv
File patternContents
trades.<timestamp>.csvAll trades up to and including the millisecond timestamp in the filename
transfers.<timestamp>.csvAll transfers up to and including the millisecond timestamp in the filename
balances.YYYY-MM-DD.csvBalance snapshot taken on the given date, with mid-market USD prices
Incremental downloads: The timestamp embedded in trades.*.csv and transfers.*.csv filenames encodes the timestampms of the last record in that file. On the next run, the scraper sorts existing files, reads the most recent timestamp, and requests only records newer than that point. Balance snapshots are written using today’s date and are created fresh on each run.
The Gemini public API allows up to 120 requests per minute. The scraper enforces a minimum interval of 0.5 seconds between requests and retries automatically on HTTP 429 responses, backing off according to the delay indicated by the server.

Getting API Credentials

  1. Log in to gemini.com and navigate to Settings → API.
  2. Click Create a New API Key.
  3. Select the Auditor role (read-only) — full trading permissions are not required for downloading data.
  4. Copy both the API Key and API Secret immediately; the secret is only shown once.

Configuration Example

import os

data_dir = os.path.expanduser('~/financial-data')

def CONFIG_gemini():
    return dict(
        module='finance_dl.gemini',
        credentials={
            'api_key': 'XXXXXX',
            'api_secret': 'XXXXXX',
        },
        output_directory=os.path.join(data_dir, 'gemini'),
    )
This scraper does not use Selenium. You do not need to configure profile_dir, headless, or ChromeDriver for Gemini.

Build docs developers (and LLMs) love