View Source Hyperliquid.Api.Subscription.OutcomeMetaUpdates (hyperliquid v0.3.0)

WebSocket subscription for HIP-4 prediction market metadata changes.

Each event carries a list of updates, where every update is a single-key map naming what changed:

  • outcomeCreated - a new outcome, with its side specs and quote token
  • outcomeSettled - an outcome identifier that has settled
  • questionUpdated - a question's named outcomes or text changed
  • questionSettled - a question identifier that has settled

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

Usage

{:ok, request} = OutcomeMetaUpdates.build_request()
# => {:ok, %{type: "outcomeMetaUpdates"}}

Summary

Functions

Returns postgres table configurations (multi-table support).

Returns storage configuration for this subscription.

Returns metadata about this subscription endpoint.

Build a cache key from event data using the configured pattern.

Build a subscription request.

Returns true if cache storage is enabled.

Returns the configured cache fields for partial storage, or nil for all fields.

Returns the cache TTL if configured.

Generate a unique subscription key for this parameter set.

Split an event's updates by kind.

Returns true if postgres storage is enabled.

Returns the configured postgres fields for partial storage, or nil for all fields.

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

Outcome identifiers that settled in this event.

Question identifiers that settled in this event.

Returns true if any storage backend is enabled.

Types

@type request_params() :: %{}
@type t() :: %Hyperliquid.Api.Subscription.OutcomeMetaUpdates{updates: [map()]}

Functions

Returns postgres table configurations (multi-table support).

Returns storage configuration for this subscription.

Returns metadata about this subscription endpoint.

Link to this function

build_cache_key(event_data)

View Source

Build a cache key from event data using the configured pattern.

Returns nil if cache is not enabled or no pattern is configured.

Link to this function

build_request(params \\ %{})

View Source
@spec build_request(map()) :: {:ok, map()}

Build a subscription request.

Returns

  • {:ok, request_map} - Subscription request

Returns true if cache storage is enabled.

Returns the configured cache fields for partial storage, or nil for all fields.

Returns the cache TTL if configured.

Link to this function

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

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

generate_subscription_key(params)

View Source
@spec generate_subscription_key(map()) :: String.t()

Generate a unique subscription key for this parameter set.

Parameters

  • params - Map of subscription parameters

Returns

String key that uniquely identifies this subscription variant.

@spec group_updates(t() | map()) :: %{optional(String.t()) => [map()]}

Split an event's updates by kind.

Parameters

  • event: The subscription event

Returns

  • Map keyed by update kind, each holding the payloads of that kind

Examples

OutcomeMetaUpdates.group_updates(event)
# => %{"outcomeCreated" => [...], "questionSettled" => [...]}

Returns true if postgres storage is enabled.

Returns the configured postgres fields for partial storage, or nil for all fields.

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

@spec settled_outcomes(t() | map()) :: [non_neg_integer()]

Outcome identifiers that settled in this event.

Parameters

  • event: The subscription event

Returns

  • List of settled outcome identifiers
Link to this function

settled_questions(event)

View Source
@spec settled_questions(t() | map()) :: [non_neg_integer()]

Question identifiers that settled in this event.

Parameters

  • event: The subscription event

Returns

  • List of settled question identifiers

Returns true if any storage backend is enabled.