View Source Hyperliquid.Api.Info.UserRateLimit (hyperliquid v0.2.2)

User's rate limit status.

Returns current rate limit usage and limits.

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-user-rate-limits

Usage

{:ok, limit} = UserRateLimit.request("0x...")
IO.puts("Used: #{UserRateLimit.usage_percent(limit)}%")

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.

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.

Types

@type t() :: %Hyperliquid.Api.Info.UserRateLimit{
  cum_vlm: String.t(),
  n_requests_cap: non_neg_integer(),
  n_requests_surplus: non_neg_integer(),
  n_requests_used: non_neg_integer()
}

Functions

Returns metadata about this endpoint.

Example

iex> Hyperliquid.Api.Info.UserRateLimit.__endpoint_info__()
%{
  endpoint: "userRateLimit",
  type: :info,
  rate_limit_cost: 20,
  params: [:user],
  optional_params: [],
  doc: "Query user rate limit status",
  returns: "UserRateLimit with usage and cap"
}

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.

@spec build_request(term()) :: map()

Build the request payload.

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

Link to this function

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

View Source
@spec changeset(t(), map()) :: Ecto.Changeset.t()

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

@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

remaining(user_rate_limit)

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

Make the API request and parse the response.

@spec request!(term()) :: t()

Make the API request, raising on error.

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

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

@spec request_raw!(term()) :: map()

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

Returns true if any storage backend is enabled.

@spec usage_percent(t()) :: float()