|
| 1 | +# ACTUS Library |
| 2 | + |
| 3 | +Algorithmic Contract Types Unified Standards ([actusfrf.org](https://www.actusfrf.org)) implementation in L4. Provides types and functions for modelling standardised financial contracts. |
| 4 | + |
| 5 | +Import with `IMPORT actus` to get all modules, or import individual modules selectively. |
| 6 | + |
| 7 | +### Location |
| 8 | + |
| 9 | +| File | Purpose | |
| 10 | +| ------------------------------------------------------------------------------------------------------ | ----------------------------------------- | |
| 11 | +| [actus.l4](https://github.com/smucclaw/l4-ide/blob/main/jl4-core/libraries/actus.l4) | Main entry point (re-exports all modules) | |
| 12 | +| [actus-core.l4](https://github.com/smucclaw/l4-ide/blob/main/jl4-core/libraries/actus-core.l4) | Core types (contract types, roles, enums) | |
| 13 | +| [actus-terms.l4](https://github.com/smucclaw/l4-ide/blob/main/jl4-core/libraries/actus-terms.l4) | Contract term definitions | |
| 14 | +| [actus-state.l4](https://github.com/smucclaw/l4-ide/blob/main/jl4-core/libraries/actus-state.l4) | Contract state variables | |
| 15 | +| [actus-events.l4](https://github.com/smucclaw/l4-ide/blob/main/jl4-core/libraries/actus-events.l4) | Event types and operations | |
| 16 | +| [actus-daycount.l4](https://github.com/smucclaw/l4-ide/blob/main/jl4-core/libraries/actus-daycount.l4) | Day count conventions and year fractions | |
| 17 | +| [actus-schedule.l4](https://github.com/smucclaw/l4-ide/blob/main/jl4-core/libraries/actus-schedule.l4) | Schedule generation | |
| 18 | + |
| 19 | +### Core Types (`actus-core`) |
| 20 | + |
| 21 | +**Contract Type Taxonomy** (~32 ACTUS contract types organised into families): |
| 22 | + |
| 23 | +- `Basic Contract Type` — PAM, LAM, NAM, ANN, CLM, CSH, STK, UMP, COM |
| 24 | +- `Exotic Basic Contract Type` — LAX, NAX, ANX |
| 25 | +- `Combined Contract Type` — SWAPS, SWPPV, OPTNS, FUTUR, FXOUT, CAPFL, BCS |
| 26 | +- `Credit Enhancement Contract Type` — CEG, CEC, MAR |
| 27 | + |
| 28 | +**Contract Role** — RPA, RPL, CLO, CNO, COL, LG, ST, BUY, SEL, RFL, PFL, RF, PF |
| 29 | + |
| 30 | +- `` `role sign` `` — sign multiplier for payoff calculations (+1 or -1) |
| 31 | + |
| 32 | +**Contract Performance** — PF (performant), DL (delayed), DQ (delinquent), DF (default), MA (matured), TE (terminated) |
| 33 | + |
| 34 | +- `` `is non-performing` ``, `` `is active` `` — performance predicates |
| 35 | + |
| 36 | +**Day Count Convention** — AA, A360, A365, `30E360`, `30E360ISDA`, BUS252 |
| 37 | + |
| 38 | +**Other Enums:** |
| 39 | + |
| 40 | +- `End of Month Convention` — EOM, SD, EOMP |
| 41 | +- `Business Day Convention` — SCR, SCRF, SCRP, SCRMF, SCRMP |
| 42 | +- `Calendar Type` — NoCalendar, MondayToFriday, Calendar |
| 43 | +- `Period Unit` — Days, Weeks, Months, Quarters, Years |
| 44 | +- `Stub Convention` — Long/Short Initial/Final |
| 45 | +- `Interest Payment Convention` — PayInterest, CapitalizeInterest |
| 46 | +- `Penalty Type` — NoPenalty, AbsolutePenalty, RelativePenalty, InterestPenalty |
| 47 | +- `Option Type` / `Option Exercise Type` — Call, Put, Straddle / European, American, Bermudan |
| 48 | +- `Scaling Effect` — NoScaling, InterestScaling, PrincipalScaling, BothScaling |
| 49 | +- `ACTUS Currency` — USD, EUR, GBP, JPY, CHF, CAD, AUD, CNY, HKD, SGD, or custom via `ACTUS Other` |
| 50 | + |
| 51 | +**Cycle** — record with `period`, `periodUnit`, `stub`; convenience constructors: `` `Monthly Cycle` ``, `` `Quarterly Cycle` ``, `` `Semi-Annual Cycle` ``, `` `Annual Cycle` `` |
| 52 | + |
| 53 | +### Contract Terms (`actus-terms`) |
| 54 | + |
| 55 | +- `ACTUS Contract Terms` — core contract parameters (ID, type, role, dates, principal, rate, day count convention) |
| 56 | +- `FXOUT Terms` — FX outright transaction parameters |
| 57 | +- `` `implied exchange rate` `` — derive rate from FX term amounts |
| 58 | + |
| 59 | +### Contract State (`actus-state`) |
| 60 | + |
| 61 | +- `Contract State` — runtime state (statusDate, contractPerformance, notionalPrincipal, accruedInterest, nominalInterestRate, feeAccrued) |
| 62 | +- `` `is fully paid` ``, `` `is in default` ``, `` `outstanding balance` `` — state predicates |
| 63 | +- `` `empty state` `` — default initial state |
| 64 | + |
| 65 | +### Contract Events (`actus-events`) |
| 66 | + |
| 67 | +**Event Types:** IED, PR, PP, MD, IP, IPCI, RR, RRF, FP, PY, TD, XD, STD, DV, CE, AD |
| 68 | + |
| 69 | +- `Contract Event` — record with eventType, eventDate, payoff, currency, notionalPrincipal, nominalInterestRate, accruedInterest |
| 70 | +- `` `make event` `` — event constructor |
| 71 | +- `` `event sequence` ``, `` `event name` ``, `` `event acronym` `` — event metadata |
| 72 | +- `` `is principal event` ``, `` `is interest event` ``, `` `has cash flow` `` — event predicates |
| 73 | +- `` `total payoff` `` — sum payoffs across a list of events |
| 74 | + |
| 75 | +### Day Count Conventions (`actus-daycount`) |
| 76 | + |
| 77 | +- `` `year fraction` `` — Y(S,E) calculation dispatching on convention |
| 78 | +- `` `year fraction A365` ``, `` `year fraction A360` `` — specific convention implementations |
| 79 | +- `` `days between` `` — raw day count between two dates |
| 80 | +- `` `accrued interest for period` `` — interest accrual given principal, rate, dates, and convention |
| 81 | + |
| 82 | +### Schedule Generation (`actus-schedule`) |
| 83 | + |
| 84 | +- `` `add months` ``, `` `add days` `` — date arithmetic with month-end clamping |
| 85 | +- `` `monthly schedule` `` — generate a list of monthly dates from a start date |
| 86 | +- `` `schedule length` `` — count dates in a schedule |
| 87 | + |
| 88 | +### Evaluation Engine (`actus`) |
| 89 | + |
| 90 | +**Payoff Functions (POF):** |
| 91 | + |
| 92 | +- `` `POF_IED` `` — Initial Exchange Date payoff |
| 93 | +- `` `POF_IP` `` — Interest Payment payoff |
| 94 | +- `` `POF_MD` `` — Maturity payoff |
| 95 | +- `` `POF_PR` `` — Principal Redemption payoff |
| 96 | + |
| 97 | +**State Transition Functions (STF):** |
| 98 | + |
| 99 | +- `` `STF_IED` `` — initialise state after initial exchange |
| 100 | +- `` `STF_IP` `` — reset accrued interest after payment |
| 101 | +- `` `STF_MD` `` — contract reaches maturity |
| 102 | +- `` `STF_PR` `` — reduce notional by redemption amount |
| 103 | + |
| 104 | +**Interest Accrual:** |
| 105 | + |
| 106 | +- `` `accrue interest to` `` — accrue interest from current state date to a target date |
| 107 | + |
| 108 | +**FX Transaction (FXOUT):** |
| 109 | + |
| 110 | +- `` `FXOUT pay event` ``, `` `FXOUT receive event` `` — generate FX cash flow events |
| 111 | + |
| 112 | +**Cash Flow Projection:** |
| 113 | + |
| 114 | +- `` `net cash flow` `` — sum all cash flows from a list of events |
| 115 | + |
| 116 | +**See the [actus.l4](https://github.com/smucclaw/l4-ide/blob/main/jl4-core/libraries/actus.l4) source and sub-modules for full details.** |
0 commit comments