brm_finance 1.0.12 → 1.0.13
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 +16 -29
- 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: 1dfe8f9382e9eccec1107fa2b93f18a8159886ec
|
4
|
+
data.tar.gz: 6f2c9196950e34d3801e4b35e4b54c1e36e0e7d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d4a5207f2dafff45e2cb181f653c1aec8f2e329d2584d07cd1f5806d5172095460dae06a6a8347d253080abeca4e5b8234414e1dcaed33858e8d37ec711e16c
|
7
|
+
data.tar.gz: ff29dfe3fafd9090f8767b1c5a3b75ccb9debeb97a499da409d90910df3581ffc6bc9b187540b189a3639fe7ac48722a67e3dd145a2e4e5c12341399e70f3f54
|
data/lib/brm_finance/stock.rb
CHANGED
@@ -3,19 +3,25 @@ require "rest-client"
|
|
3
3
|
require "json"
|
4
4
|
require "date"
|
5
5
|
require 'csv'
|
6
|
-
require 'open-uri'
|
7
|
-
require 'nokogiri'
|
8
6
|
|
9
7
|
module BrmFinance
|
10
|
-
def BrmFinance.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
def BrmFinance.dividends_splits(symbol, start_date=Date.today-1.year, end_date=Date.today)
|
9
|
+
symbol = [symbol] unless symbol.is_a?(Array)
|
10
|
+
|
11
|
+
#start_date = start_date.strftime('%m-%d-%Y').split('-')
|
12
|
+
#start_date = "a=#{start_date[0]}&b=#{start_date[1]}&c=#{start_date[2]}"
|
13
|
+
|
14
|
+
#end_date = end_date.strftime('%m-%d-%Y').split('-')
|
15
|
+
#end_date = "d=#{end_date[0]}&e=#{end_date[1]}&f=#{end_date[2]}"
|
16
|
+
|
17
|
+
results = []
|
18
|
+
symbol.each do |s|
|
19
|
+
#url = "http://ichart.finance.yahoo.com/x?s=#{s}&#{start_date}&#{end_date}&g=v&y=0&z=30000"
|
20
|
+
url = "http://ichart.finance.yahoo.com/x?s=#{s}&g=v&y=0&z=30000"
|
21
|
+
response = RestClient.get(url)
|
22
|
+
results.push({'Symbol' => s, 'Series' => CSV.parse(response)})
|
18
23
|
end
|
24
|
+
results
|
19
25
|
end
|
20
26
|
|
21
27
|
class Stock
|
@@ -89,25 +95,6 @@ module BrmFinance
|
|
89
95
|
self.parse(response, symbol)
|
90
96
|
end
|
91
97
|
|
92
|
-
def self.dividends_splits(symbol, start_date=Date.today-1.year, end_date=Date.today)
|
93
|
-
symbol = [symbol] unless symbol.is_a?(Array)
|
94
|
-
|
95
|
-
start_date = start_date.strftime('%m-%d-%Y').split('-')
|
96
|
-
start_date = "a=#{start_date[0]}&b=#{start_date[1]}&c=#{start_date[2]}"
|
97
|
-
|
98
|
-
end_date = end_date.strftime('%m-%d-%Y').split('-')
|
99
|
-
end_date = "d=#{end_date[0]}&e=#{end_date[1]}&f=#{end_date[2]}"
|
100
|
-
|
101
|
-
results = []
|
102
|
-
symbol.each do |s|
|
103
|
-
url = "http://ichart.finance.yahoo.com/x?s=#{s}&#{start_date}&#{end_date}&g=v&y=0&z=30000"
|
104
|
-
response = RestClient.get(url)
|
105
|
-
results.push({'Symbol' => s, 'Series' => CSV.parse(response)})
|
106
|
-
end
|
107
|
-
|
108
|
-
results
|
109
|
-
end
|
110
|
-
|
111
98
|
def self.company_info(symbol)
|
112
99
|
url = 'http://query.yahooapis.com/v1/public/yql?q='
|
113
100
|
|
data/lib/brm_finance/version.rb
CHANGED