fxDigitalOptionPricer
First introduced in version: 3.00.6
Syntax
fxDigitalOptionPricer(instrument, pricingDate, spot, domesticCurve,
foreignCurve, volSurf, [setting])
Details
Prices a Foreign Exchange (FX) digital option and returns the present value of the option. The setting parameter can be used to specify whether Greeks should be calculated.
Parameters
instrument is an INSTRUMENT scalar or vector specifying the FX digital option(s) to be priced. See Product Field Specifications for the required keys.
pricingDate is a DATE scalar or vector specifying the pricing date(s).
spot is a numeric scalar or vector specifying the FX spot rate(s).
domesticCurve is a MKTDATA scalar or vector of type IrYieldCurve specifying the domestic discount curve(s).
foreignCurve is a MKTDATA scalar or vector of type IrYieldCurve specifying the foreign discount curve(s).
volSurf is an FX volatility surface specifying the volatility data used for pricing.
setting (optional) is a dictionary (<STRING, ANY>) specifying the Greeks to be calculated. Supported keys:
- "calcDelta": whether to calculate Delta, the first-order sensitivity of the option price to changes in the underlying asset price. Default is false.
- "calcGamma": whether to calculate Gamma, the second-order sensitivity of Delta to changes in the underlying asset price. Default is false.
- "calcVega": whether to calculate Vega, the first-order sensitivity of the option price to changes in the volatility of the underlying asset. Default is false.
- "calcTheta": whether to calculate Theta, the sensitivity of the option price to the passage of time. Default is false.
- "calcRhoDomestic": whether to calculate the domestic Rho, the first-order sensitivity of the option price to changes in the domestic risk-free interest rate. Default is false.
- "calcRhoForeign": whether to calculate the foreign Rho, the first-order sensitivity of the option price to changes in the foreign risk-free interest rate. Default is false.
- "calcVolga": whether to calculate Volga, the second-order sensitivity of Vega to changes in volatility. Default is false.
- "calcVanna": whether to calculate Vanna, the cross sensitivity of Delta to changes in volatility. Default is false.
Returns
- If setting is not specified, returns a DOUBLE scalar or vector indicating the pricing result of the FX digital option.
- If setting is specified, returns a dictionary (<STRING, DOUBLE>) containing the pricing result and the Greeks specified by setting.
Examples
Example 1: Prices a digital option on the EUR/USD currency pair.
// Pricing reference date
pricingDate = 2025.12.16
// Trading currency pair: EUR is the foreign currency, and USD is the domestic currency
ccyPair = "EURUSD"
// Spot rate of the underlying asset: 1 EUR = 1.1748 USD
spot = 1.1748
// Define the contract structure of the FX digital option
option = {
"productType": "Option",
"optionType": "DigitalOption",
"assetType": "FxDigitalOption",
"notionalCurrency": "EUR",
"notionalAmount": 1E6,
"strike": 1.1799999114260407,
"direction": "Sell",
"maturity": 2026.03.16,
"payoffType": "Call",
"reportCurrency": "USD",
"dayCountConvention": "Actual365",
"underlying": ccyPair
}
instrument = parseInstrument(option)
// Build the domestic and foreign interest-rate yield curves
curveDates = [2026.02.24, 2026.05.20]
domesticCurveInfo = {
"mktDataType": "Curve",
"curveType": "IrYieldCurve",
"referenceDate": pricingDate,
"currency": "USD",
"dayCountConvention": "Actual360",
"compounding": "Simple",
"interpMethod": "Linear",
"extrapMethod": "Flat",
"frequency": "Annual",
"dates": curveDates,
"values": [0.03703, 0.03703]
}
foreignCurveInfo = {
"mktDataType": "Curve",
"curveType": "IrYieldCurve",
"referenceDate": pricingDate,
"currency": "EUR",
"dayCountConvention": "Actual360",
"compounding": "Simple",
"interpMethod": "Linear",
"extrapMethod": "Flat",
"frequency": "Annual",
"dates": curveDates,
"values": [0.01924, 0.01924]
}
domesticCurve = parseMktData(domesticCurveInfo)
foreignCurve = parseMktData(foreignCurveInfo)
// Build the FX volatility surface
surfInfo = {
"surfaceName": "EURUSD",
"mktDataType": "Surface",
"surfaceType": "FxVolatilitySurface",
"referenceDate": pricingDate,
"smileMethod": "Linear",
"termDates": curveDates,
"volSmiles": [
{"strikes": [1.1, 1.2, 1.3], "vols": [0.05736, 0.05736, 0.05736]},
{"strikes": [1.1, 1.2, 1.3], "vols": [0.05736, 0.05736, 0.05736]}
],
"currencyPair": "EURUSD"
}
surf = parseMktData(surfInfo)
// Configure Greeks calculation settings
setting = dict(STRING, ANY)
setting["calcDelta"] = true
setting["calcGamma"] = true
setting["calcVega"] = true
setting["calcTheta"] = true
setting["calcRhoDomestic"] = true
setting["calcRhoForeign"] = true
setting["calcVolga"] = true
setting["calcVanna"] = true
// Call the pricing function and output the result
res = fxDigitalOptionPricer(instrument, pricingDate, spot, domesticCurve, foreignCurve, surf, setting)
res
/* Result:
npv: 591230.5971531753 Net present value of the option. Since the position is Sell (short), a positive value represents the premium received.
delta: -14441185.231181722 Change in option value for a 1.0 move in the EURUSD rate.
gamma: -399739.6773414655 Sensitivity of Delta.
vega: -1157.952755196379 Change in value for a 1% increase in implied volatility.
theta: 96.88165340417233 Impact of one day's passage of time on the option value.
rhoDomestic: -40374.9217293 Domestic Rho (USD).
rhoForeign: 41832.750598994 Foreign Rho (EUR).
volga: 0.16377576173769282 Sensitivity of Vega to volatility.
vanna: 2429410.3420697395 Sensitivity of Delta to volatility.
*/
Example 2: Return only the option pricing result.
price = fxDigitalOptionPricer(
instrument=instrument,
pricingDate=pricingDate,
spot=spot,
domesticCurve=domesticCurve,
foreignCurve=foreignCurve,
volSurf=surf)
price
// output: 591230.5971531753
Example 3: Calculate only Delta and Vega.
setting = dict(STRING, ANY)
setting["calcDelta"] = true
setting["calcVega"] = true
result = fxDigitalOptionPricer(
instrument=instrument,
pricingDate=pricingDate,
spot=spot,
domesticCurve=domesticCurve,
foreignCurve=foreignCurve,
volSurf=surf,
setting=setting)
result
/* output:
npv: 591230.5971531753
delta: -14441185.231181722
vega: -1157.952755196379
*/
Related functions: parseInstrument, parseMktData
Product Field Specifications
| Field | Type | Required | Description |
|---|---|---|---|
| productType | STRING | Yes | Must be "Option". |
| optionType | STRING | Yes | Must be "DigitalOption". |
| assetType | STRING | Yes | Must be "FxDigitalOption". |
| notionalAmount | DOUBLE | Yes | The notional amount. |
| notionalCurrency | STRING | No | The notional currency, such as "USD". Must match the base currency (ccy1) of the currency pair, i.e., it must be the first currency in the FX pair. |
| instrumentId | STRING | No | The instrument ID. |
| maturity | DATE | Yes | The maturity date. |
| underlying | STRING | Yes |
The currency pair (e.g., "EURUSD", "EUR.USD", "EUR/USD"), supports the following currency pairs:
|
| direction | STRING | Yes | The trade direction. Supported values are "Buy" and "Sell". |
| strike | DOUBLE | Yes | The strike price. |
| dayCountConvention | STRING | Yes | The day count convention. Supported values are "ActualActualISDA", "ActualActualISMA", "Actual365", and "Actual360". |
| payoffType | STRING | Yes | The payoff type. Supported values are "Call" and "Put". |
| reportCurrency | STRING | Yes | The currency used for the final output (NPV / Greeks). |
| domesticCurve | STRING | No | The name of the domestic discount curve referenced during pricing. |
| foreignCurve | STRING | No | The name of the foreign discount curve referenced during pricing. |
