scenario / wire operation
Run a scenario set against targets
totalfinance.scenario.run
Revalue every target under every scenario of a Gate B scenario set against a Gate B market snapshot: a scenario-major cell grid with base values, per-cell P&L in local and reporting currency, and per-scenario aggregates. Targets are the serializable kinds — spot assets, Taylor (greeks) positions, and a portfolio bound through Taylor bindings. The result is runScenarios(...) verbatim.
| Pack / profiles | scenario / full, scenarios |
|---|---|
| Default discovery | Opt-in |
| Required capabilities | None |
| Effects / authorization | none / none |
| Cost / cancellation | large / Do not assume inline interruption |
| Handle-eligible inputs | scenarioSet, market |
| Idempotency | not-applicable |
Input schema
{
"type": "object",
"properties": {
"scenarioSet": {
"type": "object",
"properties": {
"kind": {
"const": "totalfinance.scenario-set",
"type": "string"
},
"schemaVersion": {
"type": "integer"
},
"name": {
"type": "string",
"minLength": 1
},
"scenarios": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"shocks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"factor": {
"type": "string"
},
"kind": {
"type": "string",
"enum": [
"percent",
"absolute"
]
},
"value": {
"type": "number"
},
"target": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"factor",
"kind",
"value"
]
}
},
"overrides": {
"type": "array",
"items": {
"type": "object",
"properties": {
"factor": {
"type": "string"
},
"value": {
"type": "number"
},
"target": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"factor",
"value"
]
}
}
},
"additionalProperties": false,
"required": [
"name",
"shocks"
]
},
"minItems": 1
},
"provenance": {
"type": "object",
"properties": {
"provider": {
"type": "string"
},
"dataset": {
"type": "string"
},
"asOf": {
"type": "number"
},
"receivedAt": {
"type": "number"
},
"sourceVersion": {
"type": "string"
},
"requestId": {
"type": "string"
},
"warnings": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {}
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"required": [
"kind",
"schemaVersion",
"name",
"scenarios"
],
"description": "A Gate B scenario set (totalfinance.scenario-set)"
},
"market": {
"type": "object",
"properties": {
"kind": {
"const": "totalfinance.market-snapshot",
"type": "string"
},
"schemaVersion": {
"type": "integer"
},
"asOf": {
"type": "number",
"description": "Epoch ms (resolved on the artifact)"
},
"conventions": {
"type": "object",
"properties": {
"conventionsVersion": {
"type": "string"
},
"asOfConvention": {
"type": "string",
"enum": [
"explicit-instant",
"date-midnight-utc"
],
"description": "How asOf was expressed at create time (a bare date is refused by option pricing)"
},
"dayCount": {
"type": "string"
},
"compounding": {
"type": "string"
},
"calendar": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"conventionsVersion",
"asOfConvention"
]
},
"observations": {
"type": "object",
"properties": {
"spots": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {}
}
},
"riskFreeRates": {
"type": "object",
"additionalProperties": {
"type": "number"
}
},
"dividendYields": {
"type": "object",
"additionalProperties": {
"type": "number"
}
},
"volatilities": {
"type": "object",
"additionalProperties": {
"type": "number"
}
},
"curves": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {}
}
},
"surfaces": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {}
}
},
"chains": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {}
}
}
},
"additionalProperties": false
},
"provenance": {
"type": "object",
"properties": {
"provider": {
"type": "string"
},
"dataset": {
"type": "string"
},
"asOf": {
"type": "number"
},
"receivedAt": {
"type": "number"
},
"sourceVersion": {
"type": "string"
},
"requestId": {
"type": "string"
},
"warnings": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {}
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"required": [
"kind",
"schemaVersion",
"asOf",
"conventions",
"observations"
],
"description": "A Gate B market snapshot (totalfinance.market-snapshot); its interior is re-validated by the read door"
},
"targets": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"kind": {
"const": "spot",
"type": "string"
},
"id": {
"type": "string",
"minLength": 1
},
"symbol": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "number"
},
"currency": {
"type": "string"
},
"strategy": {
"type": "string"
},
"account": {
"type": "string"
},
"book": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": [
"kind",
"id",
"symbol",
"quantity",
"currency"
]
},
{
"type": "object",
"properties": {
"kind": {
"const": "taylor",
"type": "string"
},
"id": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "number"
},
"contractMultiplier": {
"type": "number"
},
"currency": {
"type": "string"
},
"underlying": {
"type": "string"
},
"strategy": {
"type": "string"
},
"account": {
"type": "string"
},
"book": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"baseValuePerUnit": {
"type": "number"
},
"greeks": {
"type": "object",
"properties": {
"delta": {
"type": "number",
"description": "∂V/∂S per $1 of spot"
},
"gamma": {
"type": "number",
"description": "∂²V/∂S² per $1²"
},
"vega": {
"type": "number",
"description": "∂V/∂σ per 1 volatility POINT (0.01), as option.greeks reports it"
},
"theta": {
"type": "number",
"description": "∂V/∂t per CALENDAR DAY, as option.greeks reports it"
},
"rho": {
"type": "number",
"description": "∂V/∂r per 1% rate (0.01), as option.greeks reports it"
},
"vanna": {
"type": "number",
"description": "∂Δ/∂σ per 1.00 σ per $"
},
"vomma": {
"type": "number",
"description": "∂²V/∂σ² per 1.00 σ²"
},
"charm": {
"type": "number",
"description": "∂Δ/∂T per year of time-to-expiry (options-package sign)"
},
"veta": {
"type": "number",
"description": "∂vega/∂T per year, vega per 1.00 σ"
},
"vera": {
"type": "number",
"description": "∂²V/∂σ∂r per 1.00 σ per 1.00 rate"
},
"deltaRate": {
"type": "number",
"description": "∂Δ/∂r per $ per 1% rate"
},
"thetaRate": {
"type": "number",
"description": "∂Θ/∂r per calendar day per 1% rate"
},
"rhoConvexity": {
"type": "number",
"description": "∂²V/∂r² per (1%)²"
},
"thetaConvexity": {
"type": "number",
"description": "∂²V/∂t² per calendar day²"
},
"phi": {
"type": "number",
"description": "∂V/∂q per 1% dividend yield (dividend rho)"
}
},
"additionalProperties": false
},
"factors": {
"type": "object",
"properties": {
"spot": {
"type": "object",
"properties": {
"subject": {
"type": "string"
},
"level": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"subject",
"level"
]
},
"volatility": {
"type": "object",
"properties": {
"subject": {
"type": "string"
},
"level": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"subject",
"level"
]
},
"riskFreeRate": {
"type": "object",
"properties": {
"subject": {
"type": "string"
},
"level": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"subject",
"level"
]
},
"dividend": {
"type": "object",
"properties": {
"subject": {
"type": "string"
},
"level": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"subject",
"level"
]
},
"valuationInstant": {
"type": "object",
"properties": {
"level": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"level"
]
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"required": [
"kind",
"id",
"quantity",
"contractMultiplier",
"currency",
"baseValuePerUnit",
"greeks",
"factors"
]
},
{
"type": "object",
"properties": {
"kind": {
"const": "portfolio",
"type": "string"
},
"portfolio": {
"anyOf": [
{
"type": "object",
"properties": {
"kind": {
"const": "totalfinance.portfolio-ledger",
"type": "string"
},
"schemaVersion": {
"type": "integer"
},
"portfolioId": {
"type": "string"
},
"baseCurrency": {
"type": "string"
},
"lotRelief": {
"type": "string",
"enum": [
"fifo",
"lifo",
"highest-cost",
"specific-lot"
]
},
"events": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {}
},
"description": "Portfolio event envelopes (each re-validated by readPortfolioLedgerSnapshot)"
},
"provenance": {
"type": "object",
"properties": {
"provider": {
"type": "string"
},
"dataset": {
"type": "string"
},
"asOf": {
"type": "number"
},
"receivedAt": {
"type": "number"
},
"sourceVersion": {
"type": "string"
},
"requestId": {
"type": "string"
},
"warnings": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {}
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"required": [
"kind",
"schemaVersion",
"baseCurrency",
"lotRelief",
"events"
],
"description": "A serialized portfolio ledger (totalfinance.portfolio-ledger, the FC7 JSON form)"
},
{
"type": "object",
"properties": {
"schemaVersion": {
"type": "integer"
},
"portfolioId": {
"type": "string"
},
"baseCurrency": {
"type": "string"
},
"lotRelief": {
"type": "string",
"enum": [
"fifo",
"lifo",
"highest-cost",
"specific-lot"
]
},
"accounts": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {}
}
},
"appliedEvents": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"eventCount": {
"type": "integer",
"minimum": 0
},
"lastEffectiveTimestampMs": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
},
"lotSequence": {
"type": "integer",
"minimum": 0
},
"fillEffects": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {}
}
},
"reversals": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"accountMigrations": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {}
}
}
},
"additionalProperties": false,
"required": [
"schemaVersion",
"baseCurrency",
"lotRelief",
"accounts",
"appliedEvents",
"eventCount",
"lastEffectiveTimestampMs",
"lotSequence",
"fillEffects",
"reversals",
"accountMigrations"
],
"description": "A derived PortfolioState (from applyPortfolioEvents or ledger.state)"
}
],
"description": "The ledger envelope or PortfolioState whose open positions become targets"
},
"bindings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1
},
"accountId": {
"type": "string",
"minLength": 1
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"strategy": {
"type": "string"
},
"book": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"baseValuePerUnit": {
"type": "number"
},
"greeks": {
"type": "object",
"properties": {
"delta": {
"type": "number",
"description": "∂V/∂S per $1 of spot"
},
"gamma": {
"type": "number",
"description": "∂²V/∂S² per $1²"
},
"vega": {
"type": "number",
"description": "∂V/∂σ per 1 volatility POINT (0.01), as option.greeks reports it"
},
"theta": {
"type": "number",
"description": "∂V/∂t per CALENDAR DAY, as option.greeks reports it"
},
"rho": {
"type": "number",
"description": "∂V/∂r per 1% rate (0.01), as option.greeks reports it"
},
"vanna": {
"type": "number",
"description": "∂Δ/∂σ per 1.00 σ per $"
},
"vomma": {
"type": "number",
"description": "∂²V/∂σ² per 1.00 σ²"
},
"charm": {
"type": "number",
"description": "∂Δ/∂T per year of time-to-expiry (options-package sign)"
},
"veta": {
"type": "number",
"description": "∂vega/∂T per year, vega per 1.00 σ"
},
"vera": {
"type": "number",
"description": "∂²V/∂σ∂r per 1.00 σ per 1.00 rate"
},
"deltaRate": {
"type": "number",
"description": "∂Δ/∂r per $ per 1% rate"
},
"thetaRate": {
"type": "number",
"description": "∂Θ/∂r per calendar day per 1% rate"
},
"rhoConvexity": {
"type": "number",
"description": "∂²V/∂r² per (1%)²"
},
"thetaConvexity": {
"type": "number",
"description": "∂²V/∂t² per calendar day²"
},
"phi": {
"type": "number",
"description": "∂V/∂q per 1% dividend yield (dividend rho)"
}
},
"additionalProperties": false
},
"factors": {
"type": "object",
"properties": {
"spot": {
"type": "object",
"properties": {
"subject": {
"type": "string"
},
"level": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"subject",
"level"
]
},
"volatility": {
"type": "object",
"properties": {
"subject": {
"type": "string"
},
"level": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"subject",
"level"
]
},
"riskFreeRate": {
"type": "object",
"properties": {
"subject": {
"type": "string"
},
"level": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"subject",
"level"
]
},
"dividend": {
"type": "object",
"properties": {
"subject": {
"type": "string"
},
"level": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"subject",
"level"
]
},
"valuationInstant": {
"type": "object",
"properties": {
"level": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"level"
]
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"required": [
"id",
"accountId",
"instrumentId",
"baseValuePerUnit",
"greeks",
"factors"
]
},
"minItems": 1,
"description": "Exactly one Taylor binding per open (accountId, instrumentId) position — the serializable binding kind"
}
},
"additionalProperties": false,
"required": [
"kind",
"portfolio",
"bindings"
]
}
]
},
"minItems": 1,
"description": "Wire targets: kind 'spot' (scenarioTarget.spot), 'taylor' (scenarioTarget.taylor), or 'portfolio' (scenarioTargetsFromPortfolio with Taylor bindings). A custom pricer target is SDK-only."
},
"reportingCurrency": {
"type": "string"
},
"currencyConversions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"baseCurrency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"quoteCurrency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"quotePerBase": {
"type": "number",
"exclusiveMinimum": 0
}
},
"additionalProperties": false,
"required": [
"baseCurrency",
"quoteCurrency",
"quotePerBase"
]
}
},
"options": {
"type": "object",
"properties": {
"failureMode": {
"type": "string",
"enum": [
"fail-fast",
"collect"
]
},
"seed": {
"type": "integer",
"minimum": 0
},
"maximumValuationCells": {
"type": "integer",
"exclusiveMinimum": 0
},
"maximumWorkUnits": {
"type": "integer",
"exclusiveMinimum": 0
}
},
"additionalProperties": false,
"description": "Execution options; market resolvers and factor handlers are SDK-only callbacks"
}
},
"additionalProperties": false,
"required": [
"scenarioSet",
"market",
"targets"
]
}Output schema
{
"type": "object",
"properties": {
"layout": {
"type": "object",
"description": "scenario-major cell layout and the index formula"
},
"scenarioAxis": {
"type": "array",
"items": {
"type": "object"
}
},
"targetAxis": {
"type": "array",
"items": {
"type": "object"
}
},
"base": {
"type": "array",
"items": {
"type": "object"
}
},
"cells": {
"type": "array",
"items": {
"type": "object"
}
},
"aggregates": {
"type": "object"
},
"assumptions": {
"type": "object",
"description": "Applied conventions"
},
"diagnostics": {
"type": "object",
"description": "Engine, method, warnings"
}
},
"required": [
"layout",
"scenarioAxis",
"targetAxis",
"base",
"cells",
"aggregates",
"assumptions",
"diagnostics"
]
}