TRIGGER - trading calendar, market sessions, early close, lunch break, holidays.US, exchange_calendars, pandas_market_calendars, DateOutOfBounds, resample has empty bars, aligning Tokyo to New York, 交易日历, 休市. Pin session bounds, compare venue calendars, and aggregate against explicit sessions. SKIP for vendor choice and price adjustments (market-data-sourcing), stale closes and bad OHLC (data-quality-validation), corporate events (corporate-actions-processing), storage and as-of joins (market-data-engineering), and settlement or lot-size rules (asia-pacific-markets).
Ships in fin-market-data. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Use an explicit date window and a versioned calendar. Keep session labels separate from observation timestamps. An overnight session's date need not be its opening civil date.
✅ Source-verified 2026-09-14: installed exchange_calendars 4.13.2,
exchange_calendars/exchange_calendar.py, lines 59 and 62, derives default bounds from
pd.Timestamp.now() at import, minus 20 years and plus 1 year. Calendar-specific bounds
can narrow this range. Supply start= and end= and record the package version.
✅ Measured 2026-09-14 by calendars.py, with the library installed:
| Simulated import date | Default XNYS first session | Last session | Sessions |
|---|---|---|---|
| 2026-06-15 | 2006-06-15 | 2027-06-15 | 5282 |
| 2026-06-16 | 2006-06-16 | 2027-06-16 | 5282 |
The second index loses 2006-06-15 and gains 2027-06-16: symmetric difference 2. The test runs imports in child processes so it does not modify a live application's pandas clock. Without the library, the demo labels its weekday-only fallback; it is not an exchange calendar.
import exchange_calendars as xc
cal = xc.get_calendar("XNYS", start="2000-01-01", end="2026-12-31")
✅ Executed reference implementation, 2026-09-14: schedule_bars(px, schedule, bar_minutes)
accepts a price Series and explicit open, close, optional break_start, break_end
columns. The schedule index is the session label. It uses left-closed/right-open intervals,
starts a new bucket after lunch, retains empty buckets as missing values with count zero,
and rejects observations outside the schedule. Missing observations do not shift boundaries.
Use timezone-aware instants for DST and overnight sessions. Half-days use their actual close.
The minutes output counts nonmissing price observations; it equals trading minutes only
for complete one-minute input. It does not impute missing observations or validate whether
an externally supplied schedule matches an exchange announcement.
🚨 session_bars is a separate synthetic comparison: it counts available rows and compresses
non-trading time, so a bucket can span lunch. It requires complete one-minute observations.
Do not use it to hide holes in a delivered dataset.
✅ Measured 2026-09-14: on the demo's fixed Tokyo-like schedule, wall-clock half-hour resampling
creates 16764 buckets, only 2500 containing observations. At hourly resolution, wall-clock
counts are [60, 60, 30, 30, 60, 60], while compressed trading-time counts are
[60, 60, 60, 60, 60]. The synthetic process has no lunch shock; partial buckets have
0.4768 times the variance of full buckets in this seed. This is a bucket-duration comparison,
not evidence that actual lunch or overnight volatility is zero. The synthetic weekdays and
fixed historical shape are not an up-to-date Tokyo schedule.
✅ Measured 2026-09-14: bundled 2024 closure tables agree with installed
exchange_calendars 4.13.2. XNYS has 252 sessions and XTKS 245; 16 occur only on XNYS and
9 only on XTKS. Reindexing Tokyo onto New York adds holes and drops Tokyo-only observations.
Keep the holes and a venue-open mask rather than treating carried prices as fresh trades.
✅ Measured with pandas_market_calendars 5.4.0 and holidays 0.104, 2026-09-14:
holidays.US(years=2024) disagrees with XNYS on 3 dates. Its federal-holiday list is not
the financial calendar; financial_holidays("NYSE", years=2024) agrees in this test.Run python scripts/calendars.py from this skill directory to reproduce the table and
optional library comparisons. Re-run after a calendar dependency changes. The bundled closures
cover only 2024 and intentionally reject other years; use a maintained schedule in production.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/fin-market-data:trading-calendars-and-sessionsfrom fin-market-data
npx claudepluginhub howard-lynn-ye/fin-rsi --plugin fin-market-data9 skills in this plugin
/choosing-a-data-vendorDecide whether a data source may legally and factually serve a research question, before any fetch code is written. TRIGGER - need delisted, survivorship-free or point-in-time data and are choosing where to get it; may I store, cache, redistribute or publish what I fetched; is the free tier enough and what does a key cost; comparing vendor terms, licences, rate limits or paid tiers; "there are no delisted names on the free tier"; picking between yfinance, Tiingo, Alpha Vantage, stooq, EODHD, Norgate, CRSP or Polygon. Automated by `python -m fin_skills.data advise`. SKIP once the source is chosen and the question is how to CALL it - adjustment, timezone, calendar and off-by-one traps (market-data-sourcing); storing, partitioning or as-of joining data you already hold (market-data-engineering); EDGAR, XBRL and macro vintages (fundamental-and-macro-data); A-share sources and 退市 lists (china-ashare-data); exchange OHLCV and venue limits (crypto-data-and-execution)./corporate-actions-processingTRIGGER - spin-off, spinoff, rights issue, TERP, merger, exchange ratio, reverse split, cash in lieu, ticker change, symbol recycling, special dividend, parent price dropped on ex-date, 分拆, 配股, 并购. Reconcile event cash and share entitlements with position returns. SKIP for ordinary split/dividend price-adjustment detection (market-data-sourcing), stale prices and OHLC validation (data-quality-validation), calendars (trading-calendars-and-sessions), and survivorship-free universes (research-integrity-guards)./data-quality-validationTRIGGER - stale closes, zero volume, missing trading sessions, duplicate timestamps, negative prices, invalid OHLC, outlier returns, validate downloaded bars, 数据质量, 缺失行情. Validate a daily OHLCV panel and report defects without filling, clipping or deleting data. SKIP for selecting a vendor or detecting price-adjustment convention (market-data-sourcing), session schedules (trading-calendars-and-sessions), corporate event accounting (corporate-actions-processing), and storage/as-of joins (market-data-engineering)./finding-and-searching-dataFind the identifier before you fetch it, and know which free sources can actually search. TRIGGER - "what is the FRED series id for X", "which ticker is this company", "find the CIK for", searching for a series, ticker, symbol, contract, crypto pair or filing by name or phrase; fred/series/search, company_tickers.json, EDGAR full-text search, efts.sec.gov; a guessed identifier returning an empty frame; retrieving filings by form and date range; when a document became PUBLIC versus when it was filed; earnings-call transcript timestamps. Load BEFORE guessing an identifier - three of the four free searches are current snapshots and cannot answer as of a past date. SKIP for resolving or dating an identifier you already hold (security-master-and-symbology), for choosing a price vendor (market-data-sourcing), for the point-in-time join once the data is yours (fundamental-and-macro-data), for auditing a finished result (research-integrity-guards), and for crypto venue mechanics (crypto-data-and-execution)./fundamental-and-macro-dataCompany fundamentals and macro series with correct point-in-time semantics. TRIGGER - 10-K, 10-Q, 8-K, 13F, Forms 3/4/5, filings, EDGAR, XBRL, accession number, CIK, "which CIK is this ticker", ticker-to-CIK mapping, edgartools; parsing an income statement or balance sheet out of a filing; revenue, EPS or balance-sheet history as it was known on a past date; restatements; earnings dates; or CPI, GDP, payrolls, unemployment, interest rates, FRED, ALFRED, data vintages and revisions. Load before joining ANY fundamental or macro series to prices: the obvious join is a look-ahead bug, and the SEC frames API cannot be made point-in-time. SKIP for price and OHLCV vendors (market-data-sourcing) and Chinese filings (china-ashare-data)./market-data-engineeringStore, join and parallelize market data you already hold, without corrupting it. TRIGGER - as-of join, merge_asof, join_asof, ASOF JOIN, "join quotes to trades", aligning signals to prices; reading or writing Parquet, Feather, HDF5 or CSV of market data; choosing between pandas, polars, DuckDB, pyarrow, dask or ray; a time-series store such as ArcticDB, QuestDB, ClickHouse, TimescaleDB or kdb; storing years of minute bars for thousands of tickers; a dataset too big for memory; partitioning; timestamps or timezones coming back wrong; float precision on prices or volume; "different numbers when I parallelise". SKIP for choosing a data VENDOR (market-data-sourcing) - this skill starts once the bytes are yours.