Skip to main content

Protection endpoints

Pricing: how a quote's premium, fees and payout are worked out is in Premium calculation and Payout calculation.

POST /quotes (auth)​

Request:

FieldTypeRequired
pairstringYes
directionup or downYes
notionaldecimal stringYes
tenorDaysintegerYes
structurecapped (Limited) or openYes
strikedecimal stringYes
capdecimal string, the limitFor capped
strikeDistanceBpsnumber, basis points with up to 2 decimals (2 is 0.02%, 0.15 is 0.0015%)No
capDistanceBpsinteger, basis points beyond the strikeNo
poolresource id stringNo

With strikeDistanceBps, the strike is measured from the exact rate the quote is priced at, rounded away from it, so it never falls short of a pool's closest strike when the rate moves. Without it, strike is used as given; if today's rate has moved past it, the quote is refused with INVALID_STRIKE. Each pool's minStrikeDistanceBps still applies (STRIKE_TOO_CLOSE).

Response, ProtectionQuote:

FieldMeaning
economic.spotRate the quote was priced at; becomes the position's rate at purchase
economic.strike, economic.capTerms (cap is the limit, computed for open)
economic.fairRateE6Engine fair rate
economic.markupBpsThe chosen pool's markup for the tenor
economic.offerRateE6fairRateE6 × markupBps / 10000, rounded down
economic.premium, hedgerFee, totalCostUSDC
economic.maxPayoutReserve
economic.poolPool resource id
economic.executionChainstellar-testnet
buyerThe user's Stellar wallet the quote is bound to
expiresAtUnix seconds; 120 s after signing
executableSigned contract parameters; pass back unchanged

POST /hedges/prepare (auth)​

Body: { "quote": <ProtectionQuote> }. Returns { transactions: PreparedTransaction[] } calling buy_protection with max_cost = totalCost and deadline = quote time + 120.

GET /hedges (auth)​

All the user's positions with settlement: { hedges: [{ position, pair, settlement }] }.

GET /hedges/:ref​

One position: { position, settlement }.

position fields: ref, positionId, poolId, hedger, structure, direction, status (active, settled, claimed), tenorDays, createdAt, expiry, notional, spot, strike, cap, fairRateE6, premiumRateE6, premium, fee, maxPayout, settlementPrice, payout.

settlement fields: settlementPrice, grossPayout, fee, netPayout, status (pending, settled_no_payout, settled_claimable, claimed).

POST /hedges/:ref/claim/prepare (auth)​

Returns the claim_payout transaction.