MarCal is a TypeScript library that provides a stock market calendar for stock trading applications.
For now, it provides the calendar for the years 2023
, 2024
and 2025
.
Note that all the U.S. stock exchanges open at the same time. The three major stock exchanges NYSE, NASDAQ, and the American Stock Exchange synchronize opening times.
npm i marcal
import { MarCal, MarCalType } from 'marcal';
const marCal: MarCalType = new MarCal();
const open: boolean = marCal.marketOpen();
if (open) {
console.log('US market is open')
} else {
console.log('US market is closed')
}
// Returns true if US market is open. Otherwise, false.
marketOpen(): boolean
// Returns true if US market is in pre-open session. Otherwise, false.
preMarket(): boolean
// Returns true if US market is in after-market session. Otherwise, false.
afterMarket(): boolean
// Returns the number of remaining minutes before the market closes.
minutesToClose(): number
Contributions are welcome and can be made by submitting GitHub pull requests
to this repository. In general, the MarCal
source code follows
Airbnb JavaScript Style Guide and the
rules specified in .eslintrc.json
file.
This source code is available to everyone under the standard MIT LICENSE.