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

Exchange operational status.

Returns current status of the exchange including maintenance mode and block height.

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

Usage

{:ok, status} = ExchangeStatus.request()
if ExchangeStatus.operational?(status), do: IO.puts("Exchange is running")

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.

Creates a changeset for exchange status data.

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

Check if there are any special statuses.

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.

Get server time as DateTime.

Returns true if any storage backend is enabled.

Types

@type t() :: %Hyperliquid.Api.Info.ExchangeStatus{
  special_statuses: term(),
  time: non_neg_integer()
}

Functions

Returns metadata about this endpoint.

Example

iex> Hyperliquid.Api.Info.ExchangeStatus.__endpoint_info__()
%{
  endpoint: "exchangeStatus",
  type: :info,
  rate_limit_cost: 2,
  params: [],
  optional_params: [],
  doc: "Retrieve exchange operational status",
  returns: "Status object with maintenance mode and block height"
}

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.

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

Link to this function

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

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

Creates a changeset for exchange status data.

Parameters

  • status: The exchange status struct
  • attrs: Map of attributes to validate

Returns

  • Ecto.Changeset.t()

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

Link to this function

has_special_statuses?(exchange_status)

View Source
@spec has_special_statuses?(t()) :: boolean()

Check if there are any special statuses.

Parameters

  • status: The exchange status struct

Returns

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

Link to this function

server_datetime(exchange_status)

View Source
@spec server_datetime(t()) :: {:ok, DateTime.t()} | {:error, :invalid_time}

Get server time as DateTime.

Parameters

  • status: The exchange status struct

Returns

  • {:ok, DateTime.t()} if valid
  • {:error, :invalid_time} if conversion fails

Returns true if any storage backend is enabled.