extractInstrument

Syntax

extractInstrument(instrument)

Parameters

instrument is an INSTRUMENT scalar or a tuple of INSTRUMENT scalars.

Details

Extract the data within the INSTRUMENT object(s).

Return value:

  • Returns a dictionary if the instrument is a scalar.

  • Returns a tuple of dictionaries if the instrument is a tuple.

Examples

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->
)
*/

Related function: parseInstrument