DAP Foundry dap.solutions
compute-day-count-to-settlement · page and endpoint · v1

Compute day count to settlement

Give a trade date, a settlement lag and an ISDA day count convention. Get the settlement date on the Payments Canada calendar and the exact fraction. On this page it runs in this tab, and your inputs stay in it.

Input

One JSON object with seven named inputs, each given once, up to 4,096 bytes. It is the same body the endpoint takes.

inputwhat it is
accrual_startThe first day of the accrual period, written YYYY-MM-DD, such as 2026-07-01. Any year, on or before settlement.
trade_dateA business day on the calendar, written YYYY-MM-DD, such as 2026-10-09.
settlement_lagBusiness days from trade to settlement, 0 to 5, as a string or a whole number.
calendarca-payments-canada, the one calendar this tool has.
conventionACT/360, ACT/365F, 30/360, 30E/360 or ACT/ACT-ISDA.
acknowledgeno-ruling-v1, exactly. This tool calculates. It does not issue rulings.
freshness_toleranceHow old the holiday calendar may be, in whole days written like P7D, no more than P90D.

Output

An envelope in JSON with these fields, in this order: tool, artifact_hash, status, refusal, result, inputs, provenance, ratified_ceiling, declared_tolerance, acknowledgment, disclaimer, attestation_badge, retention.

A computed call gives the settlement date, the day count, and the fraction in lowest terms with a decimal to 10 places, rounded half to even. A refused call gives a code and a message, and nothing was computed. artifact_hash names the artifact that answered, and provenance states the calendar and its age in whole days, or null when the clock reads earlier than the time the calendar was collected.

Settlement

Start at trade_date and move forward one business day at a time, settlement_lag times. A business day is a weekday that is not a system closure day on the calendar. A lag of 0 settles on the trade date.

Conventions

ISDA 2006 Definitions, Section 4.16. The period includes accrual_start and excludes the settlement date. A is the actual number of days between them.

The calendar

Payments Canada system closure schedule, from https://www.payments.ca/system-closure-schedule, collected at 2026-09-23T04:51:02Z. It covers 2026 only, because the source publishes the current year only. Saturdays, Sundays and the 10 closure days it lists are not business days. A trade date or settlement date outside 2026 is refused, never guessed. accrual_start may be any real date on or before settlement, in any year: no day count convention reads the calendar.

The calendar is bound into this artifact. Refreshing it is a new artifact and a new Clear by a person, never an update in place. Every answer states the calendar's age: whole days from the time it was collected to the clock this tool reads, or null when that clock reads earlier than that time. On this page that is this device's clock, so a wrong clock gives a wrong age and a wrong staleness check. The endpoint uses the server's clock. A call made while the clock reads earlier than the collection time computes nothing. The ceiling a person set for this tool is P90D. From 2026-12-23T04:51:02Z the calendar is 91 days old, so no call computes: one that passes the checks before the staleness check is refused as INPUT_STALE, until the calendar is collected again and a person Clears the new artifact.

Refusals

The checks run in a fixed order, listed in /hub.md, and the first that fails is the answer. On this page every refusal shows its code (listed in the table below), the field and rule it concerns, the message, and a valid example. The endpoint returns the code and a message that says what failed and, where a different request could succeed, what to send.

codewhen
INPUT_INVALIDThe request cannot be read or is over 4,096 bytes, an input is unknown, repeated, missing or not valid, the trade date is not a business day, or the accrual starts after settlement.
ACK_MISSINGacknowledge is not no-ruling-v1.
TOLERANCE_MISSINGfreshness_tolerance is absent, null or empty.
TOLERANCE_INVALIDfreshness_tolerance is not whole days written like P7D.
TOLERANCE_OVER_CEILINGThe tolerance is above the ceiling a person set for this tool, or no ceiling is set yet.
CLOCK_BEHINDThe clock this tool read is earlier than the time the calendar was collected, even by 1 millisecond, so its age cannot be known.
INPUT_STALEThe calendar is older than the declared tolerance.
OUT_OF_COVERAGEThe trade date, the settlement date, or a business day walked between them falls outside the years the calendar covers. accrual_start is never refused for coverage.

The endpoint

The same core answers at https://foundry.dap.solutions/api/compute-day-count-to-settlement, by GET with query parameters or by POST with this JSON body: 200 when computed, 422 when refused. Prefer POST, because GET puts your inputs in the URL, where proxies and logs outside this tool may record them. A POST keeps them in the body. The description for agents is at /hub.md, and the hub is at /hub/.

Your inputs are not stored

On this page your inputs stay in this browser. The endpoint reads each request in memory and keeps no copy of your inputs. This tool sets no cookie and uses no browser storage.