stock_market_days 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +4 -2
- data/README.md +2 -1
- data/lib/market_open_days/nyse_market_days.csv +2 -7
- data/lib/stock_market_days/calculator.rb +3 -1
- data/lib/stock_market_days/version.rb +2 -2
- data/spec/stock_market_days/stock_market_days_spec.rb +28 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c34e21fade70fd07272a1dd780b5e6abe7eabddbe0a024e71164c7289384963
|
4
|
+
data.tar.gz: fd6452c7aa2468c8b4e5e65e4648eab5e6276778e93f0c595d024a85058ac7d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb251f60a4d040d96d8202f6b8759c587de43cf00d0ad6b49834929b877bf0206f385b16419102b2df12e8d301a467efb62e51cf197070a98b0438a7dc6d7346
|
7
|
+
data.tar.gz: edcea552170bc39ae84ac3a7502890540c2f3532fd88e137a16579d4258e81f4285e5fed11cd2c26e0277ec0853d31e2960787d29d22655f9b9e0bf096a54454
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -8,7 +8,7 @@ PATH
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
addressable (2.
|
11
|
+
addressable (2.8.0)
|
12
12
|
public_suffix (>= 2.0.2, < 5.0)
|
13
13
|
clipboard (1.3.5)
|
14
14
|
coderay (1.1.3)
|
@@ -22,7 +22,8 @@ GEM
|
|
22
22
|
method_source (~> 1.0)
|
23
23
|
public_suffix (4.0.6)
|
24
24
|
rake (13.0.3)
|
25
|
-
rexml (3.2.
|
25
|
+
rexml (3.2.8)
|
26
|
+
strscan (>= 3.0.9)
|
26
27
|
rspec (3.10.0)
|
27
28
|
rspec-core (~> 3.10.0)
|
28
29
|
rspec-expectations (~> 3.10.0)
|
@@ -36,6 +37,7 @@ GEM
|
|
36
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
38
|
rspec-support (~> 3.10.0)
|
38
39
|
rspec-support (3.10.2)
|
40
|
+
strscan (3.1.0)
|
39
41
|
webmock (3.11.2)
|
40
42
|
addressable (>= 2.3.6)
|
41
43
|
crack (>= 0.3.2)
|
data/README.md
CHANGED
@@ -10,6 +10,7 @@ Typically, markets are closed on weekends and the following holidays:
|
|
10
10
|
* Washington's Birthday (third Monday of Feburary)
|
11
11
|
* Good Friday (Determined by http://www.maa.clell.de/StarDate/publ_holidays.html)
|
12
12
|
* Memorial Day (last Monday of May)
|
13
|
+
* Juneteenth (June 19, or nearest Monday or Friday if on a weekend)
|
13
14
|
* Independence Day (July 4, or July 3rd if on Saturday, July 5th if on Sunday)
|
14
15
|
* Labor Day (First Monday of September)
|
15
16
|
* Thanksgiving Day (Fourth Thursday of November)
|
@@ -23,7 +24,7 @@ to get rich!
|
|
23
24
|
In your Gemfile:
|
24
25
|
|
25
26
|
```ruby
|
26
|
-
gem 'stock_market_days'
|
27
|
+
gem 'stock_market_days'
|
27
28
|
```
|
28
29
|
|
29
30
|
## Available Methods
|
@@ -763,7 +763,6 @@
|
|
763
763
|
2017-01-11
|
764
764
|
2017-01-12
|
765
765
|
2017-01-13
|
766
|
-
2017-01-16
|
767
766
|
2017-01-17
|
768
767
|
2017-01-18
|
769
768
|
2017-01-19
|
@@ -826,7 +825,6 @@
|
|
826
825
|
2017-04-11
|
827
826
|
2017-04-12
|
828
827
|
2017-04-13
|
829
|
-
2017-04-14
|
830
828
|
2017-04-17
|
831
829
|
2017-04-18
|
832
830
|
2017-04-19
|
@@ -1007,7 +1005,6 @@
|
|
1007
1005
|
2017-12-27
|
1008
1006
|
2017-12-28
|
1009
1007
|
2017-12-29
|
1010
|
-
2018-01-01
|
1011
1008
|
2018-01-02
|
1012
1009
|
2018-01-03
|
1013
1010
|
2018-01-04
|
@@ -1259,7 +1256,6 @@
|
|
1259
1256
|
2018-12-27
|
1260
1257
|
2018-12-28
|
1261
1258
|
2018-12-31
|
1262
|
-
2019-01-01
|
1263
1259
|
2019-01-02
|
1264
1260
|
2019-01-03
|
1265
1261
|
2019-01-04
|
@@ -1485,11 +1481,11 @@
|
|
1485
1481
|
2019-11-18
|
1486
1482
|
2019-11-19
|
1487
1483
|
2019-11-20
|
1484
|
+
2019-11-21
|
1488
1485
|
2019-11-22
|
1489
1486
|
2019-11-25
|
1490
1487
|
2019-11-26
|
1491
1488
|
2019-11-27
|
1492
|
-
2019-11-28
|
1493
1489
|
2019-11-29
|
1494
1490
|
2019-12-02
|
1495
1491
|
2019-12-03
|
@@ -1512,7 +1508,6 @@
|
|
1512
1508
|
2019-12-27
|
1513
1509
|
2019-12-30
|
1514
1510
|
2019-12-31
|
1515
|
-
2020-01-01
|
1516
1511
|
2020-01-02
|
1517
1512
|
2020-01-03
|
1518
1513
|
2020-01-06
|
@@ -1737,11 +1732,11 @@
|
|
1737
1732
|
2020-11-16
|
1738
1733
|
2020-11-17
|
1739
1734
|
2020-11-18
|
1735
|
+
2020-11-19
|
1740
1736
|
2020-11-20
|
1741
1737
|
2020-11-23
|
1742
1738
|
2020-11-24
|
1743
1739
|
2020-11-25
|
1744
|
-
2020-11-26
|
1745
1740
|
2020-11-27
|
1746
1741
|
2020-11-30
|
1747
1742
|
2020-12-01
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'stock_market_days/utility_methods'
|
2
4
|
|
3
5
|
module StockMarketDays
|
@@ -8,7 +10,7 @@ module StockMarketDays
|
|
8
10
|
|
9
11
|
def initialize(market_days_file)
|
10
12
|
file_contents = File.open(market_days_file).read
|
11
|
-
@market_days_list = file_contents.split("\n").map { |date_s| Date.
|
13
|
+
@market_days_list = file_contents.split("\n").map { |date_s| Date.strptime(date_s, '%Y-%m-%d') }
|
12
14
|
end
|
13
15
|
|
14
16
|
def is_market_day?(date=Date.today)
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module StockMarketDays
|
2
|
-
VERSION = '1.1.
|
3
|
-
end
|
2
|
+
VERSION = '1.1.2'
|
3
|
+
end
|
@@ -63,9 +63,19 @@ describe StockMarketDays do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
context 'is Thanksgiving' do
|
66
|
-
let(:
|
66
|
+
let(:dates) do
|
67
|
+
[
|
68
|
+
Date.new(2019,11,28),
|
69
|
+
Date.new(2020,11,26),
|
70
|
+
Date.new(2023,11,23)
|
71
|
+
]
|
72
|
+
end
|
67
73
|
|
68
|
-
it
|
74
|
+
it 'reports market closed on Thanksgiving' do
|
75
|
+
dates.each do |market_closed_day|
|
76
|
+
expect(described_class.is_market_day?(market_closed_day)).to be_falsey
|
77
|
+
end
|
78
|
+
end
|
69
79
|
end
|
70
80
|
|
71
81
|
context 'is Christmas (observed)' do
|
@@ -73,6 +83,22 @@ describe StockMarketDays do
|
|
73
83
|
|
74
84
|
it { is_expected.to be_falsey }
|
75
85
|
end
|
86
|
+
|
87
|
+
context 'is New Year\'s Day' do
|
88
|
+
let(:dates) do
|
89
|
+
[
|
90
|
+
Date.new(2018,1,1),
|
91
|
+
Date.new(2019,1,1),
|
92
|
+
Date.new(2020,1,1)
|
93
|
+
]
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'reports market closed on New Year\'s Day' do
|
97
|
+
dates.each do |market_closed_day|
|
98
|
+
expect(described_class.is_market_day?(market_closed_day)).to be_falsey
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
76
102
|
end
|
77
103
|
|
78
104
|
context '#market_days_between' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stock_market_days
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Winston Kotzan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
|
-
rubygems_version: 3.3.
|
141
|
+
rubygems_version: 3.3.26
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: A gem for determining the days that the stock market is open
|