fxNonDeliverableForwardPricer
首发版本:3.00.6
语法
fxNonDeliverableForwardPricer(instrument, pricingDate, spot, domesticCurve, foreignCurve)
详情
基于给定的即期汇率、本币与外币的贴现曲线,以及定价日期,计算外汇无本金交割远期合约的净现值(NPV)。
参数
instrument INSTRUMENT 类型对象,指定需要定价的外汇无本金交割远期。字段要求参考产品字段说明。
pricingDate DATE 类型标量,指定定价日期。
spot DOUBLE 类型标量,指定即期汇率。
domesticCurve MKTDATA 类型对象(IrYieldCurve),指定本币贴现曲线。
foreignCurve MKTDATA 类型对象(IrYieldCurve),指定外币贴现曲线。
返回值
DOUBLE 类型标量。
例子
本示例构造了以 USD 为名义货币的无本金交割远期合约,并分别定义人民币(CNY)和美元(USD)无风险收益率曲线作为贴现曲线。 定价函数根据即期汇率、定价日期以及两条贴现曲线计算合约净现值(NPV)。 随后,示例通过贴现因子手工计算 NPV,以验证定价结果的正确性。
pricingDate = 2025.08.18
strike = 4
yearConv = "Actual365"
delivery = 2025.12.18
notionalAmount = 1E6
fxNonDeliverableForward = {
"productType": "Forward",
"forwardType": "FxNonDeliverableForward",
"expiry": 2025.12.16,
"delivery": delivery,
"currencyPair": "USDCNY",
"direction": "Buy",
"notionalAmount": notionalAmount,
"notionalCurrency": "USD",
// "settlementCurrency": "CNY",
"settlementCurrency": "USD",
"strike": strike
}
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": yearConv,
"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": yearConv,
"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(fxNonDeliverableForward)
domesticCurve = parseMktData(domesticCurveInfo)
foreignCurve = parseMktData(foreignCurveInfo)
spot = 7.1
npv = fxNonDeliverableForwardPricer(instrument, pricingDate, spot, domesticCurve, foreignCurve)
print(npv)
domes_discount = 1.0 / exp(curvePredict(domesticCurve, delivery) * yearFrac(yearConv, pricingDate, delivery))
foreign_discount = 1.0 / exp(curvePredict(foreignCurve, delivery) * yearFrac(yearConv, pricingDate, delivery))
/*外币结算,即 settlementCurrency 是 USD
(-1.0/spot * domes_discount + 1.0/strike * foreign_discount) * notionalAmount * spot*/
/*本币结算,即 settlementCurrency 是 CNY
(spot * foreign_discount - strike * domes_discount) * notionalAmount*/
产品字段说明
| 字段名 | 类型 | 描述 | 是否必填 |
|---|---|---|---|
| productType | STRING | 产品名称,固定值为 "Forward" | 是 |
| forwardType | STRING | 远期类型,固定值为 "FxNonDeliverableForward" | 是 |
| notionalAmount | DOUBLE | 名义本金金额,例如 1E7 | 是 |
| notionalCurrency | STRING | 名义本金货币,例如 "USD" | 是 |
| instrumentId | STRING | 金融工具 ID | 否 |
| expiry | DATE | 到期日 | 是 |
| delivery | DATE | 交割日 | 是 |
| currencyPair | STRING | 货币对,格式如:"EURUSD","EUR.USD" 或 "EUR/USD"。 支持如下货币对:
|
是 |
| direction | STRING | 交易方向。 可选:"Buy"、"Sell" | 是 |
| strike | DOUBLE | 执行价格 | 是 |
| settlementCurrency | STRING | 结算货币 | 是 |
| domesticCurve | STRING | 定价时参考的本币贴现曲线名称 | 否 |
| foreignCurve | STRING | 定价时参考的外币贴现曲线名称 | 否 |
