fxForwardPricer

First introduced in version: 3.00.4

Syntax

fxForwardPricer(instrument, pricingDate, spot, domesticCurve, foreignCurve)

Details

Computes the Net Present Value (NPV) of the FX forward contract based on the given spot rate, domestic and foreign discount curves, and the pricing date.

Parameters

Note:
Scalar inputs will be automatically expanded to match the length of other vector inputs. All vector inputs must be of equal length.

instrument An INSTRUMENT scalar/vector of type FxForward, representing the FX forward to be priced. See Product Field Specifications for details.

pricingDate A DATE scalar/vector specifying the pricing date(s).

spot A DOUBLE scalar/vector representing the spot exchange rate(s).

domesticCurve A MKTDATA scalar/vector of type IrYieldCurve representing the domestic discount curve(s). See Curve Field Specifications for details.

foreignCurve A MKTDATA scalar/vector of type IrYieldCurve representing the foreign discount curve(s). See Curve Field Specifications for details.

Returns

A DOUBLE scalar/vector.

Examples

pricingDate = 2025.08.18

fxForward = {
    "productType": "Forward",
    "forwardType": "FxForward",
    "expiry": 2025.12.16,
    "delivery": 2025.12.18,
    "currencyPair": "USDCNY",
    "direction": "Buy",
    "notionalCurrency": "USD",
    "notionalAmount": 1E6,
    "strike": 7.1
}

curveDates = [2025.08.21,
              2025.08.27,
              2025.09.03,
              2025.09.10,
              2025.09.22,
              2025.10.20,
              2025.11.20,
              2026.02.24,
              2026.05.20,
              2026.08.20,
              2027.02.22,
              2027.08.20,
              2028.08.21]
domesticCurveInfo = {
    "mktDataType": "Curve",
    "curveType": "IrYieldCurve",
    "referenceDate": pricingDate,
    "currency": "CNY",
    "dayCountConvention": "Actual365",
    "compounding": "Continuous",  
    "interpMethod": "Linear",
    "extrapMethod": "Flat",
    "frequency": "Annual",
    "dates": curveDates,
    "values":[1.5113, 
              1.5402, 
              1.5660, 
              1.5574, 
              1.5556, 
              1.5655, 
              1.5703, 
              1.5934, 
              1.6040, 
              1.6020, 
              1.5928, 
              1.5842, 
              1.6068]/100
}
foreignCurveInfo = {
    "mktDataType": "Curve",
    "curveType": "IrYieldCurve",
    "referenceDate": pricingDate,
    "currency": "USD",
    "dayCountConvention": "Actual365",
    "compounding": "Continuous",  
    "interpMethod": "Linear",
    "extrapMethod": "Flat",
    "frequency": "Annual",
    "dates": curveDates,
    "values":[4.3345, 
              4.3801, 
              4.3119, 
              4.3065, 
              4.2922, 
              4.2196, 
              4.1599, 
              4.0443, 
              4.0244, 
              3.9698, 
              3.7740, 
              3.6289, 
              3.5003]/100
}

instrument = parseInstrument(fxForward)

domesticCurve = parseMktData(domesticCurveInfo)
foreignCurve = parseMktData(foreignCurveInfo)
spot = 7.1627

fxForwardPricer(instrument, pricingDate, spot, domesticCurve, foreignCurve)   // output: 1919.8118
fxForwardPricer([instrument, instrument], pricingDate, spot, domesticCurve, foreignCurve)
fxForwardPricer(instrument, [pricingDate, pricingDate], spot, domesticCurve, foreignCurve)
fxForwardPricer(instrument, pricingDate, [spot, spot], domesticCurve, foreignCurve)
fxForwardPricer(instrument, pricingDate, spot, [domesticCurve, domesticCurve], foreignCurve)
fxForwardPricer(instrument, pricingDate, spot, domesticCurve, [foreignCurve, foreignCurve])

Related functions: parseInstrument, parseMktData

Product Field Specifications

Field Name Data Type Description Required
productType STRING Must be "Forward". Yes
forwardType STRING Must be "FxForward". Yes
notionalAmount DOUBLE Notional principal amount Yes
notionalCurrency STRING Notional principal Yes
instrumentId STRING InstrumentId ID No
expiry DATE Value date Yes
delivery DATE Settlement date Yes
currencyPair STRING

The currency pair, in the format "EURUSD", "EUR.USD", or "EUR/USD". Supported currency pairs include:

  • "EURUSD": Euro to US Dollar

  • "USDCNY": US Dollar to Chinese Yuan

  • "EURCNY": Euro to Chinese Yuan

  • "GBPCNY": British Pound to Chinese Yuan

  • "JPYCNY": Japanese Yen to Chinese Yuan

  • "HKDCNY": Hong Kong Dollar to Chinese Yuan

Yes
direction STRING Trading direction, can be "Buy" or "Sell" Yes
strike DOUBLE Strike price Yes
domesticCurve STRING The domestic discount curve name No
foreignCurve STRING The foreign discount curve name No

Curve Field Specifications