View Source Hyperliquid.Api.Info.OutcomeMeta (hyperliquid v0.3.0)

Prediction market (HIP-4) outcome metadata.

Returns every outcome and question known to the exchange, including the side specifications that define each outcome's YES/NO tokens.

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/hip-4-deployer-actions

Usage

{:ok, meta} = OutcomeMeta.request()
{:ok, outcome} = OutcomeMeta.find_outcome(meta, 7)

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.

List outcomes deployed by a specific address.

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

Creates a changeset for outcome metadata.

Fetch data and persist to configured storage backends.

Fetch data and persist. Raises on error.

Find an outcome by its numeric identifier.

Find a question by its numeric identifier.

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).

Check whether a question has fully settled — every named outcome is settled.

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.OutcomeMeta{outcomes: [map()], questions: [map()]}

Functions

Returns metadata about this endpoint.

Example

iex> Hyperliquid.Api.Info.OutcomeMeta.__endpoint_info__()
%{
  endpoint: "outcomeMeta",
  type: :info,
  rate_limit_cost: 2,
  params: [],
  optional_params: [],
  doc: "Retrieve prediction market outcome metadata",
  returns: "Outcomes and questions for HIP-4 prediction markets"
}

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_deployer(outcome_meta, deployer)

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

List outcomes deployed by a specific address.

Parameters

  • meta: The outcome meta struct
  • deployer: Deployer address

Returns

  • List of outcomes deployed by the address

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

Link to this function

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

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

Creates a changeset for outcome metadata.

Parameters

  • meta: The outcome meta struct
  • attrs: Map with outcomes and questions keys

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_outcome(outcome_meta, outcome)

View Source
@spec find_outcome(t(), non_neg_integer()) :: {:ok, map()} | {:error, :not_found}

Find an outcome by its numeric identifier.

Parameters

  • meta: The outcome meta struct
  • outcome: Outcome identifier

Returns

  • {:ok, outcome} if found
  • {:error, :not_found} otherwise
Link to this function

find_question(outcome_meta, question)

View Source
@spec find_question(t(), non_neg_integer()) :: {:ok, map()} | {:error, :not_found}

Find a question by its numeric identifier.

Parameters

  • meta: The outcome meta struct
  • question: Question identifier

Returns

  • {:ok, question} 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 question_settled?(map()) :: boolean()

Check whether a question has fully settled — every named outcome is settled.

Parameters

  • question: A question from the metadata

Returns

  • boolean()
@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.