View Source Hyperliquid.Api.Info.FundingHistory (hyperliquid v0.2.2)
Historical funding rates for an asset.
Returns historical funding rate records for a perpetual asset.
Usage
{:ok, history} = FundingHistory.request("BTC", 1700000000000)
{:ok, rates} = FundingHistory.rates(history)
Summary
Functions
Returns metadata about this endpoint.
Returns postgres table configurations (multi-table support).
Returns storage configuration for this endpoint.
Get average funding rate.
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.
Returns true if cache storage is enabled.
Returns the cache TTL if configured.
Creates a changeset for funding history data.
Fetch is an alias for request when no storage is configured.
Get records within a time range.
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.
Get all funding rate records.
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.
Types
@type t() :: %Hyperliquid.Api.Info.FundingHistory{records: [Record.t()]}
Functions
Returns metadata about this endpoint.
Example
iex> Hyperliquid.Api.Info.FundingHistory.__endpoint_info__()
%{
endpoint: "fundingHistory",
type: :info,
rate_limit_cost: 2,
params: [:coin, :start_time],
optional_params: [:end_time],
doc: "Retrieve historical funding rates for an asset",
returns: "Historical funding rate records for a perpetual asset"
}
Returns postgres table configurations (multi-table support).
Returns storage configuration for this endpoint.
Get average funding rate.
Parameters
history: The funding history struct
Returns
{:ok, float()}- Average funding rate{:error, :no_records}- If no records{:error, :parse_error}- If parsing fails
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.
Returns true if cache storage is enabled.
Returns the cache TTL if configured.
@spec changeset(t(), map()) :: Ecto.Changeset.t()
Creates a changeset for funding history data.
Parameters
history: The funding history structattrs: Map with payments data
Returns
Ecto.Changeset.t()
Fetch is an alias for request when no storage is configured.
@spec in_range(t(), non_neg_integer(), non_neg_integer()) :: [map()]
Get records within a time range.
Parameters
history: The funding history structstart_time: Start timestamp in msend_time: End timestamp in ms
Returns
- List of records in range
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).
@spec rate_limit_cost() :: non_neg_integer()
Get the rate limit cost for this endpoint.
Get all funding rate records.
Parameters
history: The funding history struct
Returns
- List of funding rate records
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.