View Source Hyperliquid.Api.Info.UserFunding (hyperliquid v0.4.1)

User's funding payment history.

Returns funding payments received or paid by a user for perpetual positions.

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-a-users-funding-history-or-non-funding-ledger-updates

Usage

{:ok, funding} = UserFunding.request("0x...", 1700000000000)
{:ok, funding} = UserFunding.request("0x...", 1700000000000, endTime: 1700100000000)

Summary

Functions

Returns metadata about this endpoint.

Returns postgres table configurations (multi-table support).

Returns storage configuration for this endpoint.

Build a cache key from response data using the configured pattern. Returns nil if cache is not enabled or no pattern configured.

Build the request payload.

Get funding payments for a specific coin.

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

Fetch is an alias for request when no storage is configured.

Parse and validate the API response.

Returns true if postgres storage is enabled.

Returns the postgres table name if configured (primary table for legacy support).

Returns the upsert config for postgres (primary table for legacy support).

Get the rate limit cost for this endpoint.

Make the API request and parse the response.

Make the API request, raising on error.

Make the API request and return the raw response map (no key transformation).

Make the API request returning raw map, raising on error.

Returns true if any storage backend is enabled.

Get total funding amount in USDC.

Types

@type t() :: %Hyperliquid.Api.Info.UserFunding{payments: [Payment.t()]}

Functions

Returns metadata about this endpoint.

Example

iex> Hyperliquid.Api.Info.UserFunding.__endpoint_info__()
%{
  endpoint: "userFunding",
  type: :info,
  rate_limit_cost: 20,
  params: [:user, :startTime],
  optional_params: [:endTime],
  doc: "Retrieve a user's funding payment history",
  returns: "List of funding payment records"
}

Returns postgres table configurations (multi-table support).

Returns storage configuration for this endpoint.

Build a cache key from response data using the configured pattern. Returns nil if cache is not enabled or no pattern configured.

Link to this function

build_request(user, startTime, opts \\ [])

View Source
@spec build_request(term(), term(), keyword()) :: map()

Build the request payload.

Link to this function

by_coin(user_funding, coin)

View Source
@spec by_coin(t(), String.t()) :: [map()]

Get funding payments for a specific coin.

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

Link to this function

changeset(funding \\ %__MODULE__{}, attrs)

View Source
@spec changeset(t(), map()) :: Ecto.Changeset.t()
Link to this function

fetch(user, startTime, opts \\ [])

View Source

Fetch is an alias for request when no storage is configured.

Link to this function

fetch!(user, startTime, opts \\ [])

View Source
@spec parse_response(map()) :: {:ok, t()} | {:error, term()}

Parse and validate the API response.

Returns true if postgres storage is enabled.

Returns the postgres table name if configured (primary table for legacy support).

Link to this function

postgres_upsert_config()

View Source

Returns the upsert config for postgres (primary table for legacy support).

@spec rate_limit_cost() :: non_neg_integer()

Get the rate limit cost for this endpoint.

Link to this function

request(user, startTime, opts \\ [])

View Source
@spec request(term(), term(), keyword()) :: {:ok, t()} | {:error, term()}

Make the API request and parse the response.

Link to this function

request!(user, startTime, opts \\ [])

View Source
@spec request!(term(), term(), keyword()) :: t()

Make the API request, raising on error.

Link to this function

request_raw(user, startTime, opts \\ [])

View Source
@spec request_raw(term(), term(), keyword()) :: {:ok, map()} | {:error, term()}

Make the API request and return the raw response map (no key transformation).

Link to this function

request_raw!(user, startTime, opts \\ [])

View Source
@spec request_raw!(term(), term(), keyword()) :: map()

Make the API request returning raw map, raising on error.

Returns true if any storage backend is enabled.

Link to this function

total_funding(user_funding)

View Source
@spec total_funding(t()) :: {:ok, float()} | {:error, :parse_error}

Get total funding amount in USDC.