brm_finance 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brm_finance/stock.rb +8 -6
- data/lib/brm_finance/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: 59268a52987945e2a882f6f8c54e72d03d2347a2
|
4
|
+
data.tar.gz: 1489e10158bc187f6880823343962cb387da1732
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3543fed071ed87ec6dd5b31811818f99ae28b85381d8760a918189e5b8494e9fdc80e3d6db728d3630549d01575c370859e36c26fe6689a5d4e671dcf2b2068
|
7
|
+
data.tar.gz: 76d937a3bbe3e73cee734083077d88c1039d8026ada7a78697d611c007cb702b0ccdd42372347dbe57addfd3deccaebcb55957eb0cb1286a84392408cc3ebeec
|
data/lib/brm_finance/stock.rb
CHANGED
@@ -76,13 +76,15 @@ module BrmFinance
|
|
76
76
|
self.parse(response, symbol)
|
77
77
|
end
|
78
78
|
|
79
|
-
def self.dividends_splits(symbol, start_date=
|
79
|
+
def self.dividends_splits(symbol, start_date=Date.today-1.year, end_date=Date.today)
|
80
80
|
symbol = [symbol] unless symbol.is_a?(Array)
|
81
81
|
|
82
|
-
start_date = start_date.split('-')
|
83
|
-
start_date = "a=#{start_date[
|
82
|
+
start_date = start_date.strftime('%m-%d-%Y')split('-')
|
83
|
+
start_date = "a=#{start_date[0]}&b=#{start_date[1]}&c=#{start_date[2]}"
|
84
|
+
|
85
|
+
end_date = end_date.strftime('%m-%d-%Y')split('-')
|
84
86
|
end_date = end_date.split('-')
|
85
|
-
end_date = "d=#{end_date[
|
87
|
+
end_date = "d=#{end_date[0]}&e=#{end_date[1]}&f=#{end_date[2]}"
|
86
88
|
|
87
89
|
results = []
|
88
90
|
symbol.each do |s|
|
@@ -131,13 +133,13 @@ module BrmFinance
|
|
131
133
|
#return results
|
132
134
|
end
|
133
135
|
|
134
|
-
def self.history(symbol, start_date=
|
136
|
+
def self.history(symbol, start_date=Date.today - 1.year, end_date=Date.today)
|
135
137
|
symbol = symbol.is_a?(Array) ? symbol : [symbol]
|
136
138
|
|
137
139
|
results = []
|
138
140
|
results = symbol.collect do |sym|
|
139
141
|
series = []
|
140
|
-
(start_date.
|
142
|
+
(start_date.end_date+1.year).step(365) do |date|
|
141
143
|
break if date > Date.today
|
142
144
|
new_series = self.quote(sym, (date).strftime('%Y-%m-%d'), (date + 1.year - 1.day).strftime('%Y-%m-%d'))
|
143
145
|
|
data/lib/brm_finance/version.rb
CHANGED