Indian Stock Market
This npm package provides utilities to work with the Indian stock market, including functions to determine market holidays, expiry dates for futures and options, and market open/close status.
Installation
npm install @zero65tech/indian-stock-market
Usage
Importing the package
const ism = require('@zero65tech/indian-stock-market');
Functions
fo(name)
Returns information about the futures or options contract.
const info = ism.fo('NIFTY21OCTFUT');
console.log(info); // { scrip: 'NIFTY', exp: '21OCT', expiry: '2021-10-28', type: 'FUT' }
isOpen()
Checks if the market is currently open.
const open = ism.isOpen();
console.log(open); // true or false
hasOpened()
Checks if the market has opened today.
const opened = ism.hasOpened();
console.log(opened); // true or false
hasClosed()
Checks if the market has closed today.
const closed = ism.hasClosed();
console.log(closed); // true or false
isHoliday(date)
Checks if the given date is a market holiday. If no date is provided, it checks for today.
const holiday = ism.isHoliday();
console.log(holiday); // true or false
const holiday = ism.isHoliday('2021-10-02');
console.log(holiday); // true or false
const holiday = ism.isHoliday(new Date('2021-10-02'));
console.log(holiday); // true or false
License
This project is licensed under the MIT License.