New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nasdaq_schedule

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nasdaq_schedule

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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

# 'in_nasdaq_time_zone' returns time in Nasdaq time zone.
date.in_nasdaq_time_zone
=> Tue, 09 Dec 2014 17:01:10 EST -05:00 

# 'nasdaq_holiday?' returns true if the given date is a Nasdaq holiday,
otherwise false.
date.nasdaq_holiday?
=> false

# 'nasdaq_working_day?' returns true if the given date is Nasdaq working day, otherwise false.
date.nasdaq_working_day?
=> true

# 'nasdaq_open' returns Nasdaq open time in given timezone.
date.nasdaq_open
=> Tue, 09 Dec 2014 06:30:00 PST -08:00 

# 'nasdaq_close' returns Nasdaq close time in given timezone.
date.nasdaq_close
=> Tue, 09 Dec 2014 13:00:00 PST -08:00

# Both will raise NasdaqSchedule::Errors::NotWorkingDay when used on weekends or holidays.

# 'nasdaq_previous_day' returns previous working day for Nasdaq.
date.nasdaq_previous_day
=> Mon, 08 Dec 2014 14:01:10 PST -08:00 

# 'nasdaq_next_day' returns next working day for Nasdaq.
date.nasdaq_next_day
=> Wed, 10 Dec 2014 14:01:10 PST -08:00 

# 'nasdaq_closest_open' returns open time of closest working day.
(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

# 'nasdaq_closest_close' returns close time of closest working day.
(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

  1. Fork it ( http://github.com/camol/nasdaq_schedule/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 12 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc