wakproductions / stock_market_days

A Ruby gem for determining which days the US stock market is open
4 stars 3 forks source link

Stock Market Days

This is a gem to determine whether the US stock market is open on a given day, and calculate the number of trading days between two dates. All dates are based on the NYSE calendar.

Typically, markets are closed on weekends and the following holidays:

Right now the calculation of dates is limited to before 12/31/2059, but that should give you plenty of time to get rich!

Installation

In your Gemfile:

gem 'stock_market_days'

Available Methods

is_market_day? - tells you whether the given date is a date US markets are open market_days_between - tells number of trading days between two dates market_days_from - gives you the trading day of given date, plus number of trading days

Look at the test suite for examples of usage.