portfolio / wire operation
Value a portfolio at an instant
totalfinance.portfolio.snapshot
Value every cash balance and position of a portfolio at one instant from a Gate B market snapshot: net asset value in the base currency, per-account cash rows (settled and unsettled), per-position marks, cost basis and unrealized P&L. Supply the portfolio as its serialized ledger envelope (re-hydrated through readPortfolioLedgerSnapshot) or as a derived PortfolioState. The result is portfolioSnapshot(...) verbatim.
| Pack / profiles | portfolio / full, portfolio |
|---|---|
| Default discovery | Opt-in |
| Required capabilities | None |
| Effects / authorization | none / none |
| Cost / cancellation | small / Do not assume inline interruption |
| Handle-eligible inputs | portfolio, market |
| Idempotency | not-applicable |
Input schema
{
"type": "object",
"properties": {
"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": "A serialized ledger envelope (re-hydrated through readPortfolioLedgerSnapshot) or a PortfolioState"
},
"asOf": {
"anyOf": [
{
"type": "number"
},
{
"type": "string"
}
],
"description": "The valuation instant"
},
"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"
},
"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"
]
},
"description": "Quotes to the base currency — required exactly when the portfolio holds non-base currency"
}
},
"additionalProperties": false,
"required": [
"portfolio",
"asOf",
"market"
]
}Output schema
{
"type": "object",
"properties": {
"asOf": {
"type": "number"
},
"baseCurrency": {
"type": "string"
},
"netAssetValue": {
"type": "number"
},
"cash": {
"type": "array",
"items": {
"type": "object"
}
},
"totalCashBaseCurrencyValue": {
"type": "number"
},
"positions": {
"type": "array",
"items": {
"type": "object"
}
},
"totalPositionsBaseCurrencyValue": {
"type": "number"
},
"assumptions": {
"type": "object",
"description": "Applied conventions"
},
"diagnostics": {
"type": "object",
"description": "Engine, method, warnings"
}
},
"required": [
"asOf",
"baseCurrency",
"netAssetValue",
"cash",
"totalCashBaseCurrencyValue",
"positions",
"totalPositionsBaseCurrencyValue",
"assumptions",
"diagnostics"
]
}