Skip to main content
Glama
Trading Calendar & Public Holidays for AI Agents

Trading Calendar & Public Holidays for AI Agents

README.md
# Trading calendar & public holidays for AI agents (MCP server + HTTP API)

Does a stock exchange trade today, when does it open, and is the 6 January a business day in Bavaria? This server answers both kinds of question for agents: **28 stock exchanges** from their official calendars, and **public holidays plus business-day math for 247 countries**.

Pay per call in USDC on Base with [x402](https://x402.org). No account, no API key, no subscription.

- MCP server (Streamable HTTP): `https://handelskalender-api.pages.dev/mcp`
- HTTP API: `https://handelskalender-api.pages.dev/v1/...`
- Docs for agents: [llms.txt](https://handelskalender-api.pages.dev/llms.txt) · [OpenAPI 3.1](https://handelskalender-api.pages.dev/openapi.json) · [x402 discovery](https://handelskalender-api.pages.dev/.well-known/x402)
- Official MCP Registry: `io.github.vstockma/handelskalender-api`

This repository holds the public documentation and a client example. The hosted service itself is proprietary.

## Tools and prices

| MCP tool | HTTP endpoint | Price | What it returns |
|---|---|---|---|
| `trading_day` | `GET /v1/trading-day?exchange=&date=` | $0.002 | Trading day or not (with holiday name), hours in local time and UTC, half days, lunch breaks, pre/after-market (Nasdaq, Xetra), live status, next open/close, previous/next trading day |
| `trading_calendar` | `GET /v1/trading-calendar?exchange=&year=` | $0.002 | Every closure, half day and late opening of one exchange for a year, regular hours, number of trading days |
| `market_status` | `GET /v1/market-status?exchanges=` | $0.002 | Right now: open, lunch break, pre-market, after-hours or closed, for up to all 28 exchanges in one call |
| `public_holidays` | `GET /v1/public-holidays?country=&year=&region=` | $0.002 | All public holidays of a country (2026–2028), regional ones with `region=`, English and local names, weekend days |
| `business_day` | `GET /v1/business-day?country=&date=&add=&to=` | $0.002 | Business day or not, previous/next business day, date plus N business days, business days between two dates |

Free: `GET /v1/exchanges` (all exchanges with coverage), `GET /v1/holiday-countries` (countries and regions).

You never pay for a mistake: bad input gets HTTP 400 **before** payment, and outages are not charged.

## Exchanges

NYSE (XNYS), Nasdaq (XNAS), Toronto (XTSE), B3 São Paulo (BVMF), London (XLON), Xetra (XETR), Vienna (XWBO), SIX Swiss (XSWX), Euronext Paris, Amsterdam, Brussels, Lisbon, Dublin, Milan and Oslo, Madrid (XMAD), Nasdaq Stockholm, Copenhagen, Helsinki and Iceland, Prague (XPRA), Tokyo (XTKS), Hong Kong (XHKG), Shanghai (XSHG), Korea (XKRX), Singapore (XSES), NSE India (XNSE), ASX (XASX).

Holidays and hours come **only from the official calendars** of each exchange. A year the exchange has not published yet returns HTTP 400 (not charged) instead of a guess. `GET /v1/exchanges` shows how far each calendar reaches.

Public holidays come from the statutory rules in the open-source library [python-holidays](https://github.com/vacanza/holidays) (MIT); every answer names that source, and moon-dependent dates are flagged as estimated.

## Try it

Without a wallet you see the price and the payment requirements (HTTP 402):

```bash
curl -i "https://handelskalender-api.pages.dev/v1/trading-day?exchange=XNYS&date=2026-11-26"
```

List the MCP tools (free):

```bash
curl -s https://handelskalender-api.pages.dev/mcp -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

Pay and get the answer with Node.js ([examples/pay.mjs](examples/pay.mjs)):

```bash
cd examples
npm install
BUYER_PRIVATE_KEY=0x... node pay.mjs "https://handelskalender-api.pages.dev/v1/market-status?exchanges=XNYS,XETR"
```

Use a separate wallet that holds only a few cents of USDC on Base. Never put your main wallet's key into a script.

### Paying through MCP

Tool calls follow the x402 MCP transport (`@x402/mcp`): a call without payment returns `isError` with the payment requirements in `structuredContent`; send the signed payment in `_meta["x402/payment"]` and the settlement comes back in `_meta["x402/payment-response"]`.

## Related

Sister server for company registers (19 countries), KYB sanctions screening and macro data: [vstockma/x402-company-data-mcp](https://github.com/vstockma/x402-company-data-mcp).

## Contact

Stockwerk Studio · stockwerkstudio@gmail.com · Missing an exchange? Open an issue.

Documentation and the example in this repository: MIT licence.