Module: StockMarketDays
- Defined in:
- lib/stock_market_days.rb,
lib/stock_market_days/version.rb,
lib/stock_market_days/calculator.rb,
lib/stock_market_days/utility_methods.rb
Defined Under Namespace
Modules: UtilityMethods
Classes: Calculator
Constant Summary
collapse
- MARKET_DAYS_FILE =
File.join(File.dirname(__FILE__), 'market_open_days', 'nyse_market_days.csv')
- VERSION =
'1.2.1'
- @@default_calculator =
StockMarketDays::Calculator.new(MARKET_DAYS_FILE)
Class Method Summary
collapse
Class Method Details
.is_market_day?(date = Date.today) ⇒ Boolean
10
11
12
|
# File 'lib/stock_market_days.rb', line 10
def is_market_day?(date = Date.today)
@@default_calculator.is_market_day?(date)
end
|
.market_days_between(begin_date, end_date) ⇒ Object
14
15
16
|
# File 'lib/stock_market_days.rb', line 14
def market_days_between(begin_date, end_date)
@@default_calculator.market_days_between(begin_date, end_date)
end
|
.market_days_from(begin_date, days) ⇒ Object
18
19
20
|
# File 'lib/stock_market_days.rb', line 18
def market_days_from(begin_date, days)
@@default_calculator.market_days_from(begin_date, days)
end
|
.next_market_day(from_date = Date.today) ⇒ Object
22
23
24
|
# File 'lib/stock_market_days.rb', line 22
def next_market_day(from_date=Date.today)
@@default_calculator.market_days_from(from_date, 1)
end
|
.previous_market_day(from_date = Date.today) ⇒ Object
26
27
28
|
# File 'lib/stock_market_days.rb', line 26
def previous_market_day(from_date=Date.today)
@@default_calculator.market_days_from(from_date, -1)
end
|