View as Markdown

Limits

Fetch, create and delete limits, and fetch the status of limits.

Data model

Limit type

The limitType field describes how a limit is calculated. It is one of:

limit-group

No constraint is applied. The limit only serves as a grouping node, for grouping other limits. The payload is { "type": "limit-group" }, without values.

proportional

The limit is defined as a share of the value matched by its parent limit, or of all the client's holdings when parentLimit is not set. Shares are fractional values, e.g. 0.10 = 10%.

absolute

The limit is a fixed amount in the specified ccyCode and represents the total aggregated value of all holdings matched by the filter that must stay within this threshold.

Proportional limit payload

JSON
{
  "type": "proportional",
  "values": {
    "min": 0.5,
    "max": 1.0
  }
}
minnumber

Minimum relative share, as a fraction. Required; null means no minimum.

maxnumber

Maximum relative share, as a fraction. Required; null means no maximum.

Absolute limit payload

JSON
{
  "type": "absolute",
  "values": {
    "min": 100000,
    "max": null
  }
}
minnumber

Minimum absolute value, in ccyCode. Required; null means no minimum.

maxnumber

Maximum absolute value, in ccyCode. Required; null means no maximum.

Limit filter

A limit filter defines the scope of holdings to which a limit applies. The structure is recursive, allowing for nested and complex filtering logic.

There are two main types of filters:

  • Logical filters (and, or): these filters combine other filters.
  • Condition filter (condition): this filter applies a specific condition.

A limit filter is an object with one of the following structures.

and / or filters

Used for logical grouping of other filters.

typestringRequired

The type of logical filter, either and or or.

filtersarrayRequired

An array of filters to be combined.

condition filter

Used to define a specific matching rule.

typestringRequired

Must be condition.

conditionobjectRequired

A single condition. Takes a limit condition as argument.

Limit condition

A limit condition is an object that specifies a single rule. It must contain a type field and a corresponding value field.

typestringRequired

The type of condition to apply.

value fieldobjectRequired

A field whose name depends on the type.

The possible limit condition types and their corresponding value fields (all required) are:

Condition typeValue field
country-code-is / country-code-is-notcountry-code (string): ISO 3166-1 alpha-2 code.
instrument-class-is / instrument-class-is-notinstrument-class-id (string): instrument class identifier.
detailed-instrument-class-is / detailed-instrument-class-is-notdetailed-instrument-class-id (string): detailed instrument class identifier.
currency-code-is / currency-code-is-notcurrency-code (string): ISO 4217 code for the currency.
security-identifier-is / security-identifier-is-notsecurity-identifier (string): the security identifier.
reporting-entity-is / reporting-entity-is-notreporting-entity-id (string): the reporting entity identifier.
reporting-portfolio-is / reporting-portfolio-is-notreporting-portfolio-id (string): the reporting portfolio identifier.

Existing limits may also contain portfolio-is / portfolio-is-not conditions with a portfolio-id value field. These are returned when reading limits, but a new limit that uses them is rejected with 400.

Example:

JSON
{
  "type": "or",
  "filters": [
    {
      "type": "condition",
      "condition": {
        "type": "country-code-is",
        "country-code": "DK"
      }
    },
    {
      "type": "condition",
      "condition": {
        "type": "currency-code-is",
        "currency-code": "DKK"
      }
    }
  ]
}

Limit

The representation of a limit.

namestring

Human-readable name of the limit.

ccyCodestring

ISO 4217 code for the currency used to express this limit.

startDatestring

Start date of the limit, formatted YYYY-MM-DD.

limitFilterobject

The filter that defines which holdings the limit applies to. See Limit filter.

limitTypeobject

The type and definition of the limit. See Limit type.

Relationships:

clientstring

Identifier for the client that owns the limit.

parentLimitstring

Optional. Identifier of an existing parent limit, if any. Omitted when the limit has no parent.

Limit status

datestring

Date of the limit status, formatted YYYY-MM-DD.

limitTypeobject

The type and definition of the limit. See Limit type.

isBreachedboolean

Indicates whether the limit has been breached. A limit has been breached if the currentValue is below the min value, or above the max value, set in the limitType.

currentValuenumber

The current value of the limit. This value will change depending on the limitType:

  • For proportional, the value will be the value of the holdings subject to the limit as a fraction of the value matched by the parent limit (or of all the client's holdings when there is no parent limit).
  • For absolute, the value will be the absolute amount (number) of holdings that are subject to the limit.
  • For limit-group, the value will be 0.

GET/api/v2/limits/{limitId}

Retrieve a limit

Fetch a single limit.

Request
GET/api/v2/limits/{limitId}
curl https://api.aleta.ai/api/v2/limits/11a251b1-777a-452f-a4c6-088fdc2d2e52 \
  -H "Accept: application/vnd.api+json" \
  -H "Authorization: Bearer {access_token}"
Response: 200 OK
{
  "data": {
    "id": "11a251b1-777a-452f-a4c6-088fdc2d2e52",
    "type": "limit",
    "attributes": {
      "name": "Equity DK limit",
      "ccyCode": "DKK",
      "startDate": "2025-01-01",
      "limitFilter": {
        "type": "and",
        "filters": [
          {
            "type": "condition",
            "condition": {
              "type": "country-code-is",
              "country-code": "DK"
            }
          },
          {
            "type": "condition",
            "condition": {
              "type": "currency-code-is",
              "currency-code": "DKK"
            }
          }
        ]
      },
      "limitType": {
        "type": "absolute",
        "values": {
          "min": 100000,
          "max": null
        }
      }
    },
    "relationships": {
      "client": {
        "data": {
          "type": "client",
          "id": "679c73d1722c1995a0414b10"
        }
      },
      "parentLimit": {
        "data": {
          "type": "limit",
          "id": "f1c1b67d-f67a-4ab0-9554-1fb329adaa30"
        }
      }
    }
  }
}

POST/api/v2/limits

Create a limit

Create a new limit. Returns 200 OK with the created limit.

Request
POST/api/v2/limits
curl -X POST https://api.aleta.ai/api/v2/limits \
  -H "Accept: application/vnd.api+json" \
  -H "Content-Type: application/vnd.api+json" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "data": {
      "type": "limit",
      "attributes": {
        "name": "Equity DK limit",
        "ccyCode": "DKK",
        "startDate": "2025-01-01",
        "limitFilter": {
          "type": "and",
          "filters": [
            {
              "type": "condition",
              "condition": {
                "type": "country-code-is",
                "country-code": "DK"
              }
            },
            {
              "type": "condition",
              "condition": {
                "type": "currency-code-is",
                "currency-code": "DKK"
              }
            }
          ]
        },
        "limitType": {
          "type": "absolute",
          "values": {
            "min": 100000,
            "max": null
          }
        }
      },
      "relationships": {
        "client": {
          "data": {
            "type": "client",
            "id": "679c73d1722c1995a0414b10"
          }
        },
        "parentLimit": {
          "data": {
            "type": "limit",
            "id": "f1c1b67d-f67a-4ab0-9554-1fb329adaa30"
          }
        }
      }
    }
  }'
Response: 200 OK
{
  "data": {
    "id": "11a251b1-777a-452f-a4c6-088fdc2d2e52",
    "type": "limit",
    "attributes": {
      "name": "Equity DK limit",
      "ccyCode": "DKK",
      "startDate": "2025-01-01",
      "limitFilter": {
        "type": "and",
        "filters": [
          {
            "type": "condition",
            "condition": {
              "type": "country-code-is",
              "country-code": "DK"
            }
          },
          {
            "type": "condition",
            "condition": {
              "type": "currency-code-is",
              "currency-code": "DKK"
            }
          }
        ]
      },
      "limitType": {
        "type": "absolute",
        "values": {
          "min": 100000,
          "max": null
        }
      }
    },
    "relationships": {
      "client": {
        "data": {
          "type": "client",
          "id": "679c73d1722c1995a0414b10"
        }
      },
      "parentLimit": {
        "data": {
          "type": "limit",
          "id": "f1c1b67d-f67a-4ab0-9554-1fb329adaa30"
        }
      }
    }
  }
}

GET/api/v2/clients/{clientId}/limits

List limits

Fetch all limits owned by the client given by clientId.

Request
GET/api/v2/clients/{clientId}/limits
curl https://api.aleta.ai/api/v2/clients/679c73d1722c1995a0414b10/limits \
  -H "Accept: application/vnd.api+json" \
  -H "Authorization: Bearer {access_token}"
Response: 200 OK
{
  "data": [
    {
      "id": "11a251b1-777a-452f-a4c6-088fdc2d2e52",
      "type": "limit",
      "attributes": {
        "name": "Equity DK limit",
        "ccyCode": "DKK",
        "startDate": "2025-01-01",
        "limitFilter": {
          "type": "and",
          "filters": [
            {
              "type": "condition",
              "condition": {
                "type": "country-code-is",
                "country-code": "DK"
              }
            },
            {
              "type": "condition",
              "condition": {
                "type": "currency-code-is",
                "currency-code": "DKK"
              }
            }
          ]
        },
        "limitType": {
          "type": "absolute",
          "values": {
            "min": 100000,
            "max": null
          }
        }
      },
      "relationships": {
        "client": {
          "data": {
            "type": "client",
            "id": "679c73d1722c1995a0414b10"
          }
        },
        "parentLimit": {
          "data": {
            "type": "limit",
            "id": "f1c1b67d-f67a-4ab0-9554-1fb329adaa30"
          }
        }
      }
    }
  ]
}

DELETE/api/v2/limits/{limitId}

Delete a limit

Delete a limit by its ID. Returns 204 No Content.

Request
DELETE/api/v2/limits/{limitId}
curl -X DELETE https://api.aleta.ai/api/v2/limits/11a251b1-777a-452f-a4c6-088fdc2d2e52 \
  -H "Accept: application/vnd.api+json" \
  -H "Authorization: Bearer {access_token}"

GET/api/v2/limits/{limitId}/status

Status of a single limit

Fetch the status for a single limit.

Query parameters

datestringRequired

Date to fetch the status for, formatted YYYY-MM-DD. A missing or malformed date is a 400.

Request
GET/api/v2/limits/{limitId}/status
curl "https://api.aleta.ai/api/v2/limits/11a251b1-777a-452f-a4c6-088fdc2d2e52/status?date=2025-01-01" \
  -H "Accept: application/vnd.api+json" \
  -H "Authorization: Bearer {access_token}"
Response: 200 OK
{
  "data": {
    "id": "11a251b1-777a-452f-a4c6-088fdc2d2e52",
    "type": "limit-status",
    "attributes": {
      "date": "2025-01-01",
      "limitType": {
        "type": "absolute",
        "values": {
          "min": 100000,
          "max": null
        }
      },
      "isBreached": true,
      "currentValue": 10.0
    }
  }
}

GET/api/v2/clients/{clientId}/limits-status

Status of every limit

Fetch the status of every limit owned by the client given by clientId.

Query parameters

datestringRequired

Date to fetch the status for, formatted YYYY-MM-DD. A missing or malformed date is a 400.

Request
GET/api/v2/clients/{clientId}/limits-status
curl "https://api.aleta.ai/api/v2/clients/679c73d1722c1995a0414b10/limits-status?date=2025-01-01" \
  -H "Accept: application/vnd.api+json" \
  -H "Authorization: Bearer {access_token}"
Response: 200 OK
{
  "data": [
    {
      "id": "11a251b1-777a-452f-a4c6-088fdc2d2e52",
      "type": "limit-status",
      "attributes": {
        "date": "2025-01-01",
        "limitType": {
          "type": "absolute",
          "values": {
            "min": 100000,
            "max": null
          }
        },
        "isBreached": true,
        "currentValue": 10.0
      }
    }
  ]
}