yahoo_finanza 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yahoo_finanza/finance_utils.rb +1 -2
- data/lib/yahoo_finanza/version.rb +1 -1
- data/lib/yahoo_finanza/worker.rb +5 -20
- 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: 2881fe082006a66e1403108265a9a9994a79cc9d
|
4
|
+
data.tar.gz: 707e3e824ae079336f148cd91ed057506a06da93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5831afbf16dee8fb2af2d8377dc3d254da86a4de2f2a67dd8183e4e17a454eb2213f90a87c0a11c98c9683f8e935bdcc71f04777c4c511d21e18214ac03807d
|
7
|
+
data.tar.gz: 61d7669b8bf32a4acba40a0ba0a96681856e15f363736bb26295265aef54b6475ef8914d75f1ad8a1755b62cf478d64b04d51ace5f95d127d9abeaaf401ab933
|
data/lib/yahoo_finanza/worker.rb
CHANGED
@@ -9,27 +9,12 @@ module YahooFinanza
|
|
9
9
|
@browser = Mechanize.new
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
symbols.push(link.text.split(" (")[1].gsub(')', '').strip)
|
18
|
-
end
|
19
|
-
break unless symbols.count < 8
|
12
|
+
def get_active_stocks
|
13
|
+
nasdaq = @browser.get(YahooFinanza::Constants.active_nnm_url).search(".linkb")[0..24]
|
14
|
+
nyse = @browser.get(YahooFinanza::Constants.active_nyse_url).search(".linkb")[0..24]
|
15
|
+
(nasdaq + nyse).map do |stock|
|
16
|
+
stock.text.match(/\(.*?\)/)[0].gsub!("(", "").gsub!(")", "")
|
20
17
|
end
|
21
|
-
symbols
|
22
|
-
end
|
23
|
-
|
24
|
-
def process_page_2(symbols)
|
25
|
-
page_2 = @browser.get(YahooFinanza::Constants.active_nyse_url)
|
26
|
-
page_2.links.each do |link|
|
27
|
-
if link.text.split(" (").count > 1
|
28
|
-
symbols.push(link.text.split(" (")[1].gsub(')', '').strip)
|
29
|
-
end
|
30
|
-
break unless symbols.count < 16
|
31
|
-
end
|
32
|
-
symbols
|
33
18
|
end
|
34
19
|
end
|
35
20
|
end
|