Market Data
useSymbolPriceRange
Software Development Kits
[EVM] React Components SDK
- Overview
- Getting started
- Theming
- Wallet connect
- Framework Guides
- Page Components
- Block Components
[EVM] React Hooks SDK
[EVM] Core SDK
[EVM] Perp SDK
Market Data
useSymbolPriceRange
Receive information about minimum and maximum allowed price range for an order.
Example
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]);
On this page