{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/finbourne/json-schema/finbourne-edit-transfer-request-schema.json",
  "title": "EditTransferRequest",
  "description": "A request to edit a transfer: the same fields as a create request, replacing both transaction legs and the\r\nTransfer entity of the transfer the identity fields name.",
  "x-generated": "2026-12-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/finbourne-lusid-openapi.json#/components/schemas/EditTransferRequest",
  "required": [
    "instrumentIdentifierIn",
    "instrumentIdentifierOut",
    "portfolioIdIn",
    "portfolioIdOut",
    "pricingMethod",
    "settlementDateOut",
    "tradeDateIn",
    "tradeDateOut",
    "transferId",
    "unitsIn",
    "unitsOut"
  ],
  "type": "object",
  "properties": {
    "transferId": {
      "$ref": "#/$defs/ResourceId"
    },
    "portfolioIdOut": {
      "$ref": "#/$defs/ResourceId"
    },
    "portfolioIdIn": {
      "$ref": "#/$defs/ResourceId"
    },
    "instrumentIdentifierOut": {
      "maxLength": 64,
      "minLength": 1,
      "type": "string",
      "description": "The LUSID instrument id of the instrument moving out. A position in this instrument must exist in the outgoing portfolio on the outgoing trade date."
    },
    "instrumentIdentifierIn": {
      "maxLength": 64,
      "minLength": 1,
      "type": "string",
      "description": "The LUSID instrument id of the instrument moving in. Equal to InstrumentIdentifierOut for a transfer between portfolios."
    },
    "pricingMethod": {
      "minLength": 1,
      "type": "string",
      "description": "How the legs are priced. 'AtCost' uses the cost per unit of the outgoing holding; 'AtPrice' uses the supplied TransactionPriceOut, which is then required. Available values: AtCost, AtPrice."
    },
    "taxLotStructure": {
      "type": [
        "string",
        "null"
      ],
      "description": "What happens to the tax lots of the outgoing position. Defaults to 'Consolidate'. 'Preserve' carries each outgoing lot onto the incoming position; it is not supported when the incoming portfolio uses the AverageCost or Default accounting method, or across share classes in different currencies. Available values: Consolidate, Preserve."
    },
    "unitsOut": {
      "type": "number",
      "description": "The number of units to move out. Must be greater than zero.",
      "format": "double"
    },
    "unitsIn": {
      "type": "number",
      "description": "The number of units to move in. Must be greater than zero.",
      "format": "double"
    },
    "amountOut": {
      "type": [
        "number",
        "null"
      ],
      "description": "The total consideration of the outgoing leg. Recorded, not applied.",
      "format": "double"
    },
    "weightOut": {
      "type": [
        "number",
        "null"
      ],
      "description": "The weighting factor of the outgoing leg. Recorded, not applied.",
      "format": "double"
    },
    "tradeDateOut": {
      "type": "string",
      "description": "The trade date of the outgoing leg. Must not be later than TradeDateIn.",
      "format": "date-time"
    },
    "tradeDateIn": {
      "type": "string",
      "description": "The trade date of the incoming leg.",
      "format": "date-time"
    },
    "settlementDateOut": {
      "type": "string",
      "description": "The settlement date of the outgoing leg. Must not be later than SettlementDateIn.",
      "format": "date-time"
    },
    "settlementDateIn": {
      "type": [
        "string",
        "null"
      ],
      "description": "The settlement date of the incoming leg. Defaults to SettlementDateOut when not supplied.",
      "format": "date-time"
    },
    "exchangeRateOut": {
      "type": [
        "number",
        "null"
      ],
      "description": "The FX rate to apply to the outgoing leg.",
      "format": "double"
    },
    "exchangeRateIn": {
      "type": [
        "number",
        "null"
      ],
      "description": "The FX rate to apply to the incoming leg.",
      "format": "double"
    },
    "transactionPriceOut": {
      "type": [
        "number",
        "null"
      ],
      "description": "The unit price of the outgoing leg. Required when PricingMethod is 'AtPrice', and ignored when it is 'AtCost'.",
      "format": "double"
    },
    "transactionPriceIn": {
      "type": [
        "number",
        "null"
      ],
      "description": "The unit price of the incoming leg. Not accepted for a transfer of one instrument between portfolios, which carries the outgoing price across. For a switch, required when PricingMethod is 'AtPrice' and defaults to the outgoing price otherwise.",
      "format": "double"
    },
    "counterpartyIdOut": {
      "maxLength": 64,
      "minLength": 1,
      "type": [
        "string",
        "null"
      ],
      "description": "The counterparty identifier of the outgoing leg."
    },
    "counterpartyIdIn": {
      "maxLength": 64,
      "minLength": 1,
      "type": [
        "string",
        "null"
      ],
      "description": "The counterparty identifier of the incoming leg. Defaults to CounterpartyIdOut."
    },
    "custodianAccountIdOut": {
      "$ref": "#/$defs/ResourceId"
    },
    "custodianAccountIdIn": {
      "$ref": "#/$defs/ResourceId"
    },
    "sourceOut": {
      "maxLength": 64,
      "minLength": 1,
      "type": [
        "string",
        "null"
      ],
      "description": "The transaction source the outgoing leg is booked against, and the incoming leg too when SourceIn is not supplied. Defaults to 'default'."
    },
    "accountingMethod": {
      "type": [
        "string",
        "null"
      ],
      "description": "An accounting method to record against the transfer. Available values: AverageCost, FirstInFirstOut, LastInFirstOut, HighestCostFirst, LowestCostFirst, ProRateByUnits, ProRateByCost, ProRateByCostPortfolioCurrency, IntraDayThenFirstInFirstOut, LongTermHighestCostFirst, LongTermHighestCostFirstPortfolioCurrency, HighestCostFirstPortfolioCurrency, LowestCostFirstPortfolioCurrency, MaximumLossMinimumGain, MaximumLossMinimumGainPortfolioCurrency."
    },
    "propertiesOut": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "$ref": "#/$defs/PerpetualProperty"
      },
      "description": "Transaction Properties to set on the outgoing transaction leg, and on the incoming transaction leg when PropertiesIn is absent. Supplying an empty collection for PropertiesIn leaves the incoming leg with no properties."
    },
    "propertiesIn": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "$ref": "#/$defs/PerpetualProperty"
      },
      "description": "Transaction Properties to set on the incoming transaction leg, replacing rather than adding to PropertiesOut."
    },
    "properties": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "$ref": "#/$defs/PerpetualProperty"
      },
      "description": "Properties to set on the transfer itself, in the Transfer domain. These are separate from PropertiesOut and PropertiesIn, which are Transaction domain and land on the legs."
    },
    "transactionToPortfolioRateOut": {
      "type": [
        "number",
        "null"
      ],
      "description": "The rate from the outgoing leg's trade currency to the outgoing portfolio's base currency, applied whenever supplied.",
      "format": "double"
    },
    "transactionToPortfolioRateIn": {
      "type": [
        "number",
        "null"
      ],
      "description": "The rate from the incoming leg's trade currency to the incoming portfolio's base currency. Required when the two portfolios have different base currencies, and applied whenever supplied.",
      "format": "double"
    },
    "sourceIn": {
      "maxLength": 64,
      "minLength": 1,
      "type": [
        "string",
        "null"
      ],
      "description": "The transaction source the incoming leg is booked against. Defaults to SourceOut."
    },
    "transactionTypeOut": {
      "maxLength": 64,
      "minLength": 1,
      "type": [
        "string",
        "null"
      ],
      "description": "The transaction type to book the outgoing leg as. Supply it together with TransactionTypeIn, or supply neither. If not supplied, it will be derived from the transfer type. It must be a different type from TransactionTypeIn, must be configured under SourceOut in the transaction type scope of PortfolioIdOut, and must reduce a position."
    },
    "transactionTypeIn": {
      "maxLength": 64,
      "minLength": 1,
      "type": [
        "string",
        "null"
      ],
      "description": "The transaction type to book the incoming leg as. Supply it together with TransactionTypeOut, or supply neither. If not supplied, it will be derived from the transfer type. It must be configured under SourceIn in the transaction type scope of PortfolioIdIn, and must increase a position."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "LabelValueSet": {
      "required": [
        "values"
      ],
      "type": "object",
      "properties": {
        "values": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false,
      "description": "The set of string labels in a multi-value property."
    },
    "MetricValue": {
      "type": "object",
      "properties": {
        "value": {
          "type": "number",
          "description": "The numerical value of the property.",
          "format": "double"
        },
        "unit": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "PerpetualProperty": {
      "required": [
        "key"
      ],
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "description": "The key of the property. This takes the format {domain}/{scope}/{code} e.g. 'Instrument/system/Name' or 'Transaction/strategy/quantsignal'."
        },
        "value": {
          "$ref": "#/$defs/PropertyValue"
        },
        "referenceData": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "$ref": "#/$defs/PropertyReferenceDataValue"
          },
          "description": "The ReferenceData linked to the value of the property. The ReferenceData is taken from the DataType on the PropertyDefinition that defines the property.",
          "readOnly": true
        }
      },
      "additionalProperties": false
    },
    "PropertyReferenceDataValue": {
      "type": "object",
      "properties": {
        "stringValue": {
          "maxLength": 512,
          "minLength": 1,
          "type": [
            "string",
            "null"
          ]
        },
        "numericValue": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      },
      "additionalProperties": false,
      "description": "The ReferenceData relevant to the property. The ReferenceData is taken from the DataType on the PropertyDefinition that defines the Property.\r\nOnly ReferenceData where the ReferenceData value matches the Property value is included."
    },
    "PropertyValue": {
      "type": "object",
      "properties": {
        "labelValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "The text value of a property defined as having the 'Label' type."
        },
        "metricValue": {
          "$ref": "#/$defs/MetricValue"
        },
        "labelValueSet": {
          "$ref": "#/$defs/LabelValueSet"
        }
      },
      "additionalProperties": false,
      "description": "The value of the property."
    },
    "ResourceId": {
      "required": [
        "code",
        "scope"
      ],
      "type": "object",
      "properties": {
        "scope": {
          "maxLength": 512,
          "minLength": 1,
          "type": "string",
          "description": "The scope used to identify an entity"
        },
        "code": {
          "maxLength": 512,
          "minLength": 1,
          "type": "string",
          "description": "The code used to identify an entity"
        }
      },
      "additionalProperties": false,
      "description": "Identifiers of an entity"
    }
  }
}