marcal
TypeScript icon, indicating that this package has built-in type declarations

0.3.2 • Public • Published

Stock Market Calendar

NPM

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.

Install

npm i marcal

Usage

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')
}

Methods

// 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

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.

License

This source code is available to everyone under the standard MIT LICENSE.

Package Sidebar

Install

npm i marcal

Weekly Downloads

7

Version

0.3.2

License

MIT

Unpacked Size

19.3 kB

Total Files

15

Last publish

Collaborators

  • baloian