# `Geminex.API.Private`
[🔗](https://github.com/mpol1t/geminex/blob/v0.1.1/lib/geminex/api/private.ex#L1)

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 **{:ok, result}** or **{:error, reason}**.

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")

# `account_detail`

```elixir
@spec account_detail(opts :: [{:account, String.t()}]) ::
  {:ok, map()} | {:error, any()}
```

Fetches account details, including user and account information.

## Parameters

  - **opts** : Additional options.
    - **:account** : Specifies the sub-account.

# `account_margin`

```elixir
@spec account_margin(symbol :: String.t(), opts :: [{:account, String.t()}]) ::
  {:ok, map()} | {:error, any()}
```

Retrieves margin details for a specific symbol.

## Parameters

  - **symbol** : The trading pair symbol (e.g., **"BTC-GUSD-PERP"**).
  - **opts** : Additional options.
    - **:account** : Specifies the sub-account. This is required if using a master API key.

# `active_orders`

```elixir
@spec active_orders(opts :: [{:account, String.t()}]) ::
  {:ok, [map()]} | {:error, any()}
```

Retrieves all active (live) orders associated with the account.

## Parameters

  - **opts** : Additional options.
    - **:account** : Specifies the sub-account, required if using a master API key.

# `add_bank`

```elixir
@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** : Bank account number.
  - **routing** : Routing number.
  - **type** : Type of bank account, either **"checking"** or **"savings"**.
  - **name** : Name on the bank account.
  - **opts** : Additional options.
    - **:account** : Specifies the sub-account.

# `add_bank_cad`

```elixir
@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** : SWIFT code.
  - **account_number** : Bank account number.
  - **type** : Type of bank account, either "checking" or "savings".
  - **name** : Name on the bank account.
  - **opts** : Additional options.
    - **:institution_number** : Institution number of the account.
    - **:branch_number** : Branch number of the account.
    - **:account** : Specifies the sub-account.

# `available_balances`

```elixir
@spec available_balances(opts :: [{:account, String.t()}]) ::
  {:ok, [map()]} | {:error, any()}
```

Fetches available balances in supported currencies.

## Parameters

  - **opts** : Additional options.
    - **:account** : Specifies the sub-account.

# `cancel_all_active_orders`

```elixir
@spec cancel_all_active_orders(opts :: [{:account, String.t()}]) ::
  {:ok, map()} | {:error, any()}
```

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** : Additional options.
    - **:account** : Specifies the sub-account, required if using a master API key.

# `cancel_all_session_orders`

```elixir
@spec cancel_all_session_orders(opts :: [{:account, String.t()}]) ::
  {:ok, map()} | {:error, any()}
```

Cancels all orders opened by this session.

If "Require Heartbeat" is enabled for the session, this function behaves as a heartbeat expiration.

## Parameters

  - **opts** : Additional options.
    - **:account** : Specifies the sub-account, required if using a master API key.

# `cancel_clearing_order`

```elixir
@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** : Additional options.
    - **:account** : Specifies the sub-account.

# `cancel_order`

```elixir
@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** : The ID of the order to cancel.
  - **opts** : A list of additional options.
    - **:account** : 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

  - **{:ok, map}** on success, containing the response details of the canceled order.
  - **{:error, any}** on failure, with an error reason.

# `clearing_broker_list`

```elixir
@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** : Filter options for broker clearing orders.
    - **:symbol** : Trading pair symbol.
    - **:expiration_start** : Start timestamp for expiration filter.
    - **:expiration_end** : End timestamp for expiration filter.
    - **:submission_start** : Start timestamp for submission filter.
    - **:submission_end** : End timestamp for submission filter.
    - **:funded** : Whether the order is funded.
    - **:account** : Specifies the sub-account.

# `clearing_order_list`

```elixir
@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** : "buy" or "sell" (required).
  - **opts** : Filter options for the clearing orders.
    - **:symbol** : Trading pair symbol.
    - **:counterparty** : Counterparty ID or alias.
    - **:expiration_start** : Start timestamp for expiration filter.
    - **:expiration_end** : End timestamp for expiration filter.
    - **:submission_start** : Start timestamp for submission filter.
    - **:submission_end** : End timestamp for submission filter.
    - **:funded** : Whether the order is funded.
    - **:account** : Specifies the sub-account.

# `clearing_order_status`

```elixir
@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** : Additional options.
    - **:account** : Specifies the sub-account.

# `clearing_trades`

```elixir
@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** : Filter options for clearing trades.
    - **:timestamp_nanos** : Only return trades on or after this timestamp in nanoseconds.
    - **:limit** : The maximum number of trades to return.
    - **:account** : Specifies the sub-account.

# `confirm_clearing_order`

```elixir
@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** : Additional options.
    - **:account** : Specifies the sub-account.

# `create_account`

```elixir
@spec create_account(name :: String.t(), opts :: [{:type, String.t()}]) ::
  {:ok, map()} | {:error, any()}
```

Creates a new account within the master group.

## Parameters

  - **name** : A unique name for the new account.
  - **opts** : Additional options.
    - **:type** : Type of account. Accepts **"exchange"** or **"custody"**. Defaults to **"exchange"**.

# `create_address_request`

```elixir
@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** : The network for the address, e.g., "ethereum", "bitcoin".
  - **address** : The address to add to the approved address list.
  - **label** : The label for the approved address.
  - **opts** : Additional options.
    - **:account** : Specifies the sub-account.
    - **:memo** : Memo for specific address formats, e.g., Cosmos.

# `custody_account_fees`

```elixir
@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** : Options for filtering custody fees.
    - **:timestamp** : Only return Custody fee records on or after this timestamp.
    - **:limit_transfers** : The maximum number of Custody fee records to return.
    - **:account** : Specifies the sub-account.

# `deposit_addresses`

```elixir
@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** : Cryptocurrency network (e.g., "bitcoin", "ethereum").
  - **opts** : Additional options.
    - **:timestamp** : Only return addresses created on or after this timestamp.
    - **:account** : Specifies the sub-account.

# `estimate_gas_fee`

```elixir
@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** : The cryptocurrency code (e.g., "eth").
  - **address** : Destination cryptocurrency address.
  - **amount** : The amount to withdraw.
  - **opts** : Additional options.
    - **:account** : Specifies the sub-account.

# `execute_internal_transfer`

```elixir
@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** : Currency code (e.g., "btc").
  - **source_account** : The account to transfer funds from.
  - **target_account** : The account to transfer funds to.
  - **amount** : The amount to transfer.
  - **opts** : Additional options.
    - **:client_transfer_id** : Unique identifier for the transfer.

# `funding_payment`

```elixir
@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** : Options to customize the funding payment query.
    - **:since** : The starting timestamp for the funding payments.
    - **:to** : The ending timestamp for the funding payments.
    - **:account** : Specifies the sub-account. This is required if using a master API key.

# `funding_payment_report_file`

```elixir
@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** : Options to customize the data retrieval.
    - **:from_date** : Start date for the records in **YYYY-MM-DD** format.
    - **:to_date** : End date for the records in **YYYY-MM-DD** format.
    - **:num_rows** : Maximum number of rows to retrieve (default 8760).

# `funding_payment_report_json`

```elixir
@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** : Options to customize the data retrieval.
    - **:from_date** : Start date for the records in **YYYY-MM-DD** format.
    - **:to_date** : End date for the records in **YYYY-MM-DD** format.
    - **:num_rows** : Maximum number of rows to retrieve (default 8760).

# `fx_rate`

```elixir
@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`

```elixir
@spec heartbeat() :: {:ok, map()} | {:error, any()}
```

Sends a heartbeat to prevent session timeout when the require heartbeat flag is set.

# `list_accounts`

```elixir
@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** : Options for filtering the account list.
    - **:limit_accounts** : Max number of accounts to return. Default is 500.
    - **:timestamp** : Only return accounts created on or before this timestamp.

# `new_broker_order`

```elixir
@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** : The trading pair symbol.
  - **amount** : The amount to purchase as a string.
  - **price** : The price per unit as a string.
  - **side** : **"buy"** or **"sell"**.
  - **source_counterparty_id** : The counterparty initiating the trade.
  - **target_counterparty_id** : The target counterparty.
  - **opts** : Additional options for the broker order.
    - **:expires_in_hrs** : Number of hours before the trade expires.
    - **:account** : Specifies the broker sub-account.

# `new_clearing_order`

```elixir
@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** : The trading pair symbol for the order (e.g., **"btcusd"**).
  - **amount** : The amount to purchase as a string.
  - **price** : The price per unit as a string.
  - **side** : **"buy"** or **"sell"**.
  - **opts** : Additional options for the clearing order.
    - **:counterparty_id** : ID of the counterparty for this trade.
    - **:expires_in_hrs** : Number of hours before the trade expires.
    - **:account** : Specifies the sub-account.

# `new_deposit_address`

```elixir
@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** : Cryptocurrency network (e.g., "bitcoin", "litecoin").
  - **opts** : Additional options.
    - **:label** : Label for the deposit address.
    - **:legacy** : Whether to generate a legacy P2SH-P2PKH litecoin address.
    - **:account** : Specifies the sub-account.

# `new_order`

```elixir
@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** : The trading pair symbol (e.g., **"btcusd"**).
  - **amount** : The amount to purchase as a string.
  - **price** : The limit price per unit as a string.
  - **side** : Order side, either **"buy"** or **"sell"**.
  - **type** : Order type, e.g., **"exchange limit"** or **"exchange stop limit"**.
  - **opts** : Optional settings for the order.
    - **:client_order_id** : A custom client ID for the order.
    - **:stop_price** : The stop price for stop-limit orders.
    - **:options** : List of order execution options (e.g., **["maker-or-cancel"]**).
    - **:account** : Specifies the sub-account (required for master API keys).

## Returns

  - **{:ok, map}** on success, containing order details.
  - **{:error, any}** on failure, with an error reason.

# `notional_balances`

```elixir
@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** : Three-letter fiat currency code for notional values (e.g., "usd").
  - **opts** : Additional options.
    - **:account** : Specifies the sub-account.

# `notional_volume`

```elixir
@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** : Additional options.
    - **:symbol** : The participating symbol for fee promotions (e.g., "btcusd").
    - **:account** : Specifies the sub-account, required if using a master API key.

# `open_positions`

```elixir
@spec open_positions(opts :: [{:account, String.t()}]) ::
  {:ok, [map()]} | {:error, any()}
```

Retrieves all open positions for the account.

## Parameters

  - **opts** : Additional options.
    - **:account** : Specifies the sub-account. This is required if using a master API key.

# `order_status`

```elixir
@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** : Options for specifying order details.
    - **:order_id** : The order ID to retrieve status for. Cannot be used with **client_order_id**.
    - **:client_order_id** : The client-specified order ID used during order placement. Cannot be used with **order_id**.
    - **:include_trades** : If **true**, includes trade details for all fills associated with the order.
    - **:account** : Specifies the sub-account, required if using a master API key.

# `orders_history`

```elixir
@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** : Options to customize the order retrieval.
    - **:symbol** : The symbol to retrieve orders for (e.g., "btcusd").
    - **:limit_orders** : Maximum number of orders to return (default 50, max 500).
    - **:timestamp** : Only return orders on or after this timestamp.
    - **:account** : Specifies the sub-account, required if using a master API key.

# `past_trades`

```elixir
@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** : Options to customize the trade retrieval.
    - **:symbol** : The symbol to retrieve trades for (e.g., "btcusd").
    - **:limit_trades** : Maximum number of trades to return (default 50, max 500).
    - **:timestamp** : Only return trades on or after this timestamp.
    - **:account** : Specifies the sub-account, required if using a master API key.

# `payment_methods`

```elixir
@spec payment_methods(opts :: [{:account, String.t()}]) ::
  {:ok, map()} | {:error, any()}
```

Fetches payment methods and available fiat balances.

## Parameters

  - **opts** : Additional options.
    - **:account** : Specifies the sub-account.

# `remove_address`

```elixir
@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** : The network for the address, e.g., "ethereum".
  - **address** : The address to remove from the approved address list.
  - **opts** : Additional options.
    - **:account** : Specifies the sub-account.

# `rename_account`

```elixir
@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** : Short name of the existing account.
  - **opts** : Additional options for renaming the account.
    - **:new_name** : New unique name for the account.
    - **:new_account** : New unique short name for the account.

# `risk_stats`

```elixir
@spec risk_stats(symbol :: String.t()) :: {:ok, map()} | {:error, any()}
```

Retrieves risk statistics for a specified symbol.

## Parameters

  - **symbol** : The trading pair symbol (e.g., **"BTCGUSDPERP"**).

# `stake`

```elixir
@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** : The provider ID in UUID4 format.
  - **currency** : The currency to deposit, e.g., "ETH".
  - **amount** : Amount of currency to deposit.
  - **opts** : Additional options.
    - **:account** : Specifies the sub-account.

# `staking_balances`

```elixir
@spec staking_balances(opts :: [{:account, String.t()}]) ::
  {:ok, [map()]} | {:error, any()}
```

Retrieves the staking balances for the account.

## Parameters

  - **opts** : Additional options.
    - **:account** : Specifies the sub-account.

# `staking_history`

```elixir
@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** : Options for filtering staking history.
    - **:since** : Start date in ISO datetime format.
    - **:until** : End date in ISO datetime format, defaults to the current time.
    - **:limit** : Max number of transactions to return.
    - **:provider_id** : ID of the provider.
    - **:currency** : Currency code, e.g., "ETH".
    - **:interest_only** : Set to true to only return daily interest transactions.
    - **:sort_asc** : Set to true to sort transactions in ascending order.
    - **:account** : Specifies the sub-account.

# `staking_rates`

```elixir
@spec staking_rates() :: {:ok, map()} | {:error, any()}
```

Fetches current staking interest rates for specified assets or all assets if no specific asset is provided.

# `staking_rewards`

```elixir
@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** : Start date in ISO datetime format.
  - **opts** : Additional options.
    - **:until** : End date in ISO datetime format. Defaults to the current time.
    - **:provider_id** : ID of the provider.
    - **:currency** : Currency code, e.g., "ETH".
    - **:account** : Specifies the sub-account (required for Master API keys).

# `trade_volume`

```elixir
@spec trade_volume(opts :: [{:account, String.t()}]) ::
  {:ok, [map()]} | {:error, any()}
```

Retrieves the trade volume data for the account over the past 30 days.

## Parameters

  - **opts** : Additional options.
    - **:account** : Specifies the sub-account. This is required if using a master API key.

# `transactions`

```elixir
@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** : Options for filtering transactions.
    - **:timestamp_nanos** : Only return transactions on or after this timestamp in nanoseconds.
    - **:limit** : Maximum number of transactions to return (default is 100).
    - **:continuation_token** : Token for pagination in subsequent requests.
    - **:account** : Specifies the sub-account.

# `transfers`

```elixir
@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** : Options for filtering transfers.
    - **:currency** : Currency code to filter transfers.
    - **:timestamp** : Only return transfers on or after this timestamp.
    - **:limit_transfers** : Maximum number of transfers to return.
    - **:show_completed_deposit_advances** : Whether to show completed deposit advances.
    - **:account** : Specifies the sub-account.

# `unstake`

```elixir
@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** : The provider ID in UUID4 format.
  - **currency** : The currency to withdraw, e.g., "ETH".
  - **amount** : Amount of currency to withdraw.
  - **opts** : Additional options.
    - **:account** : Specifies the sub-account.

# `view_approved_addresses`

```elixir
@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** : The network to view the approved address list for, e.g., "ethereum".
  - **opts** : Additional options.
    - **:account** : Specifies the sub-account.

# `withdraw_crypto_funds`

```elixir
@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** : The cryptocurrency code (e.g., "btc").
  - **address** : The destination cryptocurrency address.
  - **amount** : The amount to withdraw.
  - **opts** : Additional options.
    - **:client_transfer_id** : Unique identifier for the withdrawal.
    - **:memo** : Memo for addresses requiring it.
    - **:account** : Specifies the sub-account.

# `wrap_order`

```elixir
@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** : The trading pair symbol for the asset to be wrapped or unwrapped (e.g., **"GUSDUSD"**).
  - **amount** : The amount to be wrapped or unwrapped, specified as a string.
  - **side** : The direction of the transaction, either **"buy"** (to wrap) or **"sell"** (to unwrap).
  - **opts** : Additional options for the transaction.
    - **:account** : Specifies the sub-account, required if using a master API key.
    - **:client_order_id** : A custom client ID for tracking the order.

## Returns

  - **{:ok, map}** on success, containing details of the wrap or unwrap transaction.
  - **{:error, any}** on failure, with an error reason.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
