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

Historical orders for a user.

Returns all historical orders including filled, canceled, and rejected orders.

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-historical-orders

Usage

{:ok, orders} = HistoricalOrders.request("0x1234...")
filled = HistoricalOrders.filled(orders)

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.

Filter orders by coin.

Filter orders by status.

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

Get canceled orders only.

Creates a changeset for historical orders data.

Fetch data and persist to configured storage backends.

Fetch data and persist. Raises on error.

Get filled orders only.

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.

Get valid order statuses.

Types

@type t() :: %Hyperliquid.Api.Info.HistoricalOrders{orders: [OrderRecord.t()]}

Functions

Returns metadata about this endpoint.

Example

iex> Hyperliquid.Api.Info.HistoricalOrders.__endpoint_info__()
%{
  endpoint: "historicalOrders",
  type: :info,
  rate_limit_cost: 2,
  params: [:user],
  optional_params: [],
  doc: "Retrieve historical orders for a user",
  returns: "All historical orders including filled, canceled, and rejected orders"
}

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.

Link to this function

by_coin(historical_orders, coin)

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

Filter orders by coin.

Parameters

  • historical: The historical orders struct
  • coin: Coin symbol

Returns

  • List of order records for the coin
Link to this function

by_status(historical_orders, status)

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

Filter orders by status.

Parameters

  • historical: The historical orders struct
  • status: Status to filter by

Returns

  • List of order records matching status

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

@spec canceled(t()) :: [map()]

Get canceled orders only.

Parameters

  • historical: The historical orders struct

Returns

  • List of canceled order records
Link to this function

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

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

Creates a changeset for historical orders data.

Parameters

  • historical: The historical orders struct
  • attrs: Map with orders key

Returns

  • Ecto.Changeset.t()

Fetch data and persist to configured storage backends.

This calls request/N and then stores the result using Storage.Writer. Request params are merged into stored data for cache key generation.

Fetch data and persist. Raises on error.

@spec filled(t()) :: [map()]

Get filled orders only.

Parameters

  • historical: The historical orders struct

Returns

  • List of filled order records
Link to this function

find_by_oid(historical_orders, oid)

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

Find order by OID.

Parameters

  • historical: The historical orders struct
  • oid: Order ID

Returns

  • {:ok, OrderRecord.t()} if found
  • {:error, :not_found} if not found
@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(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 valid_statuses() :: [String.t()]

Get valid order statuses.

Returns

  • List of valid status strings