setObjectTuple!
Syntax
setObjectTuple!(X, [on=true])
Details
Marks a tuple as an object tuple in place, or clears the object-tuple flag.
An object tuple stores financial instruments or market data objects of a single type. Its elements must all be INSTRUMENT objects or all be MKTDATA objects.
Arguments
X is a tuple.
on (optional) is a Boolean value specifying whether to mark X as an object tuple. The default value is true.
If on = true, marks X as an object tuple. If X is a regular tuple, it must be nonempty and contain either all INSTRUMENT objects or all MKTDATA objects.
If on = false, clears the object-tuple flag and treats X as a regular tuple.
Returns
Returns the modified X.
If on = true, returns an object tuple.
If on = false, returns a regular tuple.
Examples
ins = array(INSTRUMENT, 0)
isObjectTuple(ins)
// output: true
setObjectTuple!(ins, false)
isObjectTuple(ins)
// output: false
Convert a regular tuple containing two spot prices to an object tuple in place.
quoteData = {
"mktDataType": "Price",
"referenceDate": 2025.08.18,
"priceType": "Price",
"unit": "CNY",
"value": 100.0
}
openingPrice = parseMktData(dict=quoteData)
quoteData["value"] = 101.5
closingPrice = parseMktData(dict=quoteData)
prices = (openingPrice, closingPrice)
isObjectTuple(prices)
// output: false
setObjectTuple!(X=prices, on=true)
isObjectTuple(prices)
// output: true
