{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/atlar/json-schema/atlar-position-schema.json",
  "title": "Position",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/atlar-investments-api-openapi.yml#/components/schemas/Position",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/ResourceID",
      "readOnly": true
    },
    "holdingId": {
      "$ref": "#/$defs/ResourceID",
      "readOnly": true
    },
    "organizationId": {
      "$ref": "#/$defs/OrganizationID",
      "readOnly": true
    },
    "timestamp": {
      "description": "Timestamp of when the position was recorded. This timestamp is reported in UTC and thus the date component of this timestamp may be different than `localDate`.",
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "localDate": {
      "description": "Local date in the timezone associated with the account/bank.",
      "$ref": "#/$defs/Date",
      "readOnly": true
    },
    "maturityDate": {
      "description": "Maturity date in the timezone associated with the account/bank.",
      "$ref": "#/$defs/Date",
      "readOnly": true
    },
    "type": {
      "$ref": "#/$defs/HoldingType",
      "readOnly": true
    },
    "nav": {
      "$ref": "#/$defs/Amount",
      "description": "Net Asset Value per share"
    },
    "scaledNav": {
      "$ref": "#/$defs/ScaledAmount",
      "description": "Net Asset Value per share with full decimal precision. Unlike `nav`, this field preserves the original precision from the data source rather than rounding to currency standard decimals."
    },
    "shares": {
      "type": "number",
      "format": "double",
      "description": "Number of shares held"
    },
    "totalValue": {
      "$ref": "#/$defs/Amount",
      "description": "Total value (shares * nav)"
    },
    "yield": {
      "type": "number",
      "format": "double",
      "description": "Annualized yield of the fund"
    },
    "wam": {
      "type": "number",
      "format": "double",
      "description": "Weighted Average Maturity in days"
    },
    "wal": {
      "type": "number",
      "format": "double",
      "description": "Weighted Average Life in days"
    },
    "wla": {
      "type": "number",
      "format": "double",
      "description": "Weekly Liquid Assets (%)"
    },
    "nominal": {
      "$ref": "#/$defs/Amount",
      "description": "Bond face / principal amount",
      "readOnly": true
    },
    "fundAum": {
      "$ref": "#/$defs/Amount",
      "description": "Total assets under management of the fund",
      "readOnly": true
    },
    "rate": {
      "type": "number",
      "format": "double",
      "description": "Bond coupon rate expressed as a decimal fraction, e.g. 0.0425 for 4.25%",
      "readOnly": true
    },
    "totalPurchasePrice": {
      "$ref": "#/$defs/Amount",
      "description": "Total purchase price paid for the position",
      "readOnly": true
    },
    "version": {
      "$ref": "#/$defs/ResourceVersion",
      "readOnly": true
    },
    "etag": {
      "$ref": "#/$defs/ETag",
      "readOnly": true
    }
  },
  "required": [
    "id",
    "holdingId",
    "organizationId",
    "timestamp",
    "localDate",
    "totalValue",
    "type",
    "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"
      ]
    },
    "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
    },
    "HoldingType": {
      "type": "string",
      "description": "The type of holding.",
      "enum": [
        "MONEY_MARKET_FUND",
        "FIXED_TERM_FUND",
        "EXCHANGE_TRADED_FUND",
        "GOVERNMENT_BOND",
        "CORPORATE_BOND",
        "MUTUAL_FUND"
      ]
    },
    "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"
      ]
    }
  }
}