Market data
useSymbolPriceRange
Hook to get the allowed price range for an order based on symbol, side, and trigger price.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Hook to get the allowed price range for an order based on symbol, side, and trigger price.
const { order, price }: { order: API.OrderExt; price: string } = props;
const isAlgoOrder = order.algo_order_id !== undefined;
const rangeInfo = useSymbolPriceRange(
order.symbol,
order.side,
isAlgoOrder ? order.trigger_price : undefined
);
const hintInfo = useMemo(() => {
if (!rangeInfo) return "";
if (Number(price) > rangeInfo.max) {
return `Price can not be greater than ${rangeInfo.max} USDC.`;
}
if (Number(price) < rangeInfo.min) {
return `Price can not be less than ${rangeInfo.min} USDC.`;
}
return "";
}, [min, max, price]);