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!
In your Gemfile:
gem 'stock_market_days'
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.