Lux.Prisms.Hyperliquid.HyperliquidExecuteOrderPrism (Lux v0.5.0)
View SourceA prism that executes orders on the Hyperliquid exchange.
Example
# Limit order
iex> Lux.Prisms.Hyperliquid.HyperliquidExecuteOrderPrism.run(%{
...> coin: "ETH",
...> is_buy: true,
...> sz: 0.0051,
...> limit_px: 2800.0,
...> order_type: %{limit: %{tif: "Gtc"}},
...> reduce_only: false,
...> vault_address: "0x0403369c02199a0cb827f4d6492927e9fa5668d5"
...> })
{:ok,
%{
"status" => "success",
"order_result" => %{
# ... response from Hyperliquid
}
}}
# Trigger order (Stop Loss)
iex> Lux.Prisms.Hyperliquid.HyperliquidExecuteOrderPrism.run(%{
...> coin: "ETH",
...> is_buy: false,
...> sz: 0.1,
...> limit_px: 2800.0,
...> order_type: %{
...> trigger: %{
...> triggerPx: 2900.0,
...> isMarket: true,
...> tpsl: "sl"
...> }
...> },
...> reduce_only: true
...> })
The prism reads authentication details from configuration:
- :hyperliquid_private_key - Ethereum account private key for authentication
- :hyperliquid_address - (Optional) Ethereum account address
Summary
Functions
Callback implementation for Lux.Prism.handler/2
.
Returns the Prism struct for this module.