View Source Hyperliquid.Api.Info.MarginTable (hyperliquid v0.2.2)
Margin table details.
Returns margin requirements and leverage tiers.
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint
Usage
{:ok, table} = MarginTable.request(0)
max_lev = MarginTable.max_leverage_for_size(table, 100000.0)
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 margin table data.
Fetch data and persist to configured storage backends.
Fetch data and persist. Raises on error.
Get max leverage for a position size.
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
Functions
Returns metadata about this endpoint.
Example
iex> Hyperliquid.Api.Info.MarginTable.__endpoint_info__()
%{
endpoint: "marginTable",
type: :info,
rate_limit_cost: 1,
params: [:id],
optional_params: [],
doc: "Retrieve margin table details",
returns: "Margin requirements and leverage tiers"
}
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.
@spec changeset(t(), map()) :: Ecto.Changeset.t()
Creates a changeset for margin table data.
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.
Get max leverage for a position size.
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).
@spec rate_limit_cost() :: non_neg_integer()
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.