0.6.2 • Published 9 months ago
marcal v0.6.2
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 marcalUsage
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 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 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 true if in after-hours session, false otherwise
*/
afterMarket(): boolean
/**
* Calculates remaining time until market close (4:00 PM ET).
* Returns number of minutes until market closes. Returns 0 if market is already closed.
*/
minutesToClose(): number
/**
* Checks if the current day is a holiday or weekend.
* Returns true if the day is a holiday or weekend, false otherwise
*/
isHolidayOrWeekend(): booleanContributions
We welcome contributions to MarCal! To contribute, please:
git clonethe 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.