Skip to main content

Request a quote

Step 1: see what is on sale​

curl "$BFX/api/v2/options?pair=USD/NGN&direction=up"
{
"pair": "USD/NGN",
"tenors": [
{ "tenorDays": 7, "open": true, "capped": true, "maxPayoutAvailable": "1079.4633936" },
{ "tenorDays": 30, "open": true, "capped": true, "maxPayoutAvailable": "1079.4633936" }
]
}

direction is up for an Up cover (pays if the rate rises) and down for a Down cover (pays if it falls).

Step 2: get today's rate​

curl "$BFX/api/v2/spot?pair=USD/NGN"
{ "pair": "USD/NGN", "spot": "1332.819531" }

Use it to choose a strike, for example 2% above: 1359.475922.

Step 3: request the quote​

curl -X POST $BFX/api/v2/quotes \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"pair": "USD/NGN",
"direction": "up",
"notional": "10000",
"tenorDays": 30,
"structure": "capped",
"strike": "1359.475922",
"cap": "1495.423514"
}'
FieldTypeNotes
pairstringFor example USD/NGN
directionup or down
notionaldecimal string, USDCAt least 10
tenorDaysintegerAn active tenor
structurecapped (shown to users as Limited) or open
strikedecimal stringPayables: ≥ spot and < 2× spot. Receivables: ≤ spot and > 0.5× spot.
strikeDistanceBpsnumberOptional: the strike as a distance from today's rate, in basis points with up to 2 decimals (200 is 2%, 2 is 0.02%). Measured from the rate the quote is priced at, so it follows the rate until you buy.
capdecimal stringThe limit. Required for capped; ignored for open
capDistanceBpsintegerOptional: the limit as a distance beyond the strike, in basis points
poolresource idOptional: quote from this pool only

A strike sent only as strike stays fixed. If today's rate moves past it before pricing, the quote is refused with INVALID_STRIKE; send strikeDistanceBps to avoid that.

The response​

{
"economic": {
"pair": "USD/NGN", "notional": "10000", "tenorDays": 30,
"structure": "capped", "direction": "up",
"spot": "1332.819531", "strike": "1359.475922", "cap": "1495.423514",
"fairRateE6": 23851, "markupBps": 11500, "offerRateE6": 27428,
"premium": "274.28", "hedgerFee": "13.714", "totalCost": "287.994",
"maxPayout": "1020.0000000",
"pool": { "chain": "stellar-testnet", "contract": "CBW3...", "id": "pool/1" },
"executionChain": "stellar-testnet"
},
"buyer": "C...",
"expiresAt": 1792540000,
"executable": { "...": "signed parameters for the contract" }
}

The values above are illustrative. expiresAt is 120 seconds after signing. Pass the whole object, unchanged, to Create protection.

How the pool is chosen​

The service lists pools that sell the pair, direction, tenor and structure, and allow the strike distance. It tries them from the lowest markup up (how markups set the price), and returns the first whose free capacity covers the reserve.

Errors​

CodeMeaning
INVALID_CAPcapped without a limit, or a limit outside the pool's range
STRIKE_TOO_CLOSEStrike nearer spot than every pool allows; the message gives the minimum
TENOR_DISABLEDNo pool offers this combination
INSUFFICIENT_LIQUIDITYReserve larger than every candidate's capacity
ORACLE_NOT_READYNo live rate for the pair
QUOTE_EXPIREDSpot moved while pricing open cover; request again