getInstrumentDirection
Syntax
getInstrumentDirection(instrument)
Details
Get the trade direction of the input instrument(s).
Arguments
instrument is an INSTRUMENT scalar/vector indicating one or more instrument objects.
Returns
A scalar/vector of STRING type.
Examples
forward = {
"productType": "Forward",
"forwardType": "FxForward",
"version": 0,
"expiry": 2025.09.24,
"delivery": 2025.09.26,
"currencyPair": "USDCNY",
"direction": "Buy",
"notional": ["USD", 1E8],
"strike": 7.2
}
ins = parseInstrument(forward)
getInstrumentDirection(ins)
// output: Buy
Related functions: parseInstrument, getInstrumentField, getInstrumentKeys
