trade / wire operation
Create and store an explicitly defined portfolio ledger
totalfinance.portfolio.create
Start here before portfolio.record_events: supply durable portfolioId, baseCurrency and explicit initial events (an empty array creates no cash). Uses the existing artifact store and ledger reducer. Requires portfolio:write and a writable store. Save the returned handle and open it with portfolio.inspect from portfolioPack (enable both trade and portfolio packs, or use --profile full); subsequent event writes return a new immutable handle. Opt-in (tradePack).
| Pack / profiles | trade / full |
|---|---|
| Default discovery | Opt-in |
| Required capabilities | portfolio:write |
| Effects / authorization | portfolio-state / none |
| Cost / cancellation | small / Do not assume inline interruption |
| Handle-eligible inputs | None |
| Idempotency | required |
Input schema
{
"type": "object",
"properties": {
"portfolioId": {
"type": "string",
"minLength": 1
},
"baseCurrency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"lotRelief": {
"type": "string",
"enum": [
"fifo",
"lifo",
"highest-cost",
"specific-lot"
],
"description": "Existing ledger default: fifo, echoed in the stored ledger"
},
"events": {
"type": "array",
"items": {
"$ref": "#/$defs/PortfolioEventEnvelope"
},
"maxItems": 100000,
"description": "Explicit initial events; [] means an empty, unfunded portfolio"
},
"provenance": {
"$ref": "#/$defs/Provenance"
},
"createdTimestampMs": {
"type": "integer",
"description": "Caller clock in epoch milliseconds"
}
},
"additionalProperties": false,
"required": [
"portfolioId",
"baseCurrency",
"events",
"createdTimestampMs"
],
"$id": "https://totalfinance.dev/schemas/portfolio.create.input",
"$defs": {
"PortfolioEventEnvelope": {
"allOf": [
{
"type": "object",
"properties": {
"eventId": {
"type": "string",
"minLength": 1
},
"schemaVersion": {
"const": 1,
"type": "number"
},
"sourceId": {
"type": "string",
"minLength": 1
},
"accountId": {
"type": "string",
"minLength": 1
},
"effectiveTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
},
"recordedTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
},
"correlationId": {
"type": "string",
"minLength": 1
},
"causationId": {
"type": "string",
"minLength": 1
},
"reversesEventId": {
"type": "string",
"minLength": 1
},
"provenance": {
"$ref": "#/$defs/Provenance"
},
"eventType": {},
"event": {}
},
"additionalProperties": false,
"required": [
"eventId",
"schemaVersion",
"sourceId",
"accountId",
"effectiveTimestampMs",
"recordedTimestampMs",
"provenance",
"eventType",
"event"
]
},
{
"anyOf": [
{
"properties": {
"eventType": {
"const": "cash.deposit",
"type": "string"
},
"event": {
"$ref": "#/$defs/CashDeposit"
}
}
},
{
"properties": {
"eventType": {
"const": "cash.withdrawal",
"type": "string"
},
"event": {
"$ref": "#/$defs/CashWithdrawal"
}
}
},
{
"properties": {
"eventType": {
"const": "cash.transfer",
"type": "string"
},
"event": {
"$ref": "#/$defs/CashTransfer"
}
}
},
{
"properties": {
"eventType": {
"const": "cash.conversion",
"type": "string"
},
"event": {
"$ref": "#/$defs/CashConversion"
}
}
},
{
"properties": {
"eventType": {
"const": "trade.fill",
"type": "string"
},
"event": {
"$ref": "#/$defs/TradeFill"
}
}
},
{
"properties": {
"eventType": {
"const": "cost.charge",
"type": "string"
},
"event": {
"$ref": "#/$defs/CostCharge"
}
}
},
{
"properties": {
"eventType": {
"const": "income.received",
"type": "string"
},
"event": {
"$ref": "#/$defs/IncomeReceived"
}
}
},
{
"properties": {
"eventType": {
"const": "financing.charge",
"type": "string"
},
"event": {
"$ref": "#/$defs/FinancingCharge"
}
}
},
{
"properties": {
"eventType": {
"const": "corporate.split",
"type": "string"
},
"event": {
"$ref": "#/$defs/CorporateSplit"
}
}
},
{
"properties": {
"eventType": {
"const": "derivative.exercise",
"type": "string"
},
"event": {
"$ref": "#/$defs/DerivativeExercise"
}
}
},
{
"properties": {
"eventType": {
"const": "derivative.assignment",
"type": "string"
},
"event": {
"$ref": "#/$defs/DerivativeAssignment"
}
}
},
{
"properties": {
"eventType": {
"const": "derivative.expiration",
"type": "string"
},
"event": {
"$ref": "#/$defs/DerivativeExpiration"
}
}
},
{
"properties": {
"eventType": {
"const": "derivative.multiplier-change",
"type": "string"
},
"event": {
"$ref": "#/$defs/DerivativeMultiplierChange"
}
}
},
{
"properties": {
"eventType": {
"const": "derivative.variation-margin",
"type": "string"
},
"event": {
"$ref": "#/$defs/DerivativeVariationMargin"
}
}
},
{
"properties": {
"eventType": {
"const": "derivative.roll",
"type": "string"
},
"event": {
"$ref": "#/$defs/DerivativeRoll"
}
}
},
{
"properties": {
"eventType": {
"const": "fixed-income.redemption",
"type": "string"
},
"event": {
"$ref": "#/$defs/FixedIncomeRedemption"
}
}
},
{
"properties": {
"eventType": {
"const": "corporate.symbol-change",
"type": "string"
},
"event": {
"$ref": "#/$defs/CorporateSymbolChange"
}
}
},
{
"properties": {
"eventType": {
"const": "corporate.merger",
"type": "string"
},
"event": {
"$ref": "#/$defs/CorporateMerger"
}
}
},
{
"properties": {
"eventType": {
"const": "corporate.spin-off",
"type": "string"
},
"event": {
"$ref": "#/$defs/CorporateSpinOff"
}
}
},
{
"properties": {
"eventType": {
"const": "corporate.return-of-capital",
"type": "string"
},
"event": {
"$ref": "#/$defs/CorporateReturnOfCapital"
}
}
},
{
"properties": {
"eventType": {
"const": "corporate.cash-in-lieu",
"type": "string"
},
"event": {
"$ref": "#/$defs/CorporateCashInLieu"
}
}
},
{
"properties": {
"eventType": {
"const": "position.transfer",
"type": "string"
},
"event": {
"$ref": "#/$defs/PositionTransfer"
}
}
},
{
"properties": {
"eventType": {
"const": "admin.reversal",
"type": "string"
},
"event": {
"type": "object",
"properties": {
"eventType": {
"const": "admin.reversal",
"type": "string"
},
"original": {
"$ref": "#/$defs/PortfolioEventEnvelope"
},
"reason": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"eventType",
"original"
]
}
},
"required": [
"reversesEventId"
]
},
{
"properties": {
"eventType": {
"const": "admin.correction",
"type": "string"
},
"event": {
"type": "object",
"properties": {
"eventType": {
"const": "admin.correction",
"type": "string"
},
"original": {
"$ref": "#/$defs/PortfolioEventEnvelope"
},
"replacement": {
"anyOf": [
{
"$ref": "#/$defs/CashDeposit"
},
{
"$ref": "#/$defs/CashWithdrawal"
},
{
"$ref": "#/$defs/CashTransfer"
},
{
"$ref": "#/$defs/CashConversion"
},
{
"$ref": "#/$defs/TradeFill"
},
{
"$ref": "#/$defs/CostCharge"
},
{
"$ref": "#/$defs/IncomeReceived"
},
{
"$ref": "#/$defs/FinancingCharge"
},
{
"$ref": "#/$defs/CorporateSplit"
},
{
"$ref": "#/$defs/DerivativeExercise"
},
{
"$ref": "#/$defs/DerivativeAssignment"
},
{
"$ref": "#/$defs/DerivativeExpiration"
},
{
"$ref": "#/$defs/DerivativeMultiplierChange"
},
{
"$ref": "#/$defs/DerivativeVariationMargin"
},
{
"$ref": "#/$defs/DerivativeRoll"
},
{
"$ref": "#/$defs/FixedIncomeRedemption"
},
{
"$ref": "#/$defs/CorporateSymbolChange"
},
{
"$ref": "#/$defs/CorporateMerger"
},
{
"$ref": "#/$defs/CorporateSpinOff"
},
{
"$ref": "#/$defs/CorporateReturnOfCapital"
},
{
"$ref": "#/$defs/CorporateCashInLieu"
},
{
"$ref": "#/$defs/PositionTransfer"
}
]
},
"reason": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"eventType",
"original",
"replacement"
]
}
},
"required": [
"reversesEventId"
]
},
{
"properties": {
"eventType": {
"const": "admin.account-migration",
"type": "string"
},
"event": {
"type": "object",
"properties": {
"eventType": {
"const": "admin.account-migration",
"type": "string"
},
"fromAccountId": {
"type": "string",
"minLength": 1
},
"toAccountId": {
"type": "string",
"minLength": 1
},
"reason": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"eventType",
"fromAccountId",
"toAccountId"
]
}
}
}
]
}
]
},
"Provenance": {
"type": "object",
"properties": {
"provider": {
"type": "string"
},
"dataset": {
"type": "string"
},
"asOf": {
"type": "number",
"description": "Epoch milliseconds"
},
"receivedAt": {
"type": "number",
"description": "Epoch milliseconds"
},
"sourceVersion": {
"type": "string"
},
"requestId": {
"type": "string"
},
"warnings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"code": {
"type": "string",
"minLength": 1
},
"message": {
"type": "string"
},
"severity": {
"type": "string",
"enum": [
"info",
"warn",
"error"
]
},
"context": {
"type": "object",
"additionalProperties": {}
}
},
"additionalProperties": false,
"required": [
"code",
"message",
"severity"
]
}
}
},
"additionalProperties": false
},
"CashDeposit": {
"type": "object",
"properties": {
"eventType": {
"const": "cash.deposit",
"type": "string"
},
"amount": {
"type": "number",
"exclusiveMinimum": 0
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"settleTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
}
},
"additionalProperties": false,
"required": [
"eventType",
"amount",
"currency"
]
},
"CashWithdrawal": {
"type": "object",
"properties": {
"eventType": {
"const": "cash.withdrawal",
"type": "string"
},
"amount": {
"type": "number",
"exclusiveMinimum": 0
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"settleTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
}
},
"additionalProperties": false,
"required": [
"eventType",
"amount",
"currency"
]
},
"CashTransfer": {
"type": "object",
"properties": {
"eventType": {
"const": "cash.transfer",
"type": "string"
},
"amount": {
"type": "number",
"exclusiveMinimum": 0
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"fromAccountId": {
"type": "string",
"minLength": 1
},
"toAccountId": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false,
"required": [
"eventType",
"amount",
"currency",
"fromAccountId",
"toAccountId"
]
},
"CashConversion": {
"type": "object",
"properties": {
"eventType": {
"const": "cash.conversion",
"type": "string"
},
"fromCurrency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"toCurrency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"fromAmount": {
"type": "number",
"exclusiveMinimum": 0
},
"toAmount": {
"type": "number",
"exclusiveMinimum": 0
}
},
"additionalProperties": false,
"required": [
"eventType",
"fromCurrency",
"toCurrency",
"fromAmount",
"toAmount"
]
},
"TradeFill": {
"type": "object",
"properties": {
"eventType": {
"const": "trade.fill",
"type": "string"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"side": {
"type": "string",
"enum": [
"buy",
"sell"
]
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0
},
"pricePerUnit": {
"type": "number"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"settleTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
},
"lotSelections": {
"$ref": "#/$defs/LotSelections"
},
"contractMultiplier": {
"type": "number",
"exclusiveMinimum": 0
},
"settlementStyle": {
"type": "string",
"enum": [
"cash-on-trade",
"variation-margin"
]
},
"contract": {
"$ref": "#/$defs/Contract"
},
"accruedInterest": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"eventType",
"instrumentId",
"side",
"quantity",
"pricePerUnit",
"currency"
]
},
"LotSelections": {
"type": "array",
"items": {
"type": "object",
"properties": {
"lotId": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0
}
},
"additionalProperties": false,
"required": [
"lotId",
"quantity"
]
},
"minItems": 1
},
"Contract": {
"anyOf": [
{
"type": "object",
"properties": {
"kind": {
"const": "option",
"type": "string"
},
"underlyingInstrumentId": {
"type": "string",
"minLength": 1
},
"type": {
"type": "string",
"enum": [
"call",
"put"
]
},
"strikePricePerUnit": {
"type": "number"
},
"expiryTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
}
},
"additionalProperties": false,
"required": [
"kind",
"underlyingInstrumentId",
"type",
"strikePricePerUnit",
"expiryTimestampMs"
]
},
{
"type": "object",
"properties": {
"kind": {
"const": "future",
"type": "string"
},
"underlyingInstrumentId": {
"type": "string",
"minLength": 1
},
"expiryTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
}
},
"additionalProperties": false,
"required": [
"kind",
"underlyingInstrumentId",
"expiryTimestampMs"
]
},
{
"type": "object",
"properties": {
"kind": {
"const": "perpetual",
"type": "string"
},
"underlyingInstrumentId": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false,
"required": [
"kind",
"underlyingInstrumentId"
]
}
]
},
"CostCharge": {
"type": "object",
"properties": {
"eventType": {
"const": "cost.charge",
"type": "string"
},
"costType": {
"type": "string",
"enum": [
"commission",
"exchange-fee",
"regulatory-fee",
"slippage-adjustment"
]
},
"amount": {
"type": "number"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"relatesToEventId": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false,
"required": [
"eventType",
"costType",
"amount",
"currency"
]
},
"IncomeReceived": {
"type": "object",
"properties": {
"eventType": {
"const": "income.received",
"type": "string"
},
"incomeType": {
"type": "string",
"enum": [
"dividend",
"coupon",
"interest",
"staking-reward",
"funding-receipt"
]
},
"amount": {
"type": "number"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"settleTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
}
},
"additionalProperties": false,
"required": [
"eventType",
"incomeType",
"amount",
"currency"
]
},
"FinancingCharge": {
"type": "object",
"properties": {
"eventType": {
"const": "financing.charge",
"type": "string"
},
"financingType": {
"type": "string",
"enum": [
"margin-interest",
"borrow-charge",
"funding-payment"
]
},
"amount": {
"type": "number"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"instrumentId": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false,
"required": [
"eventType",
"financingType",
"amount",
"currency"
]
},
"CorporateSplit": {
"type": "object",
"properties": {
"eventType": {
"const": "corporate.split",
"type": "string"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"sharesAfterSplit": {
"type": "number",
"exclusiveMinimum": 0
},
"sharesBeforeSplit": {
"type": "number",
"exclusiveMinimum": 0
}
},
"additionalProperties": false,
"required": [
"eventType",
"instrumentId",
"sharesAfterSplit",
"sharesBeforeSplit"
]
},
"DerivativeExercise": {
"type": "object",
"properties": {
"eventType": {
"const": "derivative.exercise",
"type": "string"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0
},
"settlement": {
"$ref": "#/$defs/Settlement"
},
"premiumTreatment": {
"type": "string",
"enum": [
"fold-into-underlying-basis",
"realize"
]
},
"settleTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
},
"lotSelections": {
"$ref": "#/$defs/LotSelections"
}
},
"additionalProperties": false,
"required": [
"eventType",
"instrumentId",
"quantity",
"settlement",
"premiumTreatment"
]
},
"Settlement": {
"anyOf": [
{
"type": "object",
"properties": {
"kind": {
"const": "physical",
"type": "string"
}
},
"additionalProperties": false,
"required": [
"kind"
]
},
{
"type": "object",
"properties": {
"kind": {
"const": "cash",
"type": "string"
},
"settlementPricePerUnit": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"kind",
"settlementPricePerUnit"
]
}
]
},
"DerivativeAssignment": {
"type": "object",
"properties": {
"eventType": {
"const": "derivative.assignment",
"type": "string"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0
},
"settlement": {
"$ref": "#/$defs/Settlement"
},
"premiumTreatment": {
"type": "string",
"enum": [
"fold-into-underlying-basis",
"realize"
]
},
"settleTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
},
"lotSelections": {
"$ref": "#/$defs/LotSelections"
}
},
"additionalProperties": false,
"required": [
"eventType",
"instrumentId",
"quantity",
"settlement",
"premiumTreatment"
]
},
"DerivativeExpiration": {
"type": "object",
"properties": {
"eventType": {
"const": "derivative.expiration",
"type": "string"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0
},
"lotSelections": {
"$ref": "#/$defs/LotSelections"
}
},
"additionalProperties": false,
"required": [
"eventType",
"instrumentId",
"quantity"
]
},
"DerivativeMultiplierChange": {
"type": "object",
"properties": {
"eventType": {
"const": "derivative.multiplier-change",
"type": "string"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"contractMultiplierAfter": {
"type": "number",
"exclusiveMinimum": 0
},
"strikePricePerUnitAfter": {
"type": "number",
"exclusiveMinimum": 0
},
"reason": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"eventType",
"instrumentId",
"contractMultiplierAfter"
]
},
"DerivativeVariationMargin": {
"type": "object",
"properties": {
"eventType": {
"const": "derivative.variation-margin",
"type": "string"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"settlementPricePerUnit": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"eventType",
"instrumentId",
"settlementPricePerUnit"
]
},
"DerivativeRoll": {
"type": "object",
"properties": {
"eventType": {
"const": "derivative.roll",
"type": "string"
},
"fromInstrumentId": {
"type": "string",
"minLength": 1
},
"toInstrumentId": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0
},
"closePricePerUnit": {
"type": "number"
},
"openPricePerUnit": {
"type": "number"
},
"contract": {
"$ref": "#/$defs/Contract"
},
"lotSelections": {
"$ref": "#/$defs/LotSelections"
}
},
"additionalProperties": false,
"required": [
"eventType",
"fromInstrumentId",
"toInstrumentId",
"quantity",
"closePricePerUnit",
"openPricePerUnit"
]
},
"FixedIncomeRedemption": {
"type": "object",
"properties": {
"eventType": {
"const": "fixed-income.redemption",
"type": "string"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"redemptionType": {
"type": "string",
"enum": [
"maturity",
"call",
"principal-paydown",
"sinking-fund"
]
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0
},
"pricePerUnit": {
"type": "number"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"settleTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
},
"lotSelections": {
"$ref": "#/$defs/LotSelections"
}
},
"additionalProperties": false,
"required": [
"eventType",
"instrumentId",
"redemptionType",
"quantity",
"pricePerUnit",
"currency"
]
},
"CorporateSymbolChange": {
"type": "object",
"properties": {
"eventType": {
"const": "corporate.symbol-change",
"type": "string"
},
"fromInstrumentId": {
"type": "string",
"minLength": 1
},
"toInstrumentId": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false,
"required": [
"eventType",
"fromInstrumentId",
"toInstrumentId"
]
},
"CorporateMerger": {
"type": "object",
"properties": {
"eventType": {
"const": "corporate.merger",
"type": "string"
},
"fromInstrumentId": {
"type": "string",
"minLength": 1
},
"toInstrumentId": {
"type": "string",
"minLength": 1
},
"sharesPerShare": {
"type": "number",
"exclusiveMinimum": 0
},
"cashPerShare": {
"type": "number"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"settleTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
}
},
"additionalProperties": false,
"required": [
"eventType",
"fromInstrumentId"
]
},
"CorporateSpinOff": {
"type": "object",
"properties": {
"eventType": {
"const": "corporate.spin-off",
"type": "string"
},
"parentInstrumentId": {
"type": "string",
"minLength": 1
},
"childInstrumentId": {
"type": "string",
"minLength": 1
},
"sharesPerParentShare": {
"type": "number",
"exclusiveMinimum": 0
},
"basisAllocationFraction": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"eventType",
"parentInstrumentId",
"childInstrumentId",
"sharesPerParentShare",
"basisAllocationFraction"
]
},
"CorporateReturnOfCapital": {
"type": "object",
"properties": {
"eventType": {
"const": "corporate.return-of-capital",
"type": "string"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"amountPerShare": {
"type": "number"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"settleTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
}
},
"additionalProperties": false,
"required": [
"eventType",
"instrumentId",
"amountPerShare",
"currency"
]
},
"CorporateCashInLieu": {
"type": "object",
"properties": {
"eventType": {
"const": "corporate.cash-in-lieu",
"type": "string"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0
},
"amount": {
"type": "number"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"relatesToEventId": {
"type": "string",
"minLength": 1
},
"settleTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
}
},
"additionalProperties": false,
"required": [
"eventType",
"instrumentId",
"quantity",
"amount",
"currency"
]
},
"PositionTransfer": {
"type": "object",
"properties": {
"eventType": {
"const": "position.transfer",
"type": "string"
},
"instrumentId": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0
},
"fromAccountId": {
"type": "string",
"minLength": 1
},
"toAccountId": {
"type": "string",
"minLength": 1
},
"lotSelections": {
"$ref": "#/$defs/LotSelections"
}
},
"additionalProperties": false,
"required": [
"eventType",
"instrumentId",
"quantity",
"fromAccountId",
"toAccountId"
]
}
}
}Output schema
{
"type": "object",
"properties": {
"handle": {
"type": "object",
"properties": {
"uri": {
"type": "string",
"minLength": 1
},
"kind": {
"type": "string",
"enum": [
"report",
"job",
"portfolio",
"scenario",
"market",
"authorization",
"journal"
]
},
"schema": {
"type": "string",
"minLength": 1
},
"version": {
"type": "string"
},
"contentHash": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"createdTimestampMs": {
"type": "number",
"description": "Epoch milliseconds"
},
"expiresTimestampMs": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
},
"provenance": {
"type": "object",
"properties": {
"provider": {
"type": "string"
},
"dataset": {
"type": "string"
},
"asOf": {
"type": "number",
"description": "Epoch milliseconds"
},
"receivedAt": {
"type": "number",
"description": "Epoch milliseconds"
},
"sourceVersion": {
"type": "string"
},
"requestId": {
"type": "string"
},
"warnings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"code": {
"type": "string",
"minLength": 1
},
"message": {
"type": "string"
},
"severity": {
"type": "string",
"enum": [
"info",
"warn",
"error"
]
},
"context": {
"type": "object",
"additionalProperties": {}
}
},
"additionalProperties": false,
"required": [
"code",
"message",
"severity"
]
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"required": [
"uri",
"kind",
"schema",
"version",
"contentHash",
"createdTimestampMs",
"expiresTimestampMs",
"provenance"
]
},
"portfolioId": {
"type": "string"
},
"baseCurrency": {
"type": "string"
},
"eventCount": {
"type": "integer",
"minimum": 0
},
"lotRelief": {
"type": "string",
"enum": [
"fifo",
"lifo",
"highest-cost",
"specific-lot"
]
},
"inspectOperation": {
"const": "totalfinance.portfolio.inspect",
"type": "string"
}
},
"additionalProperties": false,
"required": [
"handle",
"portfolioId",
"baseCurrency",
"eventCount",
"lotRelief",
"inspectOperation"
],
"$id": "https://totalfinance.dev/schemas/portfolio.create.output"
}