QS.TRADE.CREATE¶
Creates a native position on an existing instrument; contract terms and pricing policy remain separate
Category: QuantSupport - Instruments.
- QS.TRADE.CREATE(name: text, context: text, instrument: text, trade_date: text, side: text, notional: number or blank, foreign_notional: number or blank, pricing_anchor: text or blank, anchor_value: number or blank, settlement_date: text or blank, spread_day_counter: text or blank, trade_tenor: text or blank) text handle¶
- Parameters:
name (text) – Workbook-unique object name; unchanged recalculation reuses its current handle
context (text) – Required prepared context handle used to build concrete dates and initial contractual terms; construction waits for committed market inputs
instrument (text) – Native contract handle from QS.INSTRUMENT.*; trade direction, quantity and bond pricing anchor are defined here
trade_date (text) – ISO date text in YYYY-MM-DD format
side (text) – Required Receive/Buy for long-receive, or Pay/Sell for pay-short; no blank-input default
notional (number or blank) – Optional position notional; blank uses the contract principal or one unit; loan principal is contractual and cannot be overridden
foreign_notional (number or blank) – Optional foreign position principal for cross-currency swaps; blank uses the contract’s foreign principal
pricing_anchor (text or blank) – Bond anchor type CleanPrice, DirtyPrice or ZSpread; supply anchor_value together; blank for other products
anchor_value (number or blank) – Numeric bond price or decimal spread corresponding to pricing_anchor; blank for non-bond trades
settlement_date (text or blank) – Optional ISO bond settlement date; blank uses the native trade default; unsupported for other products
spread_day_counter (text or blank) – Optional bond spread day counter; blank uses Actual365; unsupported for other products
trade_tenor (text or blank) – Optional execution offset from evaluation, e.g. 0D; leave trade_date blank; blank date and tenor default to 0D
- Returns:
Revisioned text handle to a native Trade on the supplied instrument, with position direction, quantity, concrete execution date and any bond pricing anchor. Relative execution inputs are calculated using the explicit construction context before the handle is published.
- Return Type:
text handle
- Errors:
#VALUE! for invalid inputs, stale or wrong-type handles, unsupported target/pricer/trade combinations or native evaluation errors; #N/A when the result does not contain the requested measure.
Formula¶
=QS.TRADE.CREATE(name, context, instrument, trade_date, side, notional, foreign_notional, pricing_anchor, anchor_value, settlement_date, spread_day_counter, trade_tenor)
Calculation¶
Runs on Excel’s main calculation thread.
Native Declaration¶
fn qs_trade_create (name : & str , context : & str , instrument : & str , trade_date : & str , side : & str , notional : Option < f64 > , foreign_notional : Option < f64 > , pricing_anchor : Option < String > , anchor_value : Option < f64 > , settlement_date : Option < String > , spread_day_counter : Option < String > , trade_tenor : Option < String > ,) -> Result < String , XllError >