previewOpenTrade(params) returns the numbers an order ticket displays before submission — execution price after dynamic spread, the fee breakdown, collateral left backing the position, resulting liquidation price, and the checks that should disable the submit button.
Every value derives from @ostium/formulae, the same math the contracts run.
builderFeeBps defaults to the fee configured on the client, so the ticket quotes the fee the trade will actually pay. Pass 0 to preview without one.
The preview takes numbers and
isLong; openTrade() takes decimal strings and buy.Parameters
Response schema
Warnings
warnings covers the preflight conditions a ticket should surface, and isValid is simply warnings.length === 0.
The list is not exhaustive, and chain state moves between preview and submission — keep normal error handling around
openTrade().
Related
- getMaxCollateral — what a Max button should fill in
- previewCloseTrade — the exit mirror
- openTrade