Lux.Beams.Hyperliquid.TradeRiskManagementBeam (Lux v0.5.0)
View SourceA beam that evaluates trade suggestions against risk management criteria and portfolio state.
This beam:
- Fetches current portfolio state and positions
- Gets current market prices and conditions
- Evaluates the trade against risk management rules
- Either executes or rejects the trade based on risk assessment
Example
Lux.Beams.Hyperliquid.TradeRiskManagementBeam.run(%{
address: "0x0403369c02199a0cb827f4d6492927e9fa5668d5",
trade: %{
coin: "ETH",
is_buy: true,
sz: 0.1,
limit_px: 2800.0,
order_type: %{limit: %{tif: "Gtc"}},
reduce_only: false
}
})
{:ok, %{
status: "accepted", # or "rejected"
risk_metrics: %{
position_size_ratio: 0.15,
leverage: 2.0,
portfolio_concentration: 0.25,
# ... other metrics
},
execution_result: %{} # if accepted
}}
Summary
Functions
Determines if the trade should be executed based on risk metrics