earnings_estimates 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/doc/classes/Array.html +152 -0
- data/doc/classes/Array.src/M000001.html +18 -0
- data/doc/classes/Array.src/M000002.html +18 -0
- data/doc/classes/EarningsEstimates.html +245 -0
- data/doc/classes/EarningsEstimates.src/M000003.html +20 -0
- data/doc/classes/EarningsEstimates.src/M000004.html +33 -0
- data/doc/classes/EarningsEstimates.src/M000005.html +24 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/array_extensions_rb.html +101 -0
- data/doc/files/lib/earnings_estimates_rb.html +112 -0
- data/doc/fr_class_index.html +28 -0
- data/doc/fr_file_index.html +28 -0
- data/doc/fr_method_index.html +31 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/earnings_estimates.gemspec +18 -2
- data/lib/array_extensions.rb +9 -0
- data/lib/earnings_estimates.rb +78 -6
- metadata +19 -3
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= earnings_estimates
|
2
2
|
|
3
|
-
|
3
|
+
The goal of this gem is to retrieve analyst earnings estimates for a given security and perform analysis on them. The theory is that companies that consistently beat earnings estimates and have upward earnings revisions will consistently outperform the market.
|
4
4
|
|
5
5
|
== Note on Patches/Pull Requests
|
6
6
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
@@ -0,0 +1,152 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Array</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Array</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/array_extensions_rb.html">
|
59
|
+
lib/array_extensions.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000002">average</a>
|
90
|
+
<a href="#M000001">sum</a>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
<!-- if includes -->
|
98
|
+
|
99
|
+
<div id="section">
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<!-- if method_list -->
|
109
|
+
<div id="methods">
|
110
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
111
|
+
|
112
|
+
<div id="method-M000002" class="method-detail">
|
113
|
+
<a name="M000002"></a>
|
114
|
+
|
115
|
+
<div class="method-heading">
|
116
|
+
<a href="Array.src/M000002.html" target="Code" class="method-signature"
|
117
|
+
onclick="popupCode('Array.src/M000002.html');return false;">
|
118
|
+
<span class="method-name">average</span><span class="method-args">()</span>
|
119
|
+
</a>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div class="method-description">
|
123
|
+
</div>
|
124
|
+
</div>
|
125
|
+
|
126
|
+
<div id="method-M000001" class="method-detail">
|
127
|
+
<a name="M000001"></a>
|
128
|
+
|
129
|
+
<div class="method-heading">
|
130
|
+
<a href="Array.src/M000001.html" target="Code" class="method-signature"
|
131
|
+
onclick="popupCode('Array.src/M000001.html');return false;">
|
132
|
+
<span class="method-name">sum</span><span class="method-args">()</span>
|
133
|
+
</a>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
<div class="method-description">
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
</div>
|
142
|
+
|
143
|
+
|
144
|
+
</div>
|
145
|
+
|
146
|
+
|
147
|
+
<div id="validator-badges">
|
148
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
</body>
|
152
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>sum (Array)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/array_extensions.rb, line 2</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sum</span>
|
15
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">accum</span>, <span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">accum</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_f</span> }
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>average (Array)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/array_extensions.rb, line 6</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">average</span>
|
15
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sum</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">size</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,245 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: EarningsEstimates</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">EarningsEstimates</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/earnings_estimates_rb.html">
|
59
|
+
lib/earnings_estimates.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000004">analyze</a>
|
90
|
+
<a href="#M000005">fetch_earnings_data</a>
|
91
|
+
<a href="#M000003">new</a>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
<div id="section">
|
101
|
+
|
102
|
+
|
103
|
+
<div id="constants-list">
|
104
|
+
<h3 class="section-bar">Constants</h3>
|
105
|
+
|
106
|
+
<div class="name-list">
|
107
|
+
<table summary="Constants">
|
108
|
+
<tr class="top-aligned-row context-row">
|
109
|
+
<td class="context-item-name">MAX_REVISION_SCORE</td>
|
110
|
+
<td>=</td>
|
111
|
+
<td class="context-item-value">4</td>
|
112
|
+
</tr>
|
113
|
+
</table>
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<div id="attribute-list">
|
120
|
+
<h3 class="section-bar">Attributes</h3>
|
121
|
+
|
122
|
+
<div class="name-list">
|
123
|
+
<table>
|
124
|
+
<tr class="top-aligned-row context-row">
|
125
|
+
<td class="context-item-name">analysis</td>
|
126
|
+
<td class="context-item-value"> [RW] </td>
|
127
|
+
<td class="context-item-desc">
|
128
|
+
Potentially useful URLs <a
|
129
|
+
href="http://finance.yahoo.com/q/ae?s=YHOO">finance.yahoo.com/q/ae?s=YHOO</a>
|
130
|
+
<a
|
131
|
+
href="http://biz.yahoo.com/a/ba/a11.html">biz.yahoo.com/a/ba/a11.html</a>
|
132
|
+
<a
|
133
|
+
href="http://www.zacks.com/research/earnings/today_eps.php">www.zacks.com/research/earnings/today_eps.php</a>
|
134
|
+
TODO: Get market cap TODO: Analyze with # of analysts covering TODO: Figure
|
135
|
+
out which metrics most closely follow price increase TODO: Analyze spread
|
136
|
+
between high and low estimate
|
137
|
+
|
138
|
+
</td>
|
139
|
+
</tr>
|
140
|
+
<tr class="top-aligned-row context-row">
|
141
|
+
<td class="context-item-name">estimates</td>
|
142
|
+
<td class="context-item-value"> [RW] </td>
|
143
|
+
<td class="context-item-desc">
|
144
|
+
Potentially useful URLs <a
|
145
|
+
href="http://finance.yahoo.com/q/ae?s=YHOO">finance.yahoo.com/q/ae?s=YHOO</a>
|
146
|
+
<a
|
147
|
+
href="http://biz.yahoo.com/a/ba/a11.html">biz.yahoo.com/a/ba/a11.html</a>
|
148
|
+
<a
|
149
|
+
href="http://www.zacks.com/research/earnings/today_eps.php">www.zacks.com/research/earnings/today_eps.php</a>
|
150
|
+
TODO: Get market cap TODO: Analyze with # of analysts covering TODO: Figure
|
151
|
+
out which metrics most closely follow price increase TODO: Analyze spread
|
152
|
+
between high and low estimate
|
153
|
+
|
154
|
+
</td>
|
155
|
+
</tr>
|
156
|
+
<tr class="top-aligned-row context-row">
|
157
|
+
<td class="context-item-name">ticker</td>
|
158
|
+
<td class="context-item-value"> [RW] </td>
|
159
|
+
<td class="context-item-desc">
|
160
|
+
Potentially useful URLs <a
|
161
|
+
href="http://finance.yahoo.com/q/ae?s=YHOO">finance.yahoo.com/q/ae?s=YHOO</a>
|
162
|
+
<a
|
163
|
+
href="http://biz.yahoo.com/a/ba/a11.html">biz.yahoo.com/a/ba/a11.html</a>
|
164
|
+
<a
|
165
|
+
href="http://www.zacks.com/research/earnings/today_eps.php">www.zacks.com/research/earnings/today_eps.php</a>
|
166
|
+
TODO: Get market cap TODO: Analyze with # of analysts covering TODO: Figure
|
167
|
+
out which metrics most closely follow price increase TODO: Analyze spread
|
168
|
+
between high and low estimate
|
169
|
+
|
170
|
+
</td>
|
171
|
+
</tr>
|
172
|
+
</table>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<!-- if method_list -->
|
179
|
+
<div id="methods">
|
180
|
+
<h3 class="section-bar">Public Class methods</h3>
|
181
|
+
|
182
|
+
<div id="method-M000003" class="method-detail">
|
183
|
+
<a name="M000003"></a>
|
184
|
+
|
185
|
+
<div class="method-heading">
|
186
|
+
<a href="EarningsEstimates.src/M000003.html" target="Code" class="method-signature"
|
187
|
+
onclick="popupCode('EarningsEstimates.src/M000003.html');return false;">
|
188
|
+
<span class="method-name">new</span><span class="method-args">(ticker)</span>
|
189
|
+
</a>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
<div class="method-description">
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
197
|
+
|
198
|
+
<div id="method-M000004" class="method-detail">
|
199
|
+
<a name="M000004"></a>
|
200
|
+
|
201
|
+
<div class="method-heading">
|
202
|
+
<a href="EarningsEstimates.src/M000004.html" target="Code" class="method-signature"
|
203
|
+
onclick="popupCode('EarningsEstimates.src/M000004.html');return false;">
|
204
|
+
<span class="method-name">analyze</span><span class="method-args">()</span>
|
205
|
+
</a>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
<div class="method-description">
|
209
|
+
<p>
|
210
|
+
Analyzes earnings data and gives the security a score.
|
211
|
+
</p>
|
212
|
+
</div>
|
213
|
+
</div>
|
214
|
+
|
215
|
+
<div id="method-M000005" class="method-detail">
|
216
|
+
<a name="M000005"></a>
|
217
|
+
|
218
|
+
<div class="method-heading">
|
219
|
+
<a href="EarningsEstimates.src/M000005.html" target="Code" class="method-signature"
|
220
|
+
onclick="popupCode('EarningsEstimates.src/M000005.html');return false;">
|
221
|
+
<span class="method-name">fetch_earnings_data</span><span class="method-args">()</span>
|
222
|
+
</a>
|
223
|
+
</div>
|
224
|
+
|
225
|
+
<div class="method-description">
|
226
|
+
<p>
|
227
|
+
Retrieves earnings data. Current source is MSN Money. Result is stored in
|
228
|
+
@estimates.
|
229
|
+
</p>
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
|
234
|
+
</div>
|
235
|
+
|
236
|
+
|
237
|
+
</div>
|
238
|
+
|
239
|
+
|
240
|
+
<div id="validator-badges">
|
241
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
242
|
+
</div>
|
243
|
+
|
244
|
+
</body>
|
245
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (EarningsEstimates)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/earnings_estimates.rb, line 20</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">ticker</span>)
|
15
|
+
<span class="ruby-ivar">@ticker</span> = <span class="ruby-identifier">ticker</span>
|
16
|
+
<span class="ruby-ivar">@estimates</span> = {}
|
17
|
+
<span class="ruby-ivar">@analysis</span> = {}
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>analyze (EarningsEstimates)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/earnings_estimates.rb, line 27</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">analyze</span>
|
15
|
+
<span class="ruby-comment cmt">#Score is based on:</span>
|
16
|
+
<span class="ruby-comment cmt"># % of times beating estimates</span>
|
17
|
+
<span class="ruby-comment cmt"># % by which estimates were beat</span>
|
18
|
+
<span class="ruby-comment cmt"># Bonus for upward revisions:</span>
|
19
|
+
<span class="ruby-comment cmt"># 4 points for 7 days</span>
|
20
|
+
<span class="ruby-comment cmt"># 3 points for 30 days</span>
|
21
|
+
<span class="ruby-comment cmt"># 2 points for 60 days</span>
|
22
|
+
<span class="ruby-comment cmt"># 1 point for 90 days</span>
|
23
|
+
<span class="ruby-comment cmt"># Max score is 40</span>
|
24
|
+
<span class="ruby-identifier">percentages</span> = <span class="ruby-identifier">percentages_to_f</span>
|
25
|
+
<span class="ruby-ivar">@analysis</span> = {
|
26
|
+
<span class="ruby-identifier">:average_beating_percentage</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">average_percent_beating</span>(<span class="ruby-identifier">percentages</span>),
|
27
|
+
<span class="ruby-identifier">:beats</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">times_beating_estimates</span>(<span class="ruby-identifier">percentages</span>),
|
28
|
+
<span class="ruby-identifier">:revision_points</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">revision_score</span>,
|
29
|
+
<span class="ruby-identifier">:recently_revised</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">nearest_quarters_upward_revised_recently?</span>
|
30
|
+
}
|
31
|
+
<span class="ruby-keyword kw">end</span></pre>
|
32
|
+
</body>
|
33
|
+
</html>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>fetch_earnings_data (EarningsEstimates)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/earnings_estimates.rb, line 47</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fetch_earnings_data</span>
|
15
|
+
<span class="ruby-identifier">threads</span> = []
|
16
|
+
<span class="ruby-identifier">analysts_covering</span>, <span class="ruby-identifier">earnings_surprise</span>, <span class="ruby-identifier">eps_trend</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>
|
17
|
+
<span class="ruby-identifier">threads</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> { <span class="ruby-identifier">analysts_covering</span> = <span class="ruby-identifier">parse_earnings_table</span>(<span class="ruby-node">"http://moneycentral.msn.com/investor/invsub/analyst/earnest.asp?Symbol=#{@ticker}"</span>) }
|
18
|
+
<span class="ruby-identifier">threads</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> { <span class="ruby-identifier">earnings_surprise</span> = <span class="ruby-identifier">parse_earnings_table</span>(<span class="ruby-node">"http://moneycentral.msn.com/investor/invsub/analyst/earnest.asp?Page=EarningsSurprise&Symbol=#{@ticker}"</span>) }
|
19
|
+
<span class="ruby-identifier">threads</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> { <span class="ruby-identifier">eps_trend</span> = <span class="ruby-identifier">parse_earnings_table</span>(<span class="ruby-node">"http://moneycentral.msn.com/investor/invsub/analyst/earnest.asp?Page=ConsensusEPSTrend&Symbol=#{@ticker}"</span>) }
|
20
|
+
<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">join</span> }
|
21
|
+
<span class="ruby-ivar">@estimates</span>[<span class="ruby-identifier">:analysts_covering</span>], <span class="ruby-ivar">@estimates</span>[<span class="ruby-identifier">:earnings_surprise</span>], <span class="ruby-ivar">@estimates</span>[<span class="ruby-identifier">:eps_trend</span>] = <span class="ruby-identifier">analysts_covering</span>, <span class="ruby-identifier">earnings_surprise</span>, <span class="ruby-identifier">eps_trend</span>
|
22
|
+
<span class="ruby-keyword kw">end</span></pre>
|
23
|
+
</body>
|
24
|
+
</html>
|
data/doc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Thu, 22 Apr 2010 17:49:15 -0600
|
@@ -0,0 +1,101 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: array_extensions.rb</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>array_extensions.rb</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>lib/array_extensions.rb
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Thu Apr 22 12:18:29 -0600 2010</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
</div>
|
74
|
+
|
75
|
+
|
76
|
+
</div>
|
77
|
+
|
78
|
+
|
79
|
+
<!-- if includes -->
|
80
|
+
|
81
|
+
<div id="section">
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if method_list -->
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
<div id="validator-badges">
|
97
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</body>
|
101
|
+
</html>
|
@@ -0,0 +1,112 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: earnings_estimates.rb</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>earnings_estimates.rb</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>lib/earnings_estimates.rb
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Thu Apr 22 17:46:20 -0600 2010</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
|
72
|
+
<div id="requires-list">
|
73
|
+
<h3 class="section-bar">Required files</h3>
|
74
|
+
|
75
|
+
<div class="name-list">
|
76
|
+
rubygems
|
77
|
+
rdoc/rdoc
|
78
|
+
open-uri
|
79
|
+
nokogiri
|
80
|
+
array_extensions
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if includes -->
|
91
|
+
|
92
|
+
<div id="section">
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if method_list -->
|
102
|
+
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
<div id="validator-badges">
|
108
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
</body>
|
112
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Classes
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Classes</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Classes</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/Array.html">Array</a><br />
|
24
|
+
<a href="classes/EarningsEstimates.html">EarningsEstimates</a><br />
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Files
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Files</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Files</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="files/lib/array_extensions_rb.html">lib/array_extensions.rb</a><br />
|
24
|
+
<a href="files/lib/earnings_estimates_rb.html">lib/earnings_estimates.rb</a><br />
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Methods
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Methods</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Methods</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/EarningsEstimates.html#M000004">analyze (EarningsEstimates)</a><br />
|
24
|
+
<a href="classes/Array.html#M000002">average (Array)</a><br />
|
25
|
+
<a href="classes/EarningsEstimates.html#M000005">fetch_earnings_data (EarningsEstimates)</a><br />
|
26
|
+
<a href="classes/EarningsEstimates.html#M000003">new (EarningsEstimates)</a><br />
|
27
|
+
<a href="classes/Array.html#M000001">sum (Array)</a><br />
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</body>
|
31
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
5
|
+
|
6
|
+
<!--
|
7
|
+
|
8
|
+
RDoc Documentation
|
9
|
+
|
10
|
+
-->
|
11
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
12
|
+
<head>
|
13
|
+
<title>RDoc Documentation</title>
|
14
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
15
|
+
</head>
|
16
|
+
<frameset rows="20%, 80%">
|
17
|
+
<frameset cols="25%,35%,45%">
|
18
|
+
<frame src="fr_file_index.html" title="Files" name="Files" />
|
19
|
+
<frame src="fr_class_index.html" name="Classes" />
|
20
|
+
<frame src="fr_method_index.html" name="Methods" />
|
21
|
+
</frameset>
|
22
|
+
<frame src="files/lib/earnings_estimates_rb.html" name="docwin" />
|
23
|
+
</frameset>
|
24
|
+
</html>
|
data/doc/rdoc-style.css
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
|
2
|
+
body {
|
3
|
+
font-family: Verdana,Arial,Helvetica,sans-serif;
|
4
|
+
font-size: 90%;
|
5
|
+
margin: 0;
|
6
|
+
margin-left: 40px;
|
7
|
+
padding: 0;
|
8
|
+
background: white;
|
9
|
+
}
|
10
|
+
|
11
|
+
h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
|
12
|
+
h1 { font-size: 150%; }
|
13
|
+
h2,h3,h4 { margin-top: 1em; }
|
14
|
+
|
15
|
+
a { background: #eef; color: #039; text-decoration: none; }
|
16
|
+
a:hover { background: #039; color: #eef; }
|
17
|
+
|
18
|
+
/* Override the base stylesheet's Anchor inside a table cell */
|
19
|
+
td > a {
|
20
|
+
background: transparent;
|
21
|
+
color: #039;
|
22
|
+
text-decoration: none;
|
23
|
+
}
|
24
|
+
|
25
|
+
/* and inside a section title */
|
26
|
+
.section-title > a {
|
27
|
+
background: transparent;
|
28
|
+
color: #eee;
|
29
|
+
text-decoration: none;
|
30
|
+
}
|
31
|
+
|
32
|
+
/* === Structural elements =================================== */
|
33
|
+
|
34
|
+
div#index {
|
35
|
+
margin: 0;
|
36
|
+
margin-left: -40px;
|
37
|
+
padding: 0;
|
38
|
+
font-size: 90%;
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
div#index a {
|
43
|
+
margin-left: 0.7em;
|
44
|
+
}
|
45
|
+
|
46
|
+
div#index .section-bar {
|
47
|
+
margin-left: 0px;
|
48
|
+
padding-left: 0.7em;
|
49
|
+
background: #ccc;
|
50
|
+
font-size: small;
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
div#classHeader, div#fileHeader {
|
55
|
+
width: auto;
|
56
|
+
color: white;
|
57
|
+
padding: 0.5em 1.5em 0.5em 1.5em;
|
58
|
+
margin: 0;
|
59
|
+
margin-left: -40px;
|
60
|
+
border-bottom: 3px solid #006;
|
61
|
+
}
|
62
|
+
|
63
|
+
div#classHeader a, div#fileHeader a {
|
64
|
+
background: inherit;
|
65
|
+
color: white;
|
66
|
+
}
|
67
|
+
|
68
|
+
div#classHeader td, div#fileHeader td {
|
69
|
+
background: inherit;
|
70
|
+
color: white;
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
div#fileHeader {
|
75
|
+
background: #057;
|
76
|
+
}
|
77
|
+
|
78
|
+
div#classHeader {
|
79
|
+
background: #048;
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
.class-name-in-header {
|
84
|
+
font-size: 180%;
|
85
|
+
font-weight: bold;
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
div#bodyContent {
|
90
|
+
padding: 0 1.5em 0 1.5em;
|
91
|
+
}
|
92
|
+
|
93
|
+
div#description {
|
94
|
+
padding: 0.5em 1.5em;
|
95
|
+
background: #efefef;
|
96
|
+
border: 1px dotted #999;
|
97
|
+
}
|
98
|
+
|
99
|
+
div#description h1,h2,h3,h4,h5,h6 {
|
100
|
+
color: #125;;
|
101
|
+
background: transparent;
|
102
|
+
}
|
103
|
+
|
104
|
+
div#validator-badges {
|
105
|
+
text-align: center;
|
106
|
+
}
|
107
|
+
div#validator-badges img { border: 0; }
|
108
|
+
|
109
|
+
div#copyright {
|
110
|
+
color: #333;
|
111
|
+
background: #efefef;
|
112
|
+
font: 0.75em sans-serif;
|
113
|
+
margin-top: 5em;
|
114
|
+
margin-bottom: 0;
|
115
|
+
padding: 0.5em 2em;
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
/* === Classes =================================== */
|
120
|
+
|
121
|
+
table.header-table {
|
122
|
+
color: white;
|
123
|
+
font-size: small;
|
124
|
+
}
|
125
|
+
|
126
|
+
.type-note {
|
127
|
+
font-size: small;
|
128
|
+
color: #DEDEDE;
|
129
|
+
}
|
130
|
+
|
131
|
+
.xxsection-bar {
|
132
|
+
background: #eee;
|
133
|
+
color: #333;
|
134
|
+
padding: 3px;
|
135
|
+
}
|
136
|
+
|
137
|
+
.section-bar {
|
138
|
+
color: #333;
|
139
|
+
border-bottom: 1px solid #999;
|
140
|
+
margin-left: -20px;
|
141
|
+
}
|
142
|
+
|
143
|
+
|
144
|
+
.section-title {
|
145
|
+
background: #79a;
|
146
|
+
color: #eee;
|
147
|
+
padding: 3px;
|
148
|
+
margin-top: 2em;
|
149
|
+
margin-left: -30px;
|
150
|
+
border: 1px solid #999;
|
151
|
+
}
|
152
|
+
|
153
|
+
.top-aligned-row { vertical-align: top }
|
154
|
+
.bottom-aligned-row { vertical-align: bottom }
|
155
|
+
|
156
|
+
/* --- Context section classes ----------------------- */
|
157
|
+
|
158
|
+
.context-row { }
|
159
|
+
.context-item-name { font-family: monospace; font-weight: bold; color: black; }
|
160
|
+
.context-item-value { font-size: small; color: #448; }
|
161
|
+
.context-item-desc { color: #333; padding-left: 2em; }
|
162
|
+
|
163
|
+
/* --- Method classes -------------------------- */
|
164
|
+
.method-detail {
|
165
|
+
background: #efefef;
|
166
|
+
padding: 0;
|
167
|
+
margin-top: 0.5em;
|
168
|
+
margin-bottom: 1em;
|
169
|
+
border: 1px dotted #ccc;
|
170
|
+
}
|
171
|
+
.method-heading {
|
172
|
+
color: black;
|
173
|
+
background: #ccc;
|
174
|
+
border-bottom: 1px solid #666;
|
175
|
+
padding: 0.2em 0.5em 0 0.5em;
|
176
|
+
}
|
177
|
+
.method-signature { color: black; background: inherit; }
|
178
|
+
.method-name { font-weight: bold; }
|
179
|
+
.method-args { font-style: italic; }
|
180
|
+
.method-description { padding: 0 0.5em 0 0.5em; }
|
181
|
+
|
182
|
+
/* --- Source code sections -------------------- */
|
183
|
+
|
184
|
+
a.source-toggle { font-size: 90%; }
|
185
|
+
div.method-source-code {
|
186
|
+
background: #262626;
|
187
|
+
color: #ffdead;
|
188
|
+
margin: 1em;
|
189
|
+
padding: 0.5em;
|
190
|
+
border: 1px dashed #999;
|
191
|
+
overflow: hidden;
|
192
|
+
}
|
193
|
+
|
194
|
+
div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
195
|
+
|
196
|
+
/* --- Ruby keyword styles --------------------- */
|
197
|
+
|
198
|
+
.standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
|
199
|
+
|
200
|
+
.ruby-constant { color: #7fffd4; background: transparent; }
|
201
|
+
.ruby-keyword { color: #00ffff; background: transparent; }
|
202
|
+
.ruby-ivar { color: #eedd82; background: transparent; }
|
203
|
+
.ruby-operator { color: #00ffee; background: transparent; }
|
204
|
+
.ruby-identifier { color: #ffdead; background: transparent; }
|
205
|
+
.ruby-node { color: #ffa07a; background: transparent; }
|
206
|
+
.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
|
207
|
+
.ruby-regexp { color: #ffa07a; background: transparent; }
|
208
|
+
.ruby-value { color: #7fffd4; background: transparent; }
|
data/earnings_estimates.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{earnings_estimates}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matt White"]
|
12
|
-
s.date = %q{2010-04-
|
12
|
+
s.date = %q{2010-04-22}
|
13
13
|
s.description = %q{Retrieves and analyzes earnings estimates for a given security.}
|
14
14
|
s.email = %q{mattw922@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -23,7 +23,23 @@ Gem::Specification.new do |s|
|
|
23
23
|
"README.rdoc",
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
|
+
"doc/classes/Array.html",
|
27
|
+
"doc/classes/Array.src/M000001.html",
|
28
|
+
"doc/classes/Array.src/M000002.html",
|
29
|
+
"doc/classes/EarningsEstimates.html",
|
30
|
+
"doc/classes/EarningsEstimates.src/M000003.html",
|
31
|
+
"doc/classes/EarningsEstimates.src/M000004.html",
|
32
|
+
"doc/classes/EarningsEstimates.src/M000005.html",
|
33
|
+
"doc/created.rid",
|
34
|
+
"doc/files/lib/array_extensions_rb.html",
|
35
|
+
"doc/files/lib/earnings_estimates_rb.html",
|
36
|
+
"doc/fr_class_index.html",
|
37
|
+
"doc/fr_file_index.html",
|
38
|
+
"doc/fr_method_index.html",
|
39
|
+
"doc/index.html",
|
40
|
+
"doc/rdoc-style.css",
|
26
41
|
"earnings_estimates.gemspec",
|
42
|
+
"lib/array_extensions.rb",
|
27
43
|
"lib/earnings_estimates.rb",
|
28
44
|
"test/helper.rb",
|
29
45
|
"test/test_earnings_estimates.rb"
|
data/lib/earnings_estimates.rb
CHANGED
@@ -1,26 +1,98 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'rdoc/rdoc'
|
2
3
|
require 'open-uri'
|
3
4
|
require 'nokogiri'
|
5
|
+
require 'array_extensions'
|
4
6
|
|
5
7
|
class EarningsEstimates
|
8
|
+
#Potentially useful URLs
|
9
|
+
#http://finance.yahoo.com/q/ae?s=YHOO
|
10
|
+
#http://biz.yahoo.com/a/ba/a11.html
|
11
|
+
#http://www.zacks.com/research/earnings/today_eps.php
|
12
|
+
#TODO: Get market cap
|
13
|
+
#TODO: Analyze with # of analysts covering
|
14
|
+
#TODO: Figure out which metrics most closely follow price increase
|
15
|
+
#TODO: Analyze spread between high and low estimate
|
16
|
+
|
17
|
+
attr_accessor :estimates, :ticker, :analysis
|
18
|
+
MAX_REVISION_SCORE = 4
|
19
|
+
|
6
20
|
def initialize(ticker)
|
7
21
|
@ticker = ticker
|
22
|
+
@estimates = {}
|
23
|
+
@analysis = {}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Analyzes earnings data and gives the security a score.
|
27
|
+
#Score is based on:
|
28
|
+
# * % of times beating estimates
|
29
|
+
# * % by which estimates were beat
|
30
|
+
# * Bonus for upward revisions:
|
31
|
+
# * 4 points for 7 days
|
32
|
+
# * 3 points for 30 days
|
33
|
+
# * 2 points for 60 days
|
34
|
+
# * 1 point for 90 days
|
35
|
+
# Max score is 40
|
36
|
+
def analyze
|
37
|
+
percentages = percentages_to_f
|
38
|
+
@analysis = {
|
39
|
+
:average_beating_percentage => average_percent_beating(percentages),
|
40
|
+
:beats => times_beating_estimates(percentages),
|
41
|
+
:revision_points => revision_score,
|
42
|
+
:recently_revised => nearest_quarters_upward_revised_recently?
|
43
|
+
}
|
8
44
|
end
|
9
45
|
|
46
|
+
# Retrieves earnings data. Current source is MSN Money. Result is stored in @estimates.
|
10
47
|
def fetch_earnings_data
|
11
48
|
threads = []
|
12
|
-
|
13
|
-
threads << Thread.new {
|
14
|
-
threads << Thread.new {
|
15
|
-
threads << Thread.new {
|
49
|
+
analysts_covering, earnings_surprise, eps_trend = nil, nil, nil
|
50
|
+
threads << Thread.new { analysts_covering = parse_earnings_table("http://moneycentral.msn.com/investor/invsub/analyst/earnest.asp?Symbol=#{@ticker}") }
|
51
|
+
threads << Thread.new { earnings_surprise = parse_earnings_table("http://moneycentral.msn.com/investor/invsub/analyst/earnest.asp?Page=EarningsSurprise&Symbol=#{@ticker}") }
|
52
|
+
threads << Thread.new { eps_trend = parse_earnings_table("http://moneycentral.msn.com/investor/invsub/analyst/earnest.asp?Page=ConsensusEPSTrend&Symbol=#{@ticker}") }
|
16
53
|
threads.each { |t| t.join }
|
17
|
-
|
54
|
+
@estimates[:analysts_covering], @estimates[:earnings_surprise], @estimates[:eps_trend] = analysts_covering, earnings_surprise, eps_trend
|
18
55
|
end
|
19
56
|
|
20
57
|
private
|
21
58
|
|
59
|
+
def nearest_quarters_upward_revised_recently?
|
60
|
+
0.upto(1) { |i| @estimates[:eps_trend]["Current Estimate"][i] > @estimates[:eps_trend]["7 Days Ago"][i] }
|
61
|
+
end
|
62
|
+
|
22
63
|
def parse_earnings_table(url)
|
64
|
+
table_hash = {}
|
23
65
|
page = Nokogiri::HTML(open(url))
|
24
|
-
table = page.search("table.t1 tr").inject([]) { |accum, tr| accum << tr.children.map { |child| child.inner_text } }
|
66
|
+
table = page.search("table.t1 tr").inject([]) { |accum, tr| accum << tr.children.map { |child| child.inner_text.strip } }
|
67
|
+
table.each { |row| table_hash[strip_weird_chars(row[0])] = row.slice(1...row.size) }
|
68
|
+
table_hash
|
69
|
+
end
|
70
|
+
|
71
|
+
def strip_weird_chars(header)
|
72
|
+
#Take off all chars at the beginning of the string before the first uppercase char
|
73
|
+
header.gsub(/^[^A-Z0-9]+/, '')
|
74
|
+
end
|
75
|
+
|
76
|
+
def percentages_to_f
|
77
|
+
@estimates[:earnings_surprise]["Change"].map { |ch| ch[/(-?\d\.\d+)/, 1].to_f }
|
78
|
+
end
|
79
|
+
|
80
|
+
def times_beating_estimates(percentages)
|
81
|
+
percentages.inject(0) { |accum, p| accum += p > 0 ? 1 : 0 }
|
82
|
+
end
|
83
|
+
|
84
|
+
def average_percent_beating(percentages)
|
85
|
+
percentages.average
|
86
|
+
end
|
87
|
+
|
88
|
+
def revision_score
|
89
|
+
score = 0
|
90
|
+
0.upto(3) do |i|
|
91
|
+
["7 Days Ago", "30 Days Ago", "60 Days Ago", "90 Days Ago"].each do |period|
|
92
|
+
score += (MAX_REVISION_SCORE - i) if @estimates[:eps_trend]["Current Estimate"][i] > @estimates[:eps_trend][period][i]
|
93
|
+
score -= (MAX_REVISION_SCORE - i) if @estimates[:eps_trend]["Current Estimate"][i] < @estimates[:eps_trend][period][i]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
score
|
25
97
|
end
|
26
98
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matt White
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-22 00:00:00 -06:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -34,7 +34,23 @@ files:
|
|
34
34
|
- README.rdoc
|
35
35
|
- Rakefile
|
36
36
|
- VERSION
|
37
|
+
- doc/classes/Array.html
|
38
|
+
- doc/classes/Array.src/M000001.html
|
39
|
+
- doc/classes/Array.src/M000002.html
|
40
|
+
- doc/classes/EarningsEstimates.html
|
41
|
+
- doc/classes/EarningsEstimates.src/M000003.html
|
42
|
+
- doc/classes/EarningsEstimates.src/M000004.html
|
43
|
+
- doc/classes/EarningsEstimates.src/M000005.html
|
44
|
+
- doc/created.rid
|
45
|
+
- doc/files/lib/array_extensions_rb.html
|
46
|
+
- doc/files/lib/earnings_estimates_rb.html
|
47
|
+
- doc/fr_class_index.html
|
48
|
+
- doc/fr_file_index.html
|
49
|
+
- doc/fr_method_index.html
|
50
|
+
- doc/index.html
|
51
|
+
- doc/rdoc-style.css
|
37
52
|
- earnings_estimates.gemspec
|
53
|
+
- lib/array_extensions.rb
|
38
54
|
- lib/earnings_estimates.rb
|
39
55
|
- test/helper.rb
|
40
56
|
- test/test_earnings_estimates.rb
|