marcal
v0.6.0
Published
Exchanges Calendar for Trading Applications
Downloads
153
Maintainers
Readme
Stock Market Calendar
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 major U.S. stock exchanges (NYSE, NASDAQ, and AMEX) operate on synchronized trading hours:
- Regular Market Hours: 9:30 AM - 4:00 PM ET
- Pre-Market Trading: 4:00 AM - 9:30 AM ET
- After-Hours Trading: 4:00 PM - 8:00 PM ET
Install
npm install marcal
Usage
import { MarCal } from 'marcal';
const marCal: MarCal = new MarCal();
const isMarketOpen: boolean = marCal.marketOpen();
if (isMarketOpen) {
console.log('US market is open');
} else {
console.log('US market is closed');
}
Methods
/**
* Checks if the US stock market is currently open during regular trading hours (9:30 AM - 4:00 PM ET).
* @returns {boolean} True if market is open, false otherwise
*/
marketOpen(): boolean
/**
* Checks if the US stock market is in pre-market trading hours (4:00 AM - 9:30 AM ET).
* @returns {boolean} True if in pre-market session, false otherwise
*/
preMarket(): boolean
/**
* Checks if the US stock market is in after-hours trading session (4:00 PM - 8:00 PM ET).
* @returns {boolean} True if in after-hours session, false otherwise
*/
afterMarket(): boolean
/**
* Calculates remaining time until market close (4:00 PM ET).
* @returns {number} Number of minutes until market closes. Returns 0 if market is already closed.
*/
minutesToClose(): number
Contributions
We welcome contributions to MarCal! To contribute, please:
git clone
the repository- Create a new branch for your feature/fix
- Make your changes following our coding standards
- Submit a pull request
The codebase adheres to the Airbnb JavaScript Style Guide
and follows the linting rules defined in .eslintrc.json
. Please ensure your code matches
these standards before submitting.
License
This source code is available to everyone under the standard MIT LICENSE.