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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b9205e34e62890b7146b8ea08421aec044fc8c5
4
- data.tar.gz: 9fd337ed2ddae4b5df669215d82b3df261063d4b
3
+ metadata.gz: 45c66a1b09810dad0444527a10558bb3842f2028
4
+ data.tar.gz: 46209a9247cb9aa76f3bee5d2721c57efd51e2ea
5
5
  SHA512:
6
- metadata.gz: 762fef32c5c1c6cae40f9409900752027365eb736a4239bab30dc6cd3012ad827508e5c8868286acd68b5586cdfc53dbdb8bac42170d65cb60ee7732453af0df
7
- data.tar.gz: f24b2dcc069d6850e659928b6773f893bbdf062dfdd524f4681ed5570c0a4ee7c653e25ea3a706c2a67fd6fe86b80f5863610b5effbd4beade52ac0d168c9fea
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
- Add this line to your application's Gemfile:
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
@@ -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, Time.now, :us, :observed).map do |holiday|
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
@@ -1,3 +1,3 @@
1
1
  module StockPivot
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stock_pivot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott V. Rosenthal