npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

market-calendar

v1.1.1

Published

Exchange trading calendars: sessions, holidays, early closes and bar timestamps for 36 markets. A JavaScript port of pandas_market_calendars.

Readme

market-calendar

Exchange trading calendars for JavaScript: sessions, holidays, early closes and bar timestamps for 36 markets.

A JavaScript port of pandas_market_calendars by Ryan Sheftel. The exchange data and the behaviour are that project's work; see Credits.

npm install market-calendar

Usage

import { getCalendar } from 'market-calendar'

const nyse = getCalendar('NYSE')

nyse.validDays('2024-07-01', '2024-07-08')
// the trading days, with Independence Day and the weekend left out

nyse.schedule('2024-07-03', '2024-07-03')
// [{ date, pre: 04:00, market_open: 09:30, market_close: 13:00, post: 17:00 }]
//   the half-day before Independence Day, and its shortened post session

nyse.openAtTime(
  DateTime.fromISO('2024-07-03T15:00', { zone: 'America/New_York' }),
)
// true — regular hours have ended but the post session runs to 17:00

Bar timestamps

import { dateRange, dateRangeHTF } from 'market-calendar'

dateRange(nyse.schedule('2024-07-01', '2024-07-01'), '1h', { closed: 'left' })
// 09:30  10:30  11:30  12:30  13:30  14:30  15:30

dateRangeHTF(nyse.validDays('2024-01-01', '2024-12-31'), 'ME')
// the last trading day of each month, which is rarely the last of the month

Early closes and late opens

const year = nyse.schedule('2024-01-01', '2024-12-31')
nyse.earlyCloses(year).map((d) => d.date.toISODate())
// ['2024-07-03', '2024-11-29', '2024-12-24']

Calendars

Thirty-six calendars, 152 names. calendarNames() lists them all.

| Region | Exchanges | | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Americas | NYSE, IEX, CFE, CBOE equity and index options, CME equity / bond / agriculture / trade dates, CME Globex equities / fixed income / FX / energy and metals / crypto / livestock / grains, ICE, SIFMA US, TSX, BMF | | EMEA | LSE, EUREX, EUREX pre/post, EUREX bond, SIX, OSE, SIFMA UK, TASE | | Asia Pacific | JPX, HKEX, SSE, ASX, BSE, NSE, SIFMA JP | | Other | FOREX |

Exchanges answer to their aliases too, so NASDAQ, DOW and BATS all reach the NYSE calendar, and CL, NG and GC reach CME Globex energy and metals.

History

Calendars carry their own history rather than only their current rules. NYSE opened at 10:00 until 1985 and traded on Saturdays until 1952; CME's equity session moved twice; JPX moved its close in November 2024. Ask for a schedule in 1970 and you get 1970's hours.

Credits and attribution

This library is a JavaScript port of pandas_market_calendars, created and maintained by Ryan Sheftel and its contributors, and released under the MIT License.

Nearly everything of substance here originates in that project. Its exchange rules, holiday data and the semantics of the schedule and date-range functions were followed deliberately and closely, so that answers agree with it. Where this port departs — a renamed function, a generalised structure, a rule corrected — the reason is recorded in the changelog and in the code.

pandas_market_calendars itself builds on earlier work by Quantopian, and some of its calendars carry that lineage.

This project is an independent port. It is not affiliated with, endorsed by, or supported by the authors of pandas_market_calendars; please raise issues with this port here rather than with them.

Both projects are MIT licensed. See LICENSE for this one, and the upstream repository for theirs.