getInstrumentNearExpiry

Syntax

getInstrumentNearExpiry(instrument)

Details

Get the near expiry date of the input instrument(s).

Arguments

instrument is an INSTRUMENT scalar/vector indicating one or more instrument objects.

Returns

A scalar/vector of DATE type.

Examples

swap = {
    "productType": "Swap",
    "swapType": "FxSwap",
    "version": 0,
    "currencyPair": "EURUSD",
    "direction": "Buy",
    "notional": ["EUR", 1E6],
    "nearStrike": 1.1,
    "nearExpiry": 2025.12.08,
    "nearDelivery": 2025.12.10,
    "farStrike": 1.2,
    "farExpiry": 2026.06.08,
    "farDelivery": 2026.06.10
}
ins = parseInstrument(swap)
getInstrumentNearExpiry(ins)

// output: 2025.12.08

Related functions: parseInstrument, getInstrumentField, getInstrumentKeys