stock_pivot 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -9
- data/lib/stock_pivot/quotes.rb +6 -2
- data/lib/stock_pivot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45c66a1b09810dad0444527a10558bb3842f2028
|
4
|
+
data.tar.gz: 46209a9247cb9aa76f3bee5d2721c57efd51e2ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f7c9b06caf773fe6f8bcd2fa3054909ea948269ad5b03beb8a374b6c75ca8e8ee298a89263402a6a435a9d2d0b764d44f0d12a88f7fcfcc1de8e21a623d9588
|
7
|
+
data.tar.gz: a23a9097f0db80d47a7b83b44a0ff61416159145b07b548b0de20e3c02893b6df16bfba92f3107df5caea3703dbbef66f99d32c86c2803ea3781f0367f5ac58f
|
data/README.md
CHANGED
@@ -8,20 +8,14 @@ Given a stock symbol and margin balance, `stockpivot` will calculate tomorrow's
|
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
gem 'stock_pivot'
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
11
|
+
Install it yourself as:
|
20
12
|
|
21
13
|
$ gem install stock_pivot
|
22
14
|
|
23
15
|
## Usage
|
24
16
|
|
17
|
+
$ stockpivot help trade
|
18
|
+
|
25
19
|
$ stockpivot trade AAPL 10000
|
26
20
|
|
27
21
|
## Contributing
|
data/lib/stock_pivot/quotes.rb
CHANGED
@@ -7,8 +7,12 @@ module StockPivot
|
|
7
7
|
opts = options.merge(opts)
|
8
8
|
days_ago = opts.fetch(:days_ago)
|
9
9
|
exclude_holidays!(days_ago)
|
10
|
-
end_date = 1.business_day.ago
|
11
10
|
start_date = days_ago.business_days.ago
|
11
|
+
end_date = 1.business_day.ago
|
12
|
+
if Time.after_business_hours?(Time.now) && Date.today.weekday?
|
13
|
+
start_date = (days_ago - 1).business_days.ago
|
14
|
+
end_date = Date.today
|
15
|
+
end
|
12
16
|
StockPivot::FeedWrapper.get(
|
13
17
|
symbol: symbol,
|
14
18
|
start_date: start_date,
|
@@ -22,7 +26,7 @@ module StockPivot
|
|
22
26
|
|
23
27
|
def exclude_holidays!(days_ago)
|
24
28
|
beginning_of_year = days_ago.days.ago.beginning_of_year
|
25
|
-
Holidays.between(beginning_of_year,
|
29
|
+
Holidays.between(beginning_of_year, 1.week.from_now, :us, :observed).map do |holiday|
|
26
30
|
BusinessTime::Config.holidays << holiday[:date]
|
27
31
|
end
|
28
32
|
end
|
data/lib/stock_pivot/version.rb
CHANGED