# Business-Day Oracle (`thenightowl/business-day-oracle`) Actor

Is it a working day? Add or count business days, roll dates by ISDA conventions, compute deadlines with an explanation trail. 250 countries, 35 with state calendars, 30 financial markets, legal weekends per country. MCP server + REST for AI agents. Flags projected lunar holidays, cites sources.

- **URL**: https://apify.com/thenightowl/business-day-oracle.md
- **Developed by:** [Mohamad Najia](https://apify.com/thenightowl) (community)
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 lookup tool calls

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Business-Day Oracle — working days, deadlines and business-day conventions for 250 countries

**MCP server + REST API.** The date arithmetic every agent gets wrong once it leaves its home country: which days are the
weekend (Fri–Sat in Saudi Arabia and Kuwait, Sun-only in parts of Asia, Sat–Sun in the UAE since 2022), which holidays
apply in *this* state or province, what "within 10 business days" lands on, and how a payment date rolls under ISDA
*modified following*. 250 countries, 35 with sub-national calendars (US states, German Länder, Canadian provinces,
Indian states, Australian states, UAE emirates…), 30 financial-market calendars (NYSE, LSE, Xetra, HKEX, JPX, Tadawul…).

Every answer states **data_confidence**, lists **estimated_items** (lunar / moon-sighted holidays are projections until
officially announced — the response says so per date), cites **sources** for the calendar used, and `compute_deadline`
returns a step-by-step **explanation** plus a disclaimer. Deterministic code; no AI inside; no query logging.

### Tools (8)

| tool | use when | price |
|---|---|---|
| `is_working_day` | one date → working day? why not (weekend / holiday name / observed / projected) | $0.002 |
| `add_working_days` | "N business days from…" — delivery promises, SLA clocks, payment terms; lists every skipped day | $0.008 |
| `working_days_between` | count working days with endpoint control; leave cost, lateness | $0.008 |
| `roll_date` | following / modified following / preceding / modified preceding on a country or market calendar | $0.008 |
| `compute_deadline` | "within 30 days / 10 working days / 3 months" with explicit counting rules and an explanation trail | $0.008 |
| `list_holidays` | a year's holidays, local + English names, observed/projected flags | $0.002 |
| `next_holiday` | next N holidays with days_until | $0.002 |
| `list_calendars` | country/market codes, legal weekend, subdivision codes, categories, languages, sources | free |

Each calendar can be refined with `subdivision`, `categories` (public, bank, government, school…), a `weekend` override
and `extra_holidays` (company closures), and `include_estimated_holidays=false` ignores projected dates until announced.

### Example

```json
// compute_deadline {"start_date": "2026-01-31", "period": 1, "unit": "months", "country": "KW"}
{
  "result": {
    "raw_deadline": "2026-02-28", "deadline": "2026-03-01", "deadline_weekday": "Sun",
    "rules": {"exclude_start_day": true, "convention": "following", "month_end_clamp": true, "include_estimated_holidays": true},
    "explanation": [
      "Start date 2026-01-31 (Sat), calendar KW.",
      "Added 1 month(s) → 2026-02-28 (Sat) (clamped to month end).",
      "2026-02-28 is weekend; rolled forward to 2026-03-01 (Sun)."
    ],
    "calendar": "KW", "weekend": ["FRI", "SAT"]
  },
  "data_confidence": "high",
  "sources": ["https://github.com/vacanza/holidays", "..."],
  "disclaimer": "Date arithmetic over public holiday calendars; not legal, tax or financial advice. ..."
}
```

### Confidence, honestly

- **high** — fixed-date and rule-based holidays, weekends from the country's law.
- **medium** — the answer touched a lunar/moon-sighted holiday that is still a projection (named in `estimated_items`), or the caller overrode the weekend.
- Holiday data is compiled from public sources by [python-holidays](https://github.com/vacanza/holidays) (version pinned and reported in `data_version`); it can lag official announcements. For UAE sector/emirate rules with official confirmation status, use the companion **UAE Calendar Oracle**.

### Connect

- **Apify (metered):** Standby URL + `/mcp`, header `Authorization: Bearer <your Apify token>`.
- **Self-hosted:** `claude mcp add bizday --transport http https://bizday.noahsarch.tech/mcp --header "X-API-Key: <key>"` — one Noah's Arch key works across all our agents.
- **REST:** `POST https://bizday.noahsarch.tech/v1/tools/<tool>`; OpenAPI at `/openapi.json`, docs at `/docs`.

### Not legal, tax or financial advice

Counting conventions differ by jurisdiction and contract; pass the rules that apply and verify deadlines that carry legal weight.

***

### بالعربية

**عرّاف أيام العمل** — خادم MCP وواجهة REST لحساب أيام العمل والمواعيد النهائية وأعراف أيام العمل المصرفية في 250 دولة
(35 منها بتقاويم على مستوى الولايات/الإمارات) و30 سوقاً مالياً. يعرف عطلة نهاية الأسبوع القانونية لكل دولة (الجمعة–السبت في السعودية
والكويت، السبت–الأحد في الإمارات)، ويميّز العطلات القمرية التقديرية عن المؤكدة، ويعيد في كل إجابة مستوى الثقة والمصادر ومسار
تفسير خطوة بخطوة. لا ذكاء اصطناعي داخلها ولا تسجيل للاستعلامات. حساب تواريخ وليس استشارة قانونية أو ضريبية أو مالية.

# Changelog

This Actor's version history is a separate document: https://apify.com/thenightowl/business-day-oracle/changelog.md

# Actor input Schema

## Actor input object example

```json
{}
```

# Actor output Schema

## `mcpEndpoint` (type: `string`):

Point your MCP client here (Authorization: Bearer <Apify token>). 8 tools: is_working_day, add_working_days, working_days_between, roll_date, compute_deadline, list_holidays, next_holiday, list_calendars.

## `readiness` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("thenightowl/business-day-oracle").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("thenightowl/business-day-oracle").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call thenightowl/business-day-oracle --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,thenightowl/business-day-oracle"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/tAPfiJeViE7qoX8CE/builds/Sw4K7fLXfefnXOAgF/openapi.json
