View Source Hyperliquid.Api.Info.PerpConciseAnnotations (hyperliquid v0.3.1)

Concise category annotations for perp coins.

The API returns [coin, annotation] pairs; this module reshapes them into a list of annotation records keyed by coin.

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals

Usage

{:ok, annotations} = PerpConciseAnnotations.request()
{:ok, btc} = PerpConciseAnnotations.find(annotations, "BTC")

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.

Group coins by their category.

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

List the distinct categories present.

Creates a changeset for perp annotations.

Fetch data and persist to configured storage backends.

Fetch data and persist. Raises on error.

Find the annotation for a coin.

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.PerpConciseAnnotations{annotations: [map()]}

Functions

Returns metadata about this endpoint.

Example

iex> Hyperliquid.Api.Info.PerpConciseAnnotations.__endpoint_info__()
%{
  endpoint: "perpConciseAnnotations",
  type: :info,
  rate_limit_cost: 2,
  params: [],
  optional_params: [],
  doc: "Retrieve concise category annotations for perp coins",
  returns: "Per-coin category, display name and keywords"
}

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() :: map()

Build the request payload.

Link to this function

by_category(perp_concise_annotations)

View Source
@spec by_category(t()) :: %{optional(String.t()) => [String.t()]}

Group coins by their category.

Parameters

  • annotations: The annotations struct

Returns

  • Map of category to list of coin names

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

@spec categories(t()) :: [String.t()]

List the distinct categories present.

Parameters

  • annotations: The annotations struct

Returns

  • Sorted list of category names
Link to this function

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

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

Creates a changeset for perp annotations.

Parameters

  • annotations: The annotations struct
  • attrs: Map with an annotations key

Returns

  • Ecto.Changeset.t()
@spec fetch() :: {:ok, t()} | {:error, term()}

Fetch data and persist to configured storage backends.

This calls request/0 and then stores the result using Storage.Writer.

@spec fetch!() :: t()

Fetch data and persist. Raises on error.

Link to this function

find(perp_concise_annotations, coin)

View Source
@spec find(t(), String.t()) :: {:ok, map()} | {:error, :not_found}

Find the annotation for a coin.

Parameters

  • annotations: The annotations struct
  • coin: Coin name

Returns

  • {:ok, annotation} if found
  • {:error, :not_found} otherwise
@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.

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

Make the API request and parse the response.

@spec request!() :: t()

Make the API request, raising on error.

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

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

@spec request_raw!() :: map()

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

Returns true if any storage backend is enabled.