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

Preview fees & PnL

Compute fees, exit fees, TP/SL PnL, and margin changes without a transaction.

The preview/* endpoints run the same math as the trade builders but return only numbers — no transaction. Use them to render quotes and validate inputs before committing.

Entry fees for a would-be position

curl -X POST $FLASH_API_URL/preview/limit-order-fees -d '{
  "marketSymbol": "SOL", "inputAmountUi": "100", "outputAmountUi": "0.67", "side": "LONG"
}'
# → entryPriceUi, entryFeeUsdUi, liquidationPriceUi, borrowRateUi

Exit fee for a close

curl -X POST $FLASH_API_URL/preview/exit-fee -d '{
  "marketSymbol": "SOL", "side": "LONG", "closeAmountUsdUi": "500", "owner": "<WALLET>"
}'
# → exitFeeUsdUi, exitFeeAmountUi, exitPriceUi

TP/SL PnL — forward and reverse

mode selects the direction:

# forward: trigger price → PnL
curl -X POST $FLASH_API_URL/preview/tp-sl -d '{"mode":"forward","marketSymbol":"SOL","side":"LONG","owner":"<WALLET>","triggerPriceUi":"160"}'

# reverse_pnl: target PnL (USD) → trigger price
curl -X POST $FLASH_API_URL/preview/tp-sl -d '{"mode":"reverse_pnl","marketSymbol":"SOL","side":"LONG","owner":"<WALLET>","targetPnlUsdUi":"50"}'

# reverse_roi: target ROI (%) → trigger price
curl -X POST $FLASH_API_URL/preview/tp-sl -d '{"mode":"reverse_roi","marketSymbol":"SOL","side":"LONG","owner":"<WALLET>","targetRoiPercent":25}'

Omit owner and pass inline entryPriceUi / sizeUsdUi / collateralUsdUi to preview before a position exists.

Margin change

→ Full request/response tables: API reference › Previews

Last updated

Was this helpful?