{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/ibanfirst/main/json-schema/ibanfirst-trade-reconciliation-schema.json",
  "title": "TradeReconciliation",
  "description": "Representation of a Trade.\n",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ibanfirst-spot-trades-api-openapi.yml#/components/schemas/TradeReconciliation",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/ID"
    },
    "status": {
      "type": "string",
      "description": "The code identifying the payment status.\n",
      "enum": [
        "planified",
        "rejected",
        "finalized",
        "canceled",
        "refused",
        "blocked"
      ]
    },
    "appliedRate": {
      "$ref": "#/$defs/QuotedDecimal"
    },
    "side": {
      "description": "The side representing the quote. `S` to sell and `B` to buy.\n",
      "type": "string",
      "enum": [
        "B",
        "S"
      ]
    },
    "sourceAmount": {
      "$ref": "#/$defs/Amount"
    },
    "deliveredAmount": {
      "$ref": "#/$defs/Amount"
    },
    "sourceWalletId": {
      "$ref": "#/$defs/ID"
    },
    "deliveryWalletId": {
      "$ref": "#/$defs/ID"
    },
    "accountSourceNumber": {
      "type": "string",
      "maxLength": 40,
      "description": "Iban or account number.\n"
    },
    "accountTargetNumber": {
      "type": "string",
      "maxLength": 40,
      "description": "Iban or account number.\n"
    },
    "rate": {
      "$ref": "#/$defs/Rate"
    },
    "createdDate": {
      "$ref": "#/$defs/Datetime"
    },
    "deliveryDate": {
      "$ref": "#/$defs/Date"
    }
  },
  "$defs": {
    "Amount": {
      "type": [
        "object",
        "null"
      ],
      "description": "Representation of an amount.\n",
      "required": [
        "value",
        "currency"
      ],
      "properties": {
        "value": {
          "$ref": "#/$defs/QuotedDecimal"
        },
        "currency": {
          "$ref": "#/$defs/Currency"
        }
      }
    },
    "Currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$",
      "format": "^[A-Z]{3}$",
      "description": "A String representing the Three-digit ISO 4217 Currency Code of a currency. This String only contains capitalized letters.\n"
    },
    "CurrencyPair": {
      "type": "string",
      "pattern": "^[A-Z]{6}$",
      "format": "^[A-Z]{6}$",
      "description": "A String representing two concatenated Three-digit ISO 4217 Currency Code of a currency. This String only contains capitalized letters.\n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n"
    },
    "Date": {
      "type": "string",
      "pattern": "^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}$",
      "format": "^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}$",
      "description": "A String representing a date by its year, month and day in month.\n    \n"
    },
    "Datetime": {
      "type": "string",
      "pattern": "^((19[0,99]|2[0-9]{3})\\-(0[1-9]|1[012])\\-([012][0-9]|3[01])\\ ([01][0-9]|2[0-3])\\:([0-5][0-9])\\:([0-5][0-9]))$",
      "format": "^((19[0,99]|2[0-9]{3})\\-(0[1-9]|1[012])\\-([012][0-9]|3[01])\\ ([01][0-9]|2[0-3])\\:([0-5][0-9])\\:([0-5][0-9]))$",
      "description": "A String representing a date by its year, month, day in month, hour, minute and second.\n"
    },
    "ID": {
      "type": "string",
      "pattern": "^[A-Za-z0-9]+$",
      "format": "^[A-Za-z0-9]+$",
      "description": "A String representing the id of an object. This string contains alpha-numeric characters, including the capital ones.\n"
    },
    "QuotedDecimal": {
      "type": "string",
      "pattern": "^((\\-)?)[0-9]{12}((\\.[0-9]{1,7})?)$",
      "format": "^((\\-)?)[0-9]{12}((\\.[0-9]{1,7})?)$",
      "description": "A String representing a formatted floating number.\n"
    },
    "Rate": {
      "type": "object",
      "description": "Representation of a Rate.\n",
      "properties": {
        "currencyPair": {
          "$ref": "#/$defs/CurrencyPair"
        },
        "midMarket": {
          "$ref": "#/$defs/QuotedDecimal"
        },
        "date": {
          "$ref": "#/$defs/Datetime"
        },
        "coreAsk": {
          "$ref": "#/$defs/QuotedDecimal"
        },
        "coreBid": {
          "$ref": "#/$defs/QuotedDecimal"
        },
        "appliedAsk": {
          "$ref": "#/$defs/QuotedDecimal"
        },
        "appliedBid": {
          "$ref": "#/$defs/QuotedDecimal"
        }
      }
    }
  }
}