For the complete documentation index, see llms.txt. This page is also available as Markdown.

Previews

Read-only quote computations — fees, exit fees, TP/SL PnL, margin.

POST endpoints that compute numbers without building a transaction. Each returns { "err": "…" } in the body when the computation fails. Shared conventions: Conventions. Task walkthrough: Preview fees & PnL.

Method
Path

POST

/preview/limit-order-fees

POST

/preview/exit-fee

POST

/preview/tp-sl

POST

/preview/margin


Limit-order fees

POST /preview/limit-order-fees

Entry price, entry fee, liquidation price, and borrow rate for a would-be position.

Field
Type
Req
Description

marketSymbol

string

Market token symbol

inputAmountUi

string

Collateral amount (UI)

outputAmountUi

string

Size in target token (UI)

side

enum

LONG / SHORT

limitPrice

string

Limit price (UI); uses live price if omitted

Response: { entryPriceUi, entryFeeUsdUi, liquidationPriceUi, borrowRateUi }.


Exit fee

POST /preview/exit-fee

Exit fee and exit price for closing (part of) a position.

Field
Type
Req
Description

marketSymbol

string

Market token symbol

side

enum

LONG / SHORT

closeAmountUsdUi

string

USD to close (UI)

owner

string

Owner wallet pubkey

Response: { exitFeeUsdUi, exitFeeAmountUi, exitPriceUi }.


TP/SL

POST /preview/tp-sl

mode selects the computation: forward (trigger price → PnL), reverse_pnl (target PnL → trigger price), reverse_roi (target ROI% → trigger price).

Supply owner to use the caller's existing position; omit it and pass the inline fields to preview before a position exists.

Field
Type
Req
Description

mode

string

forward / reverse_pnl / reverse_roi

marketSymbol

string

Market token symbol

side

enum

LONG / SHORT

owner

string

Owner pubkey (owner-position mode)

entryPriceUi

string

Entry price (inline mode)

sizeUsdUi

string

Position size, USD (inline mode)

collateralUsdUi

string

Collateral, USD (inline mode)

triggerPriceUi

string

Forward: trigger price to price PnL for

targetPnlUsdUi

string

Reverse-PnL: target PnL, USD

targetRoiPercent

number

Reverse-ROI: target ROI %

Response: { pnlUsdUi?, pnlPercentage?, triggerPriceUi?, maxProfitPriceUi? } — forward returns pnlUsdUi/pnlPercentage; reverse modes return triggerPriceUi.


Margin

POST /preview/margin

Preview a collateral add/remove on an existing position.

Field
Type
Req
Description

marketSymbol

string

Market token symbol

side

enum

LONG / SHORT

marginDeltaUsdUi

string

Margin delta, USD (UI)

action

enum

ADD / REMOVE

owner

string

Owner wallet pubkey

Response: { newLeverageUi, newLiquidationPriceUi, maxAmountUsdUi, existingCollateralUsdUi?, newCollateralUsdUi?, existingLeverageUi?, existingLiquidationPriceUi?, deltaUsdUi? }.

Last updated

Was this helpful?