Lux.Prisms.Hyperliquid.HyperliquidUserStatePrism (Lux v0.5.0)
View SourceA prism that fetches user state information from the Hyperliquid exchange.
Example
# Get state for a specific address
iex> Lux.Prisms.Hyperliquid.HyperliquidUserStatePrism.run(%{
...> address: "0x0403369c02199a0cb827f4d6492927e9fa5668d5"
...> })
{:ok,
%{
"status" => "success",
"user_state" => %{
"assetPositions" => [
%{
"coin" => "ETH",
"position" => %{
"entryPx" => "2800.0",
"leverage" => "2.0",
"liquidationPx" => "1400.0",
"marginUsed" => "1000.0",
"positionValue" => "2000.0",
"returnOnEquity" => "0.15",
"size" => "1.0",
# ... other position fields
}
}
],
"crossMaintenanceMarginRatio" => "0.0625",
"crossMarginSummary" => %{
"accountValue" => "10000.0",
"totalMarginUsed" => "1000.0",
"totalNtlPos" => "2000.0",
"totalRawUsd" => "10000.0"
}
# ... other user state fields
}
}}
The prism reads authentication details from configuration:
- :hyperliquid_private_key - Ethereum account private key for authentication
Summary
Functions
Callback implementation for Lux.Prism.handler/2
.
Returns the Prism struct for this module.