Geminex.API.Private (geminex v0.0.3)
Private API endpoints for Gemini.
This module provides functions to interact with Gemini's private REST API. Each function corresponds to a specific endpoint and handles the HTTP requests and responses, returning either or .
The base URL and API keys are determined by the :environment, :api_key, and :api_secret configurations in your application config.
Configuration
Add the following to your config/config.exs:
config :geminex,
environment: :sandbox,
api_key: System.get_env("GEMINI_API_KEY"),
api_secret: System.get_env("GEMINI_API_SECRET")
Summary
Functions
Fetches account details, including user and account information.
Retrieves margin details for a specific symbol.
Retrieves all active (live) orders associated with the account.
Adds a bank account for the user.
Adds a CAD bank account for the user.
Fetches available balances in supported currencies.
Cancels all outstanding orders created by any session associated with this account, including those placed via the UI.
Cancels all orders opened by this session.
Cancels a specific clearing order.
Cancels an existing order by order ID.
Retrieves a list of broker clearing orders with optional filters.
Retrieves a list of clearing orders with optional filters.
Fetches the status of a clearing order by its unique clearing ID.
Retrieves a list of clearing trades with optional filters.
Confirms a clearing order with the provided details.
Creates a new account within the master group.
Creates a request to add an address to the approved address list.
Fetches custody account fees.
Retrieves deposit addresses for a specified network.
Estimates gas fees for a cryptocurrency withdrawal.
Executes an internal transfer between two accounts.
Retrieves funding payment history within a specified time range.
Retrieves funding payment data as an Excel file for a specified date range and row limit.
Retrieves funding payment data as JSON for a specified date range and row limit.
Retrieves the historical FX rate for a specific currency pair against USD at a given timestamp.
Sends a heartbeat to prevent session timeout when the require heartbeat flag is set.
Fetches a list of accounts within the master group.
Creates a new broker clearing order between two counterparties.
Creates a new clearing order with optional counterparty and expiration details.
Generates a new deposit address for a specified network.
Places a new order with specified parameters and optional settings.
Fetches balances and their notional values in a specified currency.
Retrieves the 30-day notional volume and fee details for the account.
Retrieves all open positions for the account.
Retrieves the status of a specific order, identified by either order_id or client_order_id.
Retrieves a history of closed orders for a specific symbol.
Retrieves past trades for a specific symbol.
Fetches payment methods and available fiat balances.
Removes an address from the approved address list.
Renames an account within the master group.
Retrieves risk statistics for a specified symbol.
Initiates a staking deposit.
Retrieves the staking balances for the account.
Retrieves staking transaction history, including deposits, redemptions, and interest accruals.
Fetches current staking interest rates for specified assets or all assets if no specific asset is provided.
Retrieves staking rewards, showing historical payments and accrual data.
Retrieves the trade volume data for the account over the past 30 days.
Fetches transaction details, including trades and transfers.
Retrieves transfer history, including deposits and withdrawals.
Initiates a staking withdrawal.
Views the approved address list for a specific network.
Withdraws cryptocurrency funds to an approved address.
Wraps or unwraps Gemini-issued assets.
Functions
account_detail(opts \\ [])
Fetches account details, including user and account information.
Parameters
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
account_margin(symbol, opts \\ [])
@spec account_margin(symbol :: String.t(), opts :: [{:account, String.t()}]) :: {:ok, map()} | {:error, any()}
Retrieves margin details for a specific symbol.
Parameters
- symbol (String.t()): The trading pair symbol (e.g., "BTC-GUSD-PERP").
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account. This is required if using a master API key.
active_orders(opts \\ [])
Retrieves all active (live) orders associated with the account.
Parameters
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account, required if using a master API key.
add_bank(account_number, routing, type, name, opts \\ [])
@spec add_bank( account_number :: String.t(), routing :: String.t(), type :: String.t(), name :: String.t(), opts :: [{:account, String.t()}] ) :: {:ok, map()} | {:error, any()}
Adds a bank account for the user.
Parameters
- account_number (String.t()): Bank account number.
- routing (String.t()): Routing number.
- type (String.t()): Type of bank account, either "checking" or "savings".
- name (String.t()): Name on the bank account.
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
add_bank_cad(swift_code, account_number, type, name, opts \\ [])
@spec add_bank_cad( swift_code :: String.t(), account_number :: String.t(), type :: String.t(), name :: String.t(), opts :: [ institution_number: String.t(), branch_number: String.t(), account: String.t() ] ) :: {:ok, map()} | {:error, any()}
Adds a CAD bank account for the user.
Parameters
- swift_code (String.t()): SWIFT code.
- account_number (String.t()): Bank account number.
- type (String.t()): Type of bank account, either "checking" or "savings".
- name (String.t()): Name on the bank account.
- opts (keyword list, optional): Additional options.
- :institution_number (String.t()): Institution number of the account.
- :branch_number (String.t()): Branch number of the account.
- :account (String.t()): Specifies the sub-account.
available_balances(opts \\ [])
Fetches available balances in supported currencies.
Parameters
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
cancel_all_active_orders(opts \\ [])
Cancels all outstanding orders created by any session associated with this account, including those placed via the UI.
Generally, it is recommended to use cancel_all_session_orders to only cancel orders related to the current session.
Parameters
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account, required if using a master API key.
cancel_all_session_orders(opts \\ [])
Cancels all orders opened by this session.
If "Require Heartbeat" is enabled for the session, this function behaves as a heartbeat expiration.
Parameters
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account, required if using a master API key.
cancel_clearing_order(clearing_id, opts \\ [])
@spec cancel_clearing_order( clearing_id :: String.t(), opts :: [{:account, String.t()}] ) :: {:ok, map()} | {:error, any()}
Cancels a specific clearing order.
Parameters
- clearing_id: The unique identifier of the clearing order.
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
cancel_order(order_id, opts \\ [])
@spec cancel_order( order_id :: non_neg_integer(), opts :: [{:account, String.t()}] ) :: {:ok, map()} | {:error, any()}
Cancels an existing order by order ID.
Parameters
- order_id (non_neg_integer()): The ID of the order to cancel.
- opts (keyword list, optional): A list of additional options.
- :account (String.t()): Specifies the name of the account within the subaccount group. This is required if using a Master API key.
Behavior
If the order has already been canceled, this request will succeed but have no effect. The order status will remain unchanged.
Returns
- on success, containing the response details of the canceled order.
- on failure, with an error reason.
clearing_broker_list(opts \\ [])
@spec clearing_broker_list( opts :: [ symbol: String.t(), expiration_start: non_neg_integer(), expiration_end: non_neg_integer(), submission_start: non_neg_integer(), submission_end: non_neg_integer(), funded: boolean(), account: String.t() ] ) :: {:ok, map()} | {:error, any()}
Retrieves a list of broker clearing orders with optional filters.
Parameters
- opts (keyword list, optional): Filter options for broker clearing orders.
- :symbol (String.t()): Trading pair symbol.
- :expiration_start (non_neg_integer()): Start timestamp for expiration filter.
- :expiration_end (non_neg_integer()): End timestamp for expiration filter.
- :submission_start (non_neg_integer()): Start timestamp for submission filter.
- :submission_end (non_neg_integer()): End timestamp for submission filter.
- :funded (boolean()): Whether the order is funded.
- :account (String.t()): Specifies the sub-account.
clearing_order_list(side, opts \\ [])
@spec clearing_order_list( side :: String.t(), opts :: [ symbol: String.t(), counterparty: String.t(), expiration_start: non_neg_integer(), expiration_end: non_neg_integer(), submission_start: non_neg_integer(), submission_end: non_neg_integer(), funded: boolean(), account: String.t() ] ) :: {:ok, map()} | {:error, any()}
Retrieves a list of clearing orders with optional filters.
Parameters
- side (String.t()): "buy" or "sell" (required).
- opts (keyword list, optional): Filter options for the clearing orders.
- :symbol (String.t()): Trading pair symbol.
- :counterparty (String.t()): Counterparty ID or alias.
- :expiration_start (non_neg_integer()): Start timestamp for expiration filter.
- :expiration_end (non_neg_integer()): End timestamp for expiration filter.
- :submission_start (non_neg_integer()): Start timestamp for submission filter.
- :submission_end (non_neg_integer()): End timestamp for submission filter.
- :funded (boolean()): Whether the order is funded.
- :account (String.t()): Specifies the sub-account.
clearing_order_status(clearing_id, opts \\ [])
@spec clearing_order_status( clearing_id :: String.t(), opts :: [{:account, String.t()}] ) :: {:ok, map()} | {:error, any()}
Fetches the status of a clearing order by its unique clearing ID.
Parameters
- clearing_id: A unique identifier for the clearing order.
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
clearing_trades(opts \\ [])
@spec clearing_trades( opts :: [ timestamp_nanos: non_neg_integer(), limit: non_neg_integer(), account: String.t() ] ) :: {:ok, map()} | {:error, any()}
Retrieves a list of clearing trades with optional filters.
Parameters
- opts (keyword list, optional): Filter options for clearing trades.
- :timestamp_nanos (non_neg_integer()): Only return trades on or after this timestamp in nanoseconds.
- :limit (non_neg_integer()): The maximum number of trades to return.
- :account (String.t()): Specifies the sub-account.
confirm_clearing_order(clearing_id, symbol, amount, price, side, opts \\ [])
@spec confirm_clearing_order( clearing_id :: String.t(), symbol :: String.t(), amount :: String.t(), price :: String.t(), side :: String.t(), opts :: [{:account, String.t()}] ) :: {:ok, map()} | {:error, any()}
Confirms a clearing order with the provided details.
Parameters
- clearing_id: The unique identifier of the clearing order.
- symbol: The trading pair symbol.
- amount: The amount to purchase as a string.
- price: The price per unit as a string.
- side: "buy" or "sell".
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
create_account(name, opts \\ [type: "exchange"])
@spec create_account(name :: String.t(), opts :: [{:type, String.t()}]) :: {:ok, map()} | {:error, any()}
Creates a new account within the master group.
Parameters
- name (String.t()): A unique name for the new account.
- opts (keyword list, optional): Additional options.
- :type (String.t()): Type of account. Accepts "exchange" or "custody". Defaults to "exchange".
create_address_request(network, address, label, opts \\ [])
@spec create_address_request( network :: String.t(), address :: String.t(), label :: String.t(), opts :: [account: String.t(), memo: String.t()] ) :: {:ok, map()} | {:error, any()}
Creates a request to add an address to the approved address list.
Parameters
- network (String.t()): The network for the address, e.g., "ethereum", "bitcoin".
- address (String.t()): The address to add to the approved address list.
- label (String.t()): The label for the approved address.
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
- :memo (String.t()): Memo for specific address formats, e.g., Cosmos.
custody_account_fees(opts \\ [])
@spec custody_account_fees( opts :: [ timestamp: non_neg_integer(), limit_transfers: non_neg_integer(), account: String.t() ] ) :: {:ok, [map()]} | {:error, any()}
Fetches custody account fees.
Parameters
- opts (keyword list, optional): Options for filtering custody fees.
- :timestamp (non_neg_integer()): Only return Custody fee records on or after this timestamp.
- :limit_transfers (non_neg_integer()): The maximum number of Custody fee records to return.
- :account (String.t()): Specifies the sub-account.
deposit_addresses(network, opts \\ [])
@spec deposit_addresses( network :: String.t(), opts :: [timestamp: non_neg_integer(), account: String.t()] ) :: {:ok, [map()]} | {:error, any()}
Retrieves deposit addresses for a specified network.
Parameters
- network (String.t()): Cryptocurrency network (e.g., "bitcoin", "ethereum").
- opts (keyword list, optional): Additional options.
- :timestamp (non_neg_integer()): Only return addresses created on or after this timestamp.
- :account (String.t()): Specifies the sub-account.
estimate_gas_fee(currency, address, amount, opts \\ [])
@spec estimate_gas_fee( currency :: String.t(), address :: String.t(), amount :: String.t(), opts :: [{:account, String.t()}] ) :: {:ok, map()} | {:error, any()}
Estimates gas fees for a cryptocurrency withdrawal.
Parameters
- currency (String.t()): The cryptocurrency code (e.g., "eth").
- address (String.t()): Destination cryptocurrency address.
- amount (String.t()): The amount to withdraw.
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
execute_internal_transfer(currency, source_account, target_account, amount, opts \\ [])
@spec execute_internal_transfer( currency :: String.t(), source_account :: String.t(), target_account :: String.t(), amount :: String.t(), opts :: [{:client_transfer_id, String.t()}] ) :: {:ok, map()} | {:error, any()}
Executes an internal transfer between two accounts.
Parameters
- currency (String.t()): Currency code (e.g., "btc").
- source_account (String.t()): The account to transfer funds from.
- target_account (String.t()): The account to transfer funds to.
- amount (String.t()): The amount to transfer.
- opts (keyword list, optional): Additional options.
- :client_transfer_id (String.t()): Unique identifier for the transfer.
funding_payment(opts \\ [])
@spec funding_payment( opts :: [since: non_neg_integer(), to: non_neg_integer(), account: String.t()] ) :: {:ok, [map()]} | {:error, any()}
Retrieves funding payment history within a specified time range.
Parameters
- opts (keyword list, optional): Options to customize the funding payment query.
- :since (non_neg_integer()): The starting timestamp for the funding payments.
- :to (non_neg_integer()): The ending timestamp for the funding payments.
- :account (String.t()): Specifies the sub-account. This is required if using a master API key.
funding_payment_report_file(opts \\ [])
@spec funding_payment_report_file( opts :: [ from_date: String.t(), to_date: String.t(), num_rows: non_neg_integer() ] ) :: {:ok, binary()} | {:error, any()}
Retrieves funding payment data as an Excel file for a specified date range and row limit.
Parameters
- opts (keyword list, optional): Options to customize the data retrieval.
- :from_date (String.t()): Start date for the records in YYYY-MM-DD format.
- :to_date (String.t()): End date for the records in YYYY-MM-DD format.
- :num_rows (non_neg_integer()): Maximum number of rows to retrieve (default 8760).
funding_payment_report_json(opts \\ [])
@spec funding_payment_report_json( opts :: [ from_date: String.t(), to_date: String.t(), num_rows: non_neg_integer() ] ) :: {:ok, [map()]} | {:error, any()}
Retrieves funding payment data as JSON for a specified date range and row limit.
Parameters
- opts (keyword list, optional): Options to customize the data retrieval.
- :from_date (String.t()): Start date for the records in YYYY-MM-DD format.
- :to_date (String.t()): End date for the records in YYYY-MM-DD format.
- :num_rows (non_neg_integer()): Maximum number of rows to retrieve (default 8760).
fx_rate(symbol, timestamp)
@spec fx_rate(symbol :: String.t(), timestamp :: non_neg_integer()) :: {:ok, map()} | {:error, any()}
Retrieves the historical FX rate for a specific currency pair against USD at a given timestamp.
Parameters
- symbol: The currency pair symbol to check the USD FX rate against (e.g., "gbpusd").
- timestamp: The timestamp (in epoch format) for which the FX rate is requested.
heartbeat()
Sends a heartbeat to prevent session timeout when the require heartbeat flag is set.
list_accounts(opts \\ [limit_accounts: 500])
@spec list_accounts( opts :: [limit_accounts: non_neg_integer(), timestamp: non_neg_integer()] ) :: {:ok, [map()]} | {:error, any()}
Fetches a list of accounts within the master group.
Parameters
- opts (keyword list, optional): Options for filtering the account list.
- :limit_accounts (non_neg_integer()): Max number of accounts to return. Default is 500.
- :timestamp (non_neg_integer()): Only return accounts created on or before this timestamp.
new_broker_order(symbol, amount, price, side, source_counterparty_id, target_counterparty_id, opts \\ [])
@spec new_broker_order( symbol :: String.t(), amount :: String.t(), price :: String.t(), side :: String.t(), source_counterparty_id :: String.t(), target_counterparty_id :: String.t(), opts :: [expires_in_hrs: non_neg_integer(), account: String.t()] ) :: {:ok, map()} | {:error, any()}
Creates a new broker clearing order between two counterparties.
Parameters
- symbol (String.t()): The trading pair symbol.
- amount (String.t()): The amount to purchase as a string.
- price (String.t()): The price per unit as a string.
- side (String.t()): "buy" or "sell".
- source_counterparty_id (String.t()): The counterparty initiating the trade.
- target_counterparty_id (String.t()): The target counterparty.
- opts (keyword list, optional): Additional options for the broker order.
- :expires_in_hrs (non_neg_integer()): Number of hours before the trade expires.
- :account (String.t()): Specifies the broker sub-account.
new_clearing_order(symbol, amount, price, side, opts \\ [])
@spec new_clearing_order( symbol :: String.t(), amount :: String.t(), price :: String.t(), side :: String.t(), opts :: [ counterparty_id: String.t(), expires_in_hrs: non_neg_integer(), account: String.t() ] ) :: {:ok, map()} | {:error, any()}
Creates a new clearing order with optional counterparty and expiration details.
Parameters
- symbol (String.t()): The trading pair symbol for the order (e.g., "btcusd").
- amount (String.t()): The amount to purchase as a string.
- price (String.t()): The price per unit as a string.
- side (String.t()): "buy" or "sell".
- opts (keyword list, optional): Additional options for the clearing order.
- :counterparty_id (String.t()): ID of the counterparty for this trade.
- :expires_in_hrs (non_neg_integer()): Number of hours before the trade expires.
- :account (String.t()): Specifies the sub-account.
new_deposit_address(network, opts \\ [])
@spec new_deposit_address( network :: String.t(), opts :: [label: String.t(), legacy: boolean(), account: String.t()] ) :: {:ok, map()} | {:error, any()}
Generates a new deposit address for a specified network.
Parameters
- network (String.t()): Cryptocurrency network (e.g., "bitcoin", "litecoin").
- opts (keyword list, optional): Additional options.
- :label (String.t()): Label for the deposit address.
- :legacy (boolean()): Whether to generate a legacy P2SH-P2PKH litecoin address.
- :account (String.t()): Specifies the sub-account.
new_order(symbol, amount, price, side, type, opts \\ [])
@spec new_order( symbol :: String.t(), amount :: String.t(), price :: String.t(), side :: String.t(), type :: String.t(), opts :: [ client_order_id: String.t(), stop_price: String.t(), options: [String.t()], account: String.t() ] ) :: {:ok, map()} | {:error, any()}
Places a new order with specified parameters and optional settings.
Parameters
- symbol (String.t()): The trading pair symbol (e.g., "btcusd").
- amount (String.t()): The amount to purchase as a string.
- price (String.t()): The limit price per unit as a string.
- side (String.t()): Order side, either "buy" or "sell".
- type (String.t()): Order type, e.g., "exchange limit" or "exchange stop limit".
- opts (keyword list, optional): Optional settings for the order.
- :client_order_id (String.t()): A custom client ID for the order.
- :stop_price (String.t()): The stop price for stop-limit orders.
- :options (list(String.t())): List of order execution options (e.g., ["maker-or-cancel"]).
- :account (String.t()): Specifies the sub-account (required for master API keys).
Returns
- on success, containing order details.
- on failure, with an error reason.
notional_balances(currency, opts \\ [])
@spec notional_balances(currency :: String.t(), opts :: [{:account, String.t()}]) :: {:ok, [map()]} | {:error, any()}
Fetches balances and their notional values in a specified currency.
Parameters
- currency (String.t()): Three-letter fiat currency code for notional values (e.g., "usd").
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
notional_volume(opts \\ [])
@spec notional_volume(opts :: [symbol: String.t(), account: String.t()]) :: {:ok, map()} | {:error, any()}
Retrieves the 30-day notional volume and fee details for the account.
Parameters
- opts (keyword list, optional): Additional options.
- :symbol (String.t()): The participating symbol for fee promotions (e.g., "btcusd").
- :account (String.t()): Specifies the sub-account, required if using a master API key.
open_positions(opts \\ [])
Retrieves all open positions for the account.
Parameters
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account. This is required if using a master API key.
order_status(opts \\ [])
@spec order_status( opts :: [ order_id: non_neg_integer(), client_order_id: String.t(), include_trades: boolean(), account: String.t() ] ) :: {:ok, map()} | {:error, any()}
Retrieves the status of a specific order, identified by either order_id or client_order_id.
Parameters
- opts (keyword list, optional): Options for specifying order details.
- :order_id (non_neg_integer()): The order ID to retrieve status for. Cannot be used with client_order_id.
- :client_order_id (String.t()): The client-specified order ID used during order placement. Cannot be used with order_id.
- :include_trades (boolean()): If true, includes trade details for all fills associated with the order.
- :account (String.t()): Specifies the sub-account, required if using a master API key.
orders_history(opts \\ [])
@spec orders_history( opts :: [ symbol: String.t(), limit_orders: non_neg_integer(), timestamp: non_neg_integer(), account: String.t() ] ) :: {:ok, [map()]} | {:error, any()}
Retrieves a history of closed orders for a specific symbol.
Parameters
- opts (keyword list, optional): Options to customize the order retrieval.
- :symbol (String.t()): The symbol to retrieve orders for (e.g., "btcusd").
- :limit_orders (non_neg_integer()): Maximum number of orders to return (default 50, max 500).
- :timestamp (non_neg_integer()): Only return orders on or after this timestamp.
- :account (String.t()): Specifies the sub-account, required if using a master API key.
past_trades(opts \\ [])
@spec past_trades( opts :: [ symbol: String.t(), limit_trades: non_neg_integer(), timestamp: non_neg_integer(), account: String.t() ] ) :: {:ok, [map()]} | {:error, any()}
Retrieves past trades for a specific symbol.
Parameters
- opts (keyword list, optional): Options to customize the trade retrieval.
- :symbol (String.t()): The symbol to retrieve trades for (e.g., "btcusd").
- :limit_trades (non_neg_integer()): Maximum number of trades to return (default 50, max 500).
- :timestamp (non_neg_integer()): Only return trades on or after this timestamp.
- :account (String.t()): Specifies the sub-account, required if using a master API key.
payment_methods(opts \\ [])
Fetches payment methods and available fiat balances.
Parameters
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
remove_address(network, address, opts \\ [])
@spec remove_address( network :: String.t(), address :: String.t(), opts :: [{:account, String.t()}] ) :: {:ok, map()} | {:error, any()}
Removes an address from the approved address list.
Parameters
- network (String.t()): The network for the address, e.g., "ethereum".
- address (String.t()): The address to remove from the approved address list.
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
rename_account(account, opts \\ [])
@spec rename_account( account :: String.t(), opts :: [new_name: String.t(), new_account: String.t()] ) :: {:ok, map()} | {:error, any()}
Renames an account within the master group.
Parameters
- account (String.t()): Short name of the existing account.
- opts (keyword list, optional): Additional options for renaming the account.
- :new_name (String.t()): New unique name for the account.
- :new_account (String.t()): New unique short name for the account.
risk_stats(symbol)
Retrieves risk statistics for a specified symbol.
Parameters
- symbol (String.t()): The trading pair symbol (e.g., "BTCGUSDPERP").
stake(provider_id, currency, amount, opts \\ [])
@spec stake( provider_id :: String.t(), currency :: String.t(), amount :: String.t(), opts :: [{:account, String.t()}] ) :: {:ok, map()} | {:error, any()}
Initiates a staking deposit.
Parameters
- provider_id (String.t()): The provider ID in UUID4 format.
- currency (String.t()): The currency to deposit, e.g., "ETH".
- amount (String.t()): Amount of currency to deposit.
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
staking_balances(opts \\ [])
Retrieves the staking balances for the account.
Parameters
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
staking_history(opts \\ [])
@spec staking_history( opts :: [ since: String.t(), until: String.t(), limit: non_neg_integer(), provider_id: String.t(), currency: String.t(), interest_only: boolean(), sort_asc: boolean(), account: String.t() ] ) :: {:ok, [map()]} | {:error, any()}
Retrieves staking transaction history, including deposits, redemptions, and interest accruals.
Parameters
- opts (keyword list, optional): Options for filtering staking history.
- :since (String.t()): Start date in ISO datetime format.
- :until (String.t()): End date in ISO datetime format, defaults to the current time.
- :limit (non_neg_integer()): Max number of transactions to return.
- :provider_id (String.t()): ID of the provider.
- :currency (String.t()): Currency code, e.g., "ETH".
- :interest_only (boolean()): Set to true to only return daily interest transactions.
- :sort_asc (boolean()): Set to true to sort transactions in ascending order.
- :account (String.t()): Specifies the sub-account.
staking_rates()
Fetches current staking interest rates for specified assets or all assets if no specific asset is provided.
staking_rewards(since, opts \\ [])
@spec staking_rewards( since :: String.t(), opts :: [ until: String.t(), provider_id: String.t(), currency: String.t(), account: String.t() ] ) :: {:ok, map()} | {:error, any()}
Retrieves staking rewards, showing historical payments and accrual data.
Parameters
- since (String.t()): Start date in ISO datetime format.
- opts (keyword list, optional): Additional options.
- :until (String.t()): End date in ISO datetime format. Defaults to the current time.
- :provider_id (String.t()): ID of the provider.
- :currency (String.t()): Currency code, e.g., "ETH".
- :account (String.t()): Specifies the sub-account (required for Master API keys).
trade_volume(opts \\ [])
Retrieves the trade volume data for the account over the past 30 days.
Parameters
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account. This is required if using a master API key.
transactions(opts \\ [])
@spec transactions( opts :: [ timestamp_nanos: non_neg_integer(), limit: non_neg_integer(), continuation_token: String.t(), account: String.t() ] ) :: {:ok, map()} | {:error, any()}
Fetches transaction details, including trades and transfers.
Parameters
- opts (keyword list, optional): Options for filtering transactions.
- :timestamp_nanos (non_neg_integer()): Only return transactions on or after this timestamp in nanoseconds.
- :limit (non_neg_integer()): Maximum number of transactions to return (default is 100).
- :continuation_token (String.t()): Token for pagination in subsequent requests.
- :account (String.t()): Specifies the sub-account.
transfers(opts \\ [])
@spec transfers( opts :: [ currency: String.t(), timestamp: non_neg_integer(), limit_transfers: non_neg_integer(), show_completed_deposit_advances: boolean(), account: String.t() ] ) :: {:ok, [map()]} | {:error, any()}
Retrieves transfer history, including deposits and withdrawals.
Parameters
- opts (keyword list, optional): Options for filtering transfers.
- :currency (String.t()): Currency code to filter transfers.
- :timestamp (non_neg_integer()): Only return transfers on or after this timestamp.
- :limit_transfers (non_neg_integer()): Maximum number of transfers to return.
- :show_completed_deposit_advances (boolean()): Whether to show completed deposit advances.
- :account (String.t()): Specifies the sub-account.
unstake(provider_id, currency, amount, opts \\ [])
@spec unstake( provider_id :: String.t(), currency :: String.t(), amount :: String.t(), opts :: [{:account, String.t()}] ) :: {:ok, map()} | {:error, any()}
Initiates a staking withdrawal.
Parameters
- provider_id (String.t()): The provider ID in UUID4 format.
- currency (String.t()): The currency to withdraw, e.g., "ETH".
- amount (String.t()): Amount of currency to withdraw.
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
view_approved_addresses(network, opts \\ [])
@spec view_approved_addresses( network :: String.t(), opts :: [{:account, String.t()}] ) :: {:ok, map()} | {:error, any()}
Views the approved address list for a specific network.
Parameters
- network (String.t()): The network to view the approved address list for, e.g., "ethereum".
- opts (keyword list, optional): Additional options.
- :account (String.t()): Specifies the sub-account.
withdraw_crypto_funds(currency, address, amount, opts \\ [])
@spec withdraw_crypto_funds( currency :: String.t(), address :: String.t(), amount :: String.t(), opts :: [ client_transfer_id: String.t(), memo: String.t(), account: String.t() ] ) :: {:ok, map()} | {:error, any()}
Withdraws cryptocurrency funds to an approved address.
Parameters
- currency (String.t()): The cryptocurrency code (e.g., "btc").
- address (String.t()): The destination cryptocurrency address.
- amount (String.t()): The amount to withdraw.
- opts (keyword list, optional): Additional options.
- :client_transfer_id (String.t()): Unique identifier for the withdrawal.
- :memo (String.t()): Memo for addresses requiring it.
- :account (String.t()): Specifies the sub-account.
wrap_order(symbol, amount, side, opts \\ [])
@spec wrap_order( symbol :: String.t(), amount :: String.t(), side :: String.t(), opts :: [account: String.t(), client_order_id: String.t()] ) :: {:ok, map()} | {:error, any()}
Wraps or unwraps Gemini-issued assets.
Parameters
- symbol (String.t()): The trading pair symbol for the asset to be wrapped or unwrapped (e.g., "GUSDUSD").
- amount (String.t()): The amount to be wrapped or unwrapped, specified as a string.
- side (String.t()): The direction of the transaction, either "buy" (to wrap) or "sell" (to unwrap).
- opts (keyword list, optional): Additional options for the transaction.
- :account (String.t()): Specifies the sub-account, required if using a master API key.
- :client_order_id (String.t()): A custom client ID for tracking the order.
Returns
- on success, containing details of the wrap or unwrap transaction.
- on failure, with an error reason.