Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Avhz RustQuant Business Calendar

From Leeroopedia


Knowledge Sources
Domains Financial_Infrastructure, Time_Management
Last Updated 2026-02-07 21:00 GMT

Overview

Business calendars define holiday schedules and weekend conventions for financial markets across different countries, enabling correct determination of business days for settlement, coupon payments, and contract expiration.

Description

Business calendars are essential infrastructure in financial systems. A date that falls on a weekend or public holiday cannot be used as a settlement or payment date, so financial instruments must adjust their schedules according to the applicable market calendar.

In RustQuant, the Calendar struct encapsulates a Market enum (identifying the country or exchange) and an optional set of extra custom holidays. The Market enum supports over 25 countries including Argentina, Australia, Brazil, Canada, China, France, Germany, Hong Kong, India, Indonesia, Israel, Italy, Japan, Mexico, Singapore, the United Kingdom, the United States, and more.

Each country calendar implements a holiday detection function that checks against statutory holidays, religious observances, and market-specific closures. For example, the India calendar recognizes Republic Day, Mahashivratri, Holi, Good Friday, Eid-ul-Fitar, Rama Navami, Diwali, and other holidays with date tables spanning 2000-2029. The Indonesia calendar covers New Year, Lunar New Year, Hindu New Year, Eid-ul-Fitar, Vesak Day, Pancasila Day, Independence Day, and more.

Weekend definitions vary by market: most use Saturday-Sunday, while Israel uses Friday-Saturday.

Key capabilities include:

  • Checking whether a date is a business day (is_business_day)
  • Rolling dates forward or backward to valid business days (roll_date)
  • Counting calendar days and business days between two dates
  • Computing day count factors using various conventions
  • Generating schedules from dates with rolling and day counting conventions

Usage

Use business calendars whenever computing settlement dates, generating coupon schedules, counting business days for accrual calculations, or adjusting payment dates that fall on holidays. The calendar is a prerequisite for schedule generation, date rolling, and day count factor computation.

Theoretical Basis

Business day determination follows a simple rule: a date is a business day if and only if it is neither a weekend day nor a recognized holiday for the given market.

Date rolling adjusts non-business dates to the nearest valid date using conventions such as Following, Modified Following, Preceding, and Modified Preceding. The choice of convention can affect accrued interest calculations and payment timing.

The number of business days between two dates is computed by iterating through each calendar day and counting only those that pass the is_business_day check. This count is used in certain day count conventions and in computing settlement periods (e.g., T+2).

Utility functions support Easter Monday computation (for both Western and Orthodox calendars), first/last weekday of month detection, leap year handling, and date sequence generation.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment