Orders
useOrderEntry
The useOrderEntry
hook provides a variety of supporting functions according to input parameters and the prevailing market data.
Real-time data
useOrderEntry
provides some real-time data that the UI will use when creating orders based on the latest market data.
maxQty
: The maximum quantity that the user can trade based on the free collateral.freeCollateral
: The amount collateral available for trading, factoring in open positions and pending orders.markPrice
: The mark price of the symbol.estLiqPrice
: The estimated liquidation price, if a position is created from given order paramters.estLeverage
: The estimated leverage, if a position is created from given order paramters.
Updating values
For updating values two functions are provided: setValue
and setValues
.
useOrderEntry
is built on the concepts of react-hook-form
.
If you have been using it in conjunction with react-hook-form
with the SDK v1, then you might want to entirely remove it now.
Order validations
Order inputs will be validated automatically and any error will be returned in the metaState.errors
field.
Placing orders
You can place orders by calling the submit
function.