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-groupNo constraint is applied. The limit only serves as a grouping node, for grouping other limits. The payload is
{ "type": "limit-group" }, withoutvalues.proportionalThe limit is defined as a share of the value matched by its parent limit, or of all the client's holdings when
parentLimitis not set. Shares are fractional values, e.g.0.10= 10%.absoluteThe limit is a fixed amount in the specified
ccyCodeand represents the total aggregated value of all holdings matched by the filter that must stay within this threshold.
Proportional limit payload
{
"type": "proportional",
"values": {
"min": 0.5,
"max": 1.0
}
}
minnumberMinimum relative share, as a fraction. Required;
nullmeans no minimum.maxnumberMaximum relative share, as a fraction. Required;
nullmeans no maximum.
Absolute limit payload
{
"type": "absolute",
"values": {
"min": 100000,
"max": null
}
}
minnumberMinimum absolute value, in
ccyCode. Required;nullmeans no minimum.maxnumberMaximum absolute value, in
ccyCode. Required;nullmeans 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.
typestringRequiredThe type of logical filter, either
andoror.filtersarrayRequiredAn array of filters to be combined.
condition filter
Used to define a specific matching rule.
typestringRequiredMust be
condition.conditionobjectRequiredA 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.
typestringRequiredThe type of
conditionto apply.value fieldobjectRequiredA field whose name depends on the
type.
The possible limit condition types and their corresponding value fields (all required) are:
| Condition type | Value field |
|---|---|
country-code-is / country-code-is-not | country-code (string): ISO 3166-1 alpha-2 code. |
instrument-class-is / instrument-class-is-not | instrument-class-id (string): instrument class identifier. |
detailed-instrument-class-is / detailed-instrument-class-is-not | detailed-instrument-class-id (string): detailed instrument class identifier. |
currency-code-is / currency-code-is-not | currency-code (string): ISO 4217 code for the currency. |
security-identifier-is / security-identifier-is-not | security-identifier (string): the security identifier. |
reporting-entity-is / reporting-entity-is-not | reporting-entity-id (string): the reporting entity identifier. |
reporting-portfolio-is / reporting-portfolio-is-not | reporting-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:
{
"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.
namestringHuman-readable name of the limit.
ccyCodestringISO 4217 code for the currency used to express this limit.
startDatestringStart date of the limit, formatted
YYYY-MM-DD.limitFilterobjectThe filter that defines which holdings the limit applies to. See Limit filter.
limitTypeobjectThe type and definition of the limit. See Limit type.
Relationships:
clientstringIdentifier for the client that owns the limit.
parentLimitstringOptional. Identifier of an existing parent limit, if any. Omitted when the limit has no parent.
Limit status
datestringDate of the limit status, formatted
YYYY-MM-DD.limitTypeobjectThe type and definition of the limit. See Limit type.
isBreachedbooleanIndicates whether the limit has been breached. A limit has been breached if the
currentValueis below theminvalue, or above themaxvalue, set in thelimitType.currentValuenumberThe 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 be0.
- For
Retrieve a limit
Fetch a single limit.
curl https://api.aleta.ai/api/v2/limits/11a251b1-777a-452f-a4c6-088fdc2d2e52 \
-H "Accept: application/vnd.api+json" \
-H "Authorization: Bearer {access_token}"
{
"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"
}
}
}
}
}
Create a limit
Create a new limit. Returns 200 OK with the created limit.
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"
}
}
}
}
}'
{
"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"
}
}
}
}
}
List limits
Fetch all limits owned by the client given by clientId.
curl https://api.aleta.ai/api/v2/clients/679c73d1722c1995a0414b10/limits \
-H "Accept: application/vnd.api+json" \
-H "Authorization: Bearer {access_token}"
{
"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 a limit
Delete a limit by its ID. Returns 204 No Content.
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}"
Status of a single limit
Fetch the status for a single limit.
Query parameters
datestringRequiredDate to fetch the status for, formatted
YYYY-MM-DD. A missing or malformed date is a400.
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}"
{
"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
}
}
}
Status of every limit
Fetch the status of every limit owned by the client given by clientId.
Query parameters
datestringRequiredDate to fetch the status for, formatted
YYYY-MM-DD. A missing or malformed date is a400.
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}"
{
"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
}
}
]
}