{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/atlar/json-schema/atlar-holding-activity-schema.json",
  "title": "HoldingActivity",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/atlar-investments-api-openapi.yml#/components/schemas/HoldingActivity",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/ResourceID",
      "readOnly": true
    },
    "organizationId": {
      "$ref": "#/$defs/OrganizationID",
      "readOnly": true
    },
    "portfolioId": {
      "$ref": "#/$defs/ResourceID",
      "readOnly": true
    },
    "holdingId": {
      "$ref": "#/$defs/ResourceID",
      "readOnly": true
    },
    "date": {
      "description": "Settlement date — when cash and securities are exchanged to finalize the trade.",
      "$ref": "#/$defs/Date",
      "readOnly": true
    },
    "tradeDate": {
      "description": "Trade date — when the transaction was executed and agreed upon.",
      "$ref": "#/$defs/Date",
      "readOnly": true
    },
    "amount": {
      "$ref": "#/$defs/Amount",
      "readOnly": true
    },
    "nav": {
      "$ref": "#/$defs/Amount",
      "readOnly": true
    },
    "scaledNav": {
      "$ref": "#/$defs/ScaledAmount",
      "readOnly": true
    },
    "shares": {
      "type": "number",
      "format": "double",
      "description": "Number of shares traded"
    },
    "type": {
      "$ref": "#/$defs/HoldingActivityType",
      "readOnly": true
    },
    "created": {
      "$ref": "#/$defs/CreatedTimestamp",
      "readOnly": true
    },
    "updated": {
      "$ref": "#/$defs/UpdatedTimestamp",
      "readOnly": true
    },
    "version": {
      "$ref": "#/$defs/ResourceVersion",
      "readOnly": true
    },
    "etag": {
      "$ref": "#/$defs/ETag",
      "readOnly": true
    },
    "metadata": {
      "$ref": "#/$defs/Metadata",
      "readOnly": true
    }
  },
  "required": [
    "id",
    "organizationId",
    "portfolioId",
    "holdingId",
    "date",
    "amount",
    "type",
    "created",
    "updated",
    "version",
    "etag"
  ],
  "$defs": {
    "Amount": {
      "type": "object",
      "properties": {
        "currency": {
          "$ref": "#/$defs/CurrencyCode"
        },
        "stringValue": {
          "description": "A string representation of the amount value. This will be\na decimal number if the currency has decimals. The number\nis not formatted for display purposes (e.g. with locale\nspecific thousand separator) and always contains the dot\n`.` character as decimal separator.",
          "type": "string"
        },
        "value": {
          "description": "The amount value as an integer (int64) represented in\ncurrency minor units (e.g. 15.02 EUR is represented as the\nvalue 1502).",
          "type": "integer",
          "format": "int64"
        }
      },
      "required": [
        "currency",
        "stringValue",
        "value"
      ]
    },
    "CreatedTimestamp": {
      "type": "string",
      "format": "date-time",
      "description": "Time at which the resource was created.",
      "readOnly": true
    },
    "CurrencyCode": {
      "type": "string",
      "description": "Three-letter ISO 4217 currency code.",
      "minLength": 3,
      "maxLength": 3,
      "pattern": "^[A-Z]{3,3}$"
    },
    "Date": {
      "type": "string",
      "format": "date",
      "description": "`full-date` notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), for example, `2017-07-21`."
    },
    "ETag": {
      "type": "string",
      "description": "[ETag](https://en.wikipedia.org/wiki/HTTP_ETag) based on the\nresource version. This can be passed along in `If-Match` HTTP\nheader when updating a resource to perform a conditional\nupdate.",
      "pattern": "^version:\\d{1,4}$",
      "readOnly": true
    },
    "HoldingActivityType": {
      "type": "string",
      "description": "The type of the activity on the holding.",
      "enum": [
        "PURCHASE",
        "REDEEM",
        "DIVIDEND"
      ]
    },
    "Metadata": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "string"
      },
      "description": "Metadata is a `string-string` key-value container that\ncan be used to store information known at the time of resource\ncreation. This can be retrieved later on, for instance when a\npayment or expected transaction is reconciled with the booked\ntransaction on the bank statement.\n\nMetadata can have at most 20 entries. Keys may have a\nmaximum length of 64 chars and values a maximum length of 512\nchars.\n\nBy default, this field is optional. It is possible to make it\nrequired in the Atlar Dashboard by visiting the [Metadata keys\npage](https://app.atlar.com/metadata-keys). Requirement rules\ncan be specified per API resource. Both the Dashboard and the\nAPI will then enforce these rules and give validation errors\nwhen the required fields are not set.",
      "maxProperties": 20,
      "x-omitempty": true
    },
    "OrganizationID": {
      "type": "string",
      "description": "Unique resource identifier for an Organization."
    },
    "ResourceID": {
      "type": "string",
      "description": "Unique resource identifier.",
      "minLength": 32,
      "maxLength": 64
    },
    "ResourceVersion": {
      "type": "integer",
      "description": "Resource version. Starts at value `1` when the resource is\ncreated and increases by one for each successive update.",
      "minimum": 1,
      "readOnly": true
    },
    "ScaledAmount": {
      "type": "object",
      "properties": {
        "currency": {
          "$ref": "#/$defs/CurrencyCode"
        },
        "value": {
          "description": "The amount value as a scaled integer (int64). The number of\ndecimal places is given by the `decimals` field, not by the\ncurrency. E.g. value=10004 with decimals=4 represents 1.0004.",
          "type": "integer",
          "format": "int64"
        },
        "decimals": {
          "description": "The number of decimal places in `value`.",
          "type": "integer",
          "format": "int32"
        },
        "stringValue": {
          "description": "A string representation of the amount value as a decimal number.",
          "type": "string"
        }
      },
      "required": [
        "currency",
        "value",
        "decimals",
        "stringValue"
      ]
    },
    "UpdatedTimestamp": {
      "type": "string",
      "format": "date-time",
      "description": "Time at which the resource was last updated.",
      "readOnly": true
    }
  }
}