Skip to main content

Crate sabiquant

Crate sabiquant 

Source
Expand description

§SabiQuant

An independent quantitative finance library written natively in Rust, using only the standard library.

Status: foundations, numerics, schedules and cash-flow analytics under local validation. This unreleased development version contains shared errors, checked dates and tenors, immutable calendars, Western Easter, guarded TARGET coverage and ten day-count conventions, explicit interest rates and compounding, checked numerical solvers, interpolation, normal functions and summation, and anchored Forward/Backward/Zero schedules with explicit coupon dates, adjustment and checked ICMA reference contexts, four explicit civil month rolls with requested/resolved provenance, plus simple cash flows, plain fixed coupons, bounded legs, flat NPV and outstanding accrued amounts. Modern CDS date operations provide explicit quoted-maturity regimes and Following payment/accrual plans with separate raw, payment and accrual roles; the automatic local OldCDS rule builds twentieth schedules on quarterly anchors with explicit provenance. US 30/360 requires explicit security EOM qualification; AFB follows ISDA’s published backward-year clarification. Exact decimal amounts supply explicit arbitrary quanta, seven rounding modes and checked cancellation-safe/fused arithmetic, with four explicitly interpreted binary64 conversions. Zero-coupon and fixed-rate bond core definitions provide explicit settlement/ex-coupon entitlement, earned-minus-detached accrued interest, exact binary64 per-100 quote conversion, and two-stage direct-horizon pricing plans. Explicit settlement recipes retain supplied decimal/binary or declared interval evidence through source and cash rounding, with complete instruction/receipt provenance. Bounded yield inversion, duration/convexity and named market yield conventions remain later work. CDS premium-leg pricing, legal protection and settlement remain later work (roadmap).

§Principles

  • Correctness first. Every financial computation follows a written specification with cited sources (requirements).
  • Standard library only. The crate has no dependencies of any kind.
  • Explicit state. There is no global configuration, no implicit “today”, and no I/O: results depend only on the arguments.
  • No panics on input. Every operation that can fail returns a typed error; see error.
  • Values, not objects. Public types are immutable and can be sent and shared between threads.

§Modules

ModuleContents
amountsExact decimals, explicit arbitrary quanta, seven rounding modes and explicit binary64 conversions
bondsZero-coupon and fixed-rate bond terms, settlement/ex-coupon entitlement, accrued adjustment, per-100 quotes and prepared direct-horizon pricing
errorThe crate-level Error and the error types that every domain shares
mathBracketed solvers, explicit interpolation, normal probabilities and checked reductions
timeGregorian dates, months, weekdays, tenors and periodic frequencies
cashflowsPlain signed analytical coupons/legs, explicit inclusion, bounded flat NPV and outstanding accrual
calendarImmutable calendars, guarded TARGET coverage and Western Easter
daycountSource-verified scalar and contextual day counts and accrual fractions
ratesExplicit quotes, five compounding methods, factors, conversions and present values
scheduleAnchored schedules, explicit coupon roles, civil month rolls, automatic OldCDS, checked ICMA references, explicit modern CDS maturities and Following coupon-date plans
settlementFour explicit exact settlement recipes, declared enclosure decisions, source/cash rounding and retained evidence/provenance

§Relationship to QuantLib

SabiQuant uses QuantLib 1.43 as an external behavioral and numerical reference. It is not a port of QuantLib, not a binding to it, and contains no QuantLib code. SabiQuant is not affiliated with or endorsed by the QuantLib project.

Modules§

amounts
Exact decimal values and explicit quantum rounding (FR-AMT-01–14).
bonds
Immutable zero-coupon and fixed-rate bond definitions, explicit settlement and ex-coupon entitlement, earned-minus-detached accrued interest, exact binary64 per-100 quote conversion, and two-stage direct-horizon pricing plans.
calendar
Immutable calendars and checked business-day operations.
cashflows
Immutable analytical cash flows, plain fixed coupons and flat-rate valuation.
daycount
Source-verified core day-count conventions and year fractions.
error
The crate-level error, and the error types that every domain shares.
math
Numerical algorithms with explicit inputs and checked results.
rates
Explicit interest-rate quotes, stable compounding and rate-based discounting.
schedule
Explicit contractual schedules with separate business-day adjustment.
settlement
Explicit exact monetary recipes and conditional interval consequences.
time
Exact dates, tenors and periodic frequencies (milestone M2).