NasdaqSchedule
ActiveSupport::TimeWithZone extension. Provides a set of set instance methods which return specific time informations according to Nasdaq working schedule and market hours. Nasdaq schedule can be found here http://www.nasdaq.com/about/trading-schedule.aspx . The market timezone is EST/EDT.
Installation
Add this line to your application's Gemfile:
gem 'nasdaq_schedule'
And then execute:
$ bundle
Or install it yourself as:
$ gem install nasdaq_schedule
Usage
date = Time.zone.now => Tue, 09 Dec 2014 14:01:10 PST -08:00
date.in_nasdaq_time_zone
=> Tue, 09 Dec 2014 17:01:10 EST -05:00
otherwise false.
date.nasdaq_holiday?
=> false
date.nasdaq_working_day?
=> true
date.nasdaq_open
=> Tue, 09 Dec 2014 06:30:00 PST -08:00
date.nasdaq_close
=> Tue, 09 Dec 2014 13:00:00 PST -08:00
date.nasdaq_previous_day
=> Mon, 08 Dec 2014 14:01:10 PST -08:00
date.nasdaq_next_day
=> Wed, 10 Dec 2014 14:01:10 PST -08:00
(date + 4.days)
=> Sat, 13 Dec 2014 14:01:10 PST -08:00
(date + 4.days).nasdaq_closest_open
=> Mon, 15 Dec 2014 06:30:00 PST -08:00
(date + 4.days).nasdaq_closest_close
=> Mon, 15 Dec 2014 13:00:00 PST -08:00
Running specs
- Clone the repo
- run
bundle exec rake spec
Contributing
- Fork it ( http://github.com/camol/nasdaq_schedule/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request