extractInstrument
语法
extractInstrument(instrument)
详情
提取 INSTRUMENT 类型对象内部的数据。
参数
instrument INSTRUMENT 类型标量,或由多个 INSTRUMENT 组成的元组。
返回值
-
instrument 是标量时,返回一个字典。
-
instrument 是元组时,返回一个由字典组成的元组。
例子
fxFwd1 = {
"productType": "Forward",
"forwardType": "FxForward",
"expiry": 2025.10.08,
"delivery": 2025.10.10,
"currencyPair": "USDCNY",
"direction": "Buy",
"notionalCurrency": "USD",
"notionalAmount": 1E6,
"strike": 7.2
}
fxFwdUsdCny = parseInstrument(fxFwd1)
fxFwd2 = {
"productType": "Forward",
"forwardType": "FxForward",
"expiry": 2025.10.08,
"delivery": 2025.10.10,
"currencyPair": "EURCNY",
"direction": "Buy",
"notionalCurrency": "EUR",
"notionalAmount": 1E6,
"strike": 8.2
}
fxFwdEurCny = parseInstrument(fxFwd2)
print extractInstrument([fxFwdUsdCny, fxFwdEurCny])
/* output
(productType->Forward
forwardType->FxForward
version->1
instrumentId->
expiry->2025.10.08
delivery->2025.10.10
currencyPair->USDCNY
direction->Buy
notionalCurrency->USD
notionalAmount->1000000
strike->7.200000000000001
domesticCurve->
foreignCurve->
,productType->Forward
forwardType->FxForward
version->1
instrumentId->
expiry->2025.10.08
delivery->2025.10.10
currencyPair->EURCNY
direction->Buy
notionalCurrency->EUR
notionalAmount->1000000
strike->8.199999999999999
domesticCurve->
foreignCurve->
)
*/
相关函数:parseInstrument
