yahoofinance-symbolsuggest 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/README.md +49 -0
- data/Rakefile +5 -0
- data/doc/Gemfile.html +93 -0
- data/doc/Rakefile.html +90 -0
- data/doc/YahooFinance.html +117 -0
- data/doc/YahooFinance/SymbolSuggest.html +580 -0
- data/doc/YahooFinance/SymbolSuggest/YahooSymbolSuggest.html +239 -0
- data/doc/_index.html +125 -0
- data/doc/class_list.html +54 -0
- data/doc/created.rid +5 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +338 -0
- data/doc/file.README.html +132 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +132 -0
- data/doc/js/app.js +219 -0
- data/doc/js/darkfish.js +116 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/js/quicksearch.js +114 -0
- data/doc/js/thickbox-compressed.js +10 -0
- data/doc/lib/yahoofinance-symbolsuggest/version_rb.html +52 -0
- data/doc/lib/yahoofinance-symbolsuggest_rb.html +62 -0
- data/doc/method_list.html +83 -0
- data/doc/rdoc.css +759 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/yahoofinance-symbolsuggest.rb +99 -0
- data/lib/yahoofinance-symbolsuggest/version.rb +5 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/yahoo_finance/symbol_suggest_spec.rb +16 -0
- data/yahoofinance-symbolsuggest.gemspec +22 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d3f570929895f3002b4305c3ff2c8f016c64d60c
|
4
|
+
data.tar.gz: 351137b0a0ec2d6e5e96d8482b96c2cc156d2c22
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4c65ec6eebc93e432ab3426b865f4cb2c81385bfdadbf638297f8b5229c6ee5b5a412e8f3af87bf274a69203ca1dabd1c26f74ea72688f16d9a3eb7fccfb4ec5
|
7
|
+
data.tar.gz: 8691132841aa33666b38857069caf22e508bedd287a607f917e73fcc626f826a53dcbd74ec7cf47be301d071f7b8a261e3ec0efa5fa88da657993d2c5fcf7147
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
Yahoo Finance Symbol-Suggest Gem
|
2
|
+
================================
|
3
|
+
|
4
|
+
This gem wraps a very straightforward function: sending a HTTP GET request to Yahoo Finance web service, answering a prioritised array of stock symbol suggestions.
|
5
|
+
|
6
|
+
For example, Ruby statements:
|
7
|
+
|
8
|
+
require 'rubygems'
|
9
|
+
require 'yahoofinance-symbolsuggest'
|
10
|
+
require 'yaml'
|
11
|
+
y YahooFinance::SymbolSuggest.query("aapl")
|
12
|
+
|
13
|
+
output an array of hashes, in YAML:
|
14
|
+
|
15
|
+
---
|
16
|
+
- symbol: AAPL
|
17
|
+
name: Apple Inc.
|
18
|
+
exch: NMS
|
19
|
+
type: S
|
20
|
+
exchDisp: NASDAQ
|
21
|
+
typeDisp: Equity
|
22
|
+
- symbol: ^AVSPY
|
23
|
+
name: NASDAQ OMX Alpha AAPL vs. SPY I
|
24
|
+
exch: NAS
|
25
|
+
type: I
|
26
|
+
exchDisp: NASDAQ
|
27
|
+
typeDisp: Index
|
28
|
+
- symbol: AAPL.MX
|
29
|
+
name: Apple Inc.
|
30
|
+
exch: MEX
|
31
|
+
type: S
|
32
|
+
exchDisp: Mexico
|
33
|
+
typeDisp: Equity
|
34
|
+
- symbol: AAPL11BF.SA
|
35
|
+
name: APPLE -DRN MB
|
36
|
+
exch: SAO
|
37
|
+
type: S
|
38
|
+
exchDisp: Sao Paolo
|
39
|
+
typeDisp: Equity
|
40
|
+
|
41
|
+
As a gem, the main purpose is to encapsulate all the requirements, assumptions and dependencies in one place: with a Ruby gem. Change the gem __only__ to update all other higher-level software which requires access to Yahoo Finance's symbol suggestions. Hence, the gem fulfils an architectural purpose as much as a functional one. Its simple purpose is to distance Yahoo dependencies from any clients that might want to access symbol-suggestion services. The gem might come to live in the open-source community and be maintained by it, possibly even by Yahoo themselves.
|
42
|
+
|
43
|
+
Installation
|
44
|
+
------------
|
45
|
+
|
46
|
+
Install from the Git repository to your local collection of Ruby gems using:
|
47
|
+
|
48
|
+
rake install
|
49
|
+
|
data/Rakefile
ADDED
data/doc/Gemfile.html
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
+
<head>
|
7
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
8
|
+
|
9
|
+
<title>File: Gemfile [RDoc Documentation]</title>
|
10
|
+
|
11
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
|
12
|
+
|
13
|
+
<script src="./js/jquery.js" type="text/javascript"
|
14
|
+
charset="utf-8"></script>
|
15
|
+
<script src="./js/thickbox-compressed.js" type="text/javascript"
|
16
|
+
charset="utf-8"></script>
|
17
|
+
<script src="./js/quicksearch.js" type="text/javascript"
|
18
|
+
charset="utf-8"></script>
|
19
|
+
<script src="./js/darkfish.js" type="text/javascript"
|
20
|
+
charset="utf-8"></script>
|
21
|
+
</head>
|
22
|
+
|
23
|
+
<body class="file">
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="home-metadata">
|
26
|
+
<div id="home-section" class="section">
|
27
|
+
<h3 class="section-header">
|
28
|
+
<a href="./index.html">Home</a>
|
29
|
+
<a href="./index.html#classes">Classes</a>
|
30
|
+
<a href="./index.html#methods">Methods</a>
|
31
|
+
</h3>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="project-metadata">
|
36
|
+
|
37
|
+
|
38
|
+
<div id="fileindex-section" class="section project-section">
|
39
|
+
<h3 class="section-header">Files</h3>
|
40
|
+
<ul>
|
41
|
+
|
42
|
+
<li class="file"><a href="./Gemfile.html">Gemfile</a></li>
|
43
|
+
|
44
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a></li>
|
45
|
+
|
46
|
+
</ul>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
|
50
|
+
<div id="classindex-section" class="section project-section">
|
51
|
+
<h3 class="section-header">Class Index
|
52
|
+
<span class="search-toggle"><img src="./images/find.png"
|
53
|
+
height="16" width="16" alt="[+]"
|
54
|
+
title="show/hide quicksearch" /></span></h3>
|
55
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
56
|
+
<fieldset>
|
57
|
+
<legend>Quicksearch</legend>
|
58
|
+
<input type="text" name="quicksearch" value=""
|
59
|
+
class="quicksearch-field" />
|
60
|
+
</fieldset>
|
61
|
+
</form>
|
62
|
+
|
63
|
+
<ul class="link-list">
|
64
|
+
|
65
|
+
<li><a href="./YahooFinance.html">YahooFinance</a></li>
|
66
|
+
|
67
|
+
<li><a href="./YahooFinance/SymbolSuggest.html">YahooFinance::SymbolSuggest</a></li>
|
68
|
+
|
69
|
+
</ul>
|
70
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
71
|
+
</div>
|
72
|
+
|
73
|
+
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
<div id="documentation">
|
78
|
+
|
79
|
+
<p>source “<a href="http://rubygems.org">rubygems.org</a>”</p>
|
80
|
+
|
81
|
+
<p># Specify your gem’s dependencies in yahoofinance-symbolsuggest.gemspec
|
82
|
+
gemspec</p>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div id="validator-badges">
|
87
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
88
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
89
|
+
Rdoc Generator</a> 2</small>.</p>
|
90
|
+
</div>
|
91
|
+
</body>
|
92
|
+
</html>
|
93
|
+
|
data/doc/Rakefile.html
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
+
<head>
|
7
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
8
|
+
|
9
|
+
<title>File: Rakefile [RDoc Documentation]</title>
|
10
|
+
|
11
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
|
12
|
+
|
13
|
+
<script src="./js/jquery.js" type="text/javascript"
|
14
|
+
charset="utf-8"></script>
|
15
|
+
<script src="./js/thickbox-compressed.js" type="text/javascript"
|
16
|
+
charset="utf-8"></script>
|
17
|
+
<script src="./js/quicksearch.js" type="text/javascript"
|
18
|
+
charset="utf-8"></script>
|
19
|
+
<script src="./js/darkfish.js" type="text/javascript"
|
20
|
+
charset="utf-8"></script>
|
21
|
+
</head>
|
22
|
+
|
23
|
+
<body class="file">
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="home-metadata">
|
26
|
+
<div id="home-section" class="section">
|
27
|
+
<h3 class="section-header">
|
28
|
+
<a href="./index.html">Home</a>
|
29
|
+
<a href="./index.html#classes">Classes</a>
|
30
|
+
<a href="./index.html#methods">Methods</a>
|
31
|
+
</h3>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="project-metadata">
|
36
|
+
|
37
|
+
|
38
|
+
<div id="fileindex-section" class="section project-section">
|
39
|
+
<h3 class="section-header">Files</h3>
|
40
|
+
<ul>
|
41
|
+
|
42
|
+
<li class="file"><a href="./Gemfile.html">Gemfile</a></li>
|
43
|
+
|
44
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a></li>
|
45
|
+
|
46
|
+
</ul>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
|
50
|
+
<div id="classindex-section" class="section project-section">
|
51
|
+
<h3 class="section-header">Class Index
|
52
|
+
<span class="search-toggle"><img src="./images/find.png"
|
53
|
+
height="16" width="16" alt="[+]"
|
54
|
+
title="show/hide quicksearch" /></span></h3>
|
55
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
56
|
+
<fieldset>
|
57
|
+
<legend>Quicksearch</legend>
|
58
|
+
<input type="text" name="quicksearch" value=""
|
59
|
+
class="quicksearch-field" />
|
60
|
+
</fieldset>
|
61
|
+
</form>
|
62
|
+
|
63
|
+
<ul class="link-list">
|
64
|
+
|
65
|
+
<li><a href="./YahooFinance.html">YahooFinance</a></li>
|
66
|
+
|
67
|
+
<li><a href="./YahooFinance/SymbolSuggest.html">YahooFinance::SymbolSuggest</a></li>
|
68
|
+
|
69
|
+
</ul>
|
70
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
71
|
+
</div>
|
72
|
+
|
73
|
+
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
<div id="documentation">
|
78
|
+
|
79
|
+
<p>require ‘bundler/gem_tasks’</p>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<div id="validator-badges">
|
84
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
85
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
86
|
+
Rdoc Generator</a> 2</small>.</p>
|
87
|
+
</div>
|
88
|
+
</body>
|
89
|
+
</html>
|
90
|
+
|
@@ -0,0 +1,117 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: YahooFinance
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index (Y)</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">YahooFinance</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: YahooFinance
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/yahoofinance-symbolsuggest.rb<span class="defines">,<br />
|
83
|
+
lib/yahoofinance-symbolsuggest/version.rb</span>
|
84
|
+
</dd>
|
85
|
+
|
86
|
+
</dl>
|
87
|
+
<div class="clear"></div>
|
88
|
+
|
89
|
+
<h2>Defined Under Namespace</h2>
|
90
|
+
<p class="children">
|
91
|
+
|
92
|
+
|
93
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="YahooFinance/SymbolSuggest.html" title="YahooFinance::SymbolSuggest (module)">SymbolSuggest</a></span>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
</p>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
<div id="footer">
|
111
|
+
Generated on Sun Feb 9 06:40:06 2014 by
|
112
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
113
|
+
0.8.7.3 (ruby-2.1.0).
|
114
|
+
</div>
|
115
|
+
|
116
|
+
</body>
|
117
|
+
</html>
|
@@ -0,0 +1,580 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: YahooFinance::SymbolSuggest
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (S)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../YahooFinance.html" title="YahooFinance (module)">YahooFinance</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">SymbolSuggest</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: YahooFinance::SymbolSuggest
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/yahoofinance-symbolsuggest.rb<span class="defines">,<br />
|
83
|
+
lib/yahoofinance-symbolsuggest/version.rb</span>
|
84
|
+
</dd>
|
85
|
+
|
86
|
+
</dl>
|
87
|
+
<div class="clear"></div>
|
88
|
+
|
89
|
+
|
90
|
+
<h2>Constant Summary</h2>
|
91
|
+
|
92
|
+
<dl class="constants">
|
93
|
+
|
94
|
+
<dt id="CALLBACK-constant" class="">CALLBACK =
|
95
|
+
<div class="docstring">
|
96
|
+
<div class="discussion">
|
97
|
+
|
98
|
+
<p>This constant is important for two reasons:</p>
|
99
|
+
<ol><li>
|
100
|
+
<p>it appears in the URL query;</p>
|
101
|
+
</li><li>
|
102
|
+
<p>it appears in the JSONP response.</p>
|
103
|
+
</li></ol>
|
104
|
+
|
105
|
+
<p>The URL query string is everything after the question mark. The
|
106
|
+
undocumented non-public interface to Yahoo's symbol-suggest
|
107
|
+
auto-completion services requires two query fields: query and callback,
|
108
|
+
where “query” specifies the symbol on which to base the suggestions, and
|
109
|
+
where “callback” specifies the JavaScript callback function. But note, this
|
110
|
+
callback function cannot have just any name for the Yahoo service to accept
|
111
|
+
the request. It must match this string.</p>
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
<div class="tags">
|
117
|
+
|
118
|
+
|
119
|
+
</div>
|
120
|
+
</dt>
|
121
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>YAHOO.Finance.SymbolSuggest.ssCallback</span><span class='tstring_end'>'</span></span></pre></dd>
|
122
|
+
|
123
|
+
<dt id="VERSION-constant" class="">VERSION =
|
124
|
+
<div class="docstring">
|
125
|
+
<div class="discussion">
|
126
|
+
|
127
|
+
<p>:nodoc:</p>
|
128
|
+
|
129
|
+
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
<div class="tags">
|
133
|
+
|
134
|
+
|
135
|
+
</div>
|
136
|
+
</dt>
|
137
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.1.0</span><span class='tstring_end'>'</span></span></pre></dd>
|
138
|
+
|
139
|
+
</dl>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<h2>
|
150
|
+
Class Method Summary
|
151
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
152
|
+
</h2>
|
153
|
+
|
154
|
+
<ul class="summary">
|
155
|
+
|
156
|
+
<li class="public ">
|
157
|
+
<span class="summary_signature">
|
158
|
+
|
159
|
+
<a href="#query-class_method" title="query (class method)">+ (Object) <strong>query</strong>(symbol) </a>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
</span>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
<span class="summary_desc"><div class='inline'>
|
174
|
+
<p>Queries the given ticker symbol or company name against Yahoo Finance's
|
175
|
+
symbol suggest web service.</p>
|
176
|
+
</div></span>
|
177
|
+
|
178
|
+
</li>
|
179
|
+
|
180
|
+
|
181
|
+
<li class="public ">
|
182
|
+
<span class="summary_signature">
|
183
|
+
|
184
|
+
<a href="#results_from_jsonp-class_method" title="results_from_jsonp (class method)">+ (Object) <strong>results_from_jsonp</strong>(jsonp) </a>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
</span>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
<span class="summary_desc"><div class='inline'>
|
199
|
+
<p>Parses JSONP and extracts the encoded set of results.</p>
|
200
|
+
</div></span>
|
201
|
+
|
202
|
+
</li>
|
203
|
+
|
204
|
+
|
205
|
+
<li class="public ">
|
206
|
+
<span class="summary_signature">
|
207
|
+
|
208
|
+
<a href="#suggestions_from_jsonp-class_method" title="suggestions_from_jsonp (class method)">+ (Object) <strong>suggestions_from_jsonp</strong>(jsonp) </a>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
</span>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
<span class="summary_desc"><div class='inline'>
|
223
|
+
<p>Answers an array of symbol suggestions given some JSONP sent by the Yahoo
|
224
|
+
Finance symbol-suggestion service.</p>
|
225
|
+
</div></span>
|
226
|
+
|
227
|
+
</li>
|
228
|
+
|
229
|
+
|
230
|
+
<li class="public ">
|
231
|
+
<span class="summary_signature">
|
232
|
+
|
233
|
+
<a href="#suggestions_from_results-class_method" title="suggestions_from_results (class method)">+ (Object) <strong>suggestions_from_results</strong>(results) </a>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
</span>
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
<span class="summary_desc"><div class='inline'>
|
248
|
+
<p>Answers an array of hashes representing symbol suggestions given a set of
|
249
|
+
results; in other words, discards the <code>Query</code> key.</p>
|
250
|
+
</div></span>
|
251
|
+
|
252
|
+
</li>
|
253
|
+
|
254
|
+
|
255
|
+
<li class="public ">
|
256
|
+
<span class="summary_signature">
|
257
|
+
|
258
|
+
<a href="#url_from_symbol-class_method" title="url_from_symbol (class method)">+ (Object) <strong>url_from_symbol</strong>(symbol) </a>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
</span>
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
<span class="summary_desc"><div class='inline'>
|
273
|
+
<p>Answers an URL given a ticker symbol or company name; Yahoo Finance matches
|
274
|
+
both simultaneously.</p>
|
275
|
+
</div></span>
|
276
|
+
|
277
|
+
</li>
|
278
|
+
|
279
|
+
|
280
|
+
</ul>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
<div id="class_method_details" class="method_details_list">
|
286
|
+
<h2>Class Method Details</h2>
|
287
|
+
|
288
|
+
|
289
|
+
<div class="method_details first">
|
290
|
+
<h3 class="signature first" id="query-class_method">
|
291
|
+
|
292
|
+
+ (<tt>Object</tt>) <strong>query</strong>(symbol)
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
</h3><div class="docstring">
|
299
|
+
<div class="discussion">
|
300
|
+
|
301
|
+
<p>Queries the given ticker symbol or company name against Yahoo Finance's
|
302
|
+
symbol suggest web service. Answers an array of prioritised suggestions in
|
303
|
+
the form of hashes where each hash has the following keys.</p>
|
304
|
+
<dl class="rdoc-list label-list"><dt>exch
|
305
|
+
<dd>
|
306
|
+
<p>symbol of the exchange, e.g. NYQ for NYSE</p>
|
307
|
+
</dd><dt>exchDisp
|
308
|
+
<dd>
|
309
|
+
<p>display name for the exchange, e.g. “NYSE”</p>
|
310
|
+
</dd><dt>name
|
311
|
+
<dd>
|
312
|
+
<p>name of the company</p>
|
313
|
+
</dd><dt>symbol
|
314
|
+
<dd>
|
315
|
+
<p>ticker symbol</p>
|
316
|
+
</dd><dt>type
|
317
|
+
<dd>
|
318
|
+
<p>type of stock, e.g. S for “Equity”</p>
|
319
|
+
</dd><dt>typeDisp
|
320
|
+
<dd>
|
321
|
+
<p>display type for stock</p>
|
322
|
+
</dd></dl>
|
323
|
+
|
324
|
+
<h2 id="label-Design+Notes">Design Notes</h2>
|
325
|
+
|
326
|
+
<p>The design uses a module-scoped method to wrap the GET request sent to
|
327
|
+
Yahoo Finance, though this may need refactoring at some point in the
|
328
|
+
future. The <code>query</code> method handles the query synchronously,
|
329
|
+
meaning that the caller waits for the response. Future implementations may
|
330
|
+
abstract away the response handling as well as the request handling, in
|
331
|
+
order to support other caller-callee paradigms, including asynchronous
|
332
|
+
ones.</p>
|
333
|
+
|
334
|
+
<p>To facilitate alternative approaches, including asynchronous loading, the
|
335
|
+
design refactors URL-from-symbol and suggestions-from-JSONP behaviour as
|
336
|
+
separate module methods. Hence <code>query</code> is just a convenience
|
337
|
+
method that sends a synchronous HTTP GET request using the Ruby standard
|
338
|
+
library.</p>
|
339
|
+
|
340
|
+
|
341
|
+
</div>
|
342
|
+
</div>
|
343
|
+
<div class="tags">
|
344
|
+
|
345
|
+
|
346
|
+
</div><table class="source_code">
|
347
|
+
<tr>
|
348
|
+
<td>
|
349
|
+
<pre class="lines">
|
350
|
+
|
351
|
+
|
352
|
+
95
|
353
|
+
96
|
354
|
+
97</pre>
|
355
|
+
</td>
|
356
|
+
<td>
|
357
|
+
<pre class="code"><span class="info file"># File 'lib/yahoofinance-symbolsuggest.rb', line 95</span>
|
358
|
+
|
359
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='rparen'>)</span>
|
360
|
+
<span class='id identifier rubyid_suggestions_from_jsonp'>suggestions_from_jsonp</span><span class='lparen'>(</span><span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_url_from_symbol'>url_from_symbol</span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
361
|
+
<span class='kw'>end</span></pre>
|
362
|
+
</td>
|
363
|
+
</tr>
|
364
|
+
</table>
|
365
|
+
</div>
|
366
|
+
|
367
|
+
<div class="method_details ">
|
368
|
+
<h3 class="signature " id="results_from_jsonp-class_method">
|
369
|
+
|
370
|
+
+ (<tt>Object</tt>) <strong>results_from_jsonp</strong>(jsonp)
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
</h3><div class="docstring">
|
377
|
+
<div class="discussion">
|
378
|
+
|
379
|
+
<p>Parses JSONP and extracts the encoded set of results. Answers a hash
|
380
|
+
comprising two keys: <code>Query</code> and <code>Result</code>. The
|
381
|
+
<code>Query</code> value is the original query string. The
|
382
|
+
<code>Result</code> value is an array of hashes, the results proper. Each
|
383
|
+
hash has keys describing the symbol suggestion, including
|
384
|
+
<code>symbol</code> for the ticker symbol, <code>name</code> for the name
|
385
|
+
of the company, etc. See query method.</p>
|
386
|
+
|
387
|
+
|
388
|
+
</div>
|
389
|
+
</div>
|
390
|
+
<div class="tags">
|
391
|
+
|
392
|
+
|
393
|
+
</div><table class="source_code">
|
394
|
+
<tr>
|
395
|
+
<td>
|
396
|
+
<pre class="lines">
|
397
|
+
|
398
|
+
|
399
|
+
43
|
400
|
+
44
|
401
|
+
45
|
402
|
+
46
|
403
|
+
47
|
404
|
+
48
|
405
|
+
49
|
406
|
+
50
|
407
|
+
51
|
408
|
+
52
|
409
|
+
53
|
410
|
+
54
|
411
|
+
55
|
412
|
+
56</pre>
|
413
|
+
</td>
|
414
|
+
<td>
|
415
|
+
<pre class="code"><span class="info file"># File 'lib/yahoofinance-symbolsuggest.rb', line 43</span>
|
416
|
+
|
417
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_results_from_jsonp'>results_from_jsonp</span><span class='lparen'>(</span><span class='id identifier rubyid_jsonp'>jsonp</span><span class='rparen'>)</span>
|
418
|
+
<span class='comment'># The answer from the GET request to Yahoo Finance's symbol-suggest
|
419
|
+
</span> <span class='comment'># service is a piece of JSONP: JSON with padding, where the padding is the
|
420
|
+
</span> <span class='comment'># callback function. The following padding parser utilises Ruby 1.9 String
|
421
|
+
</span> <span class='comment'># methods. Is that a good thing? It makes the implementation dependent on
|
422
|
+
</span> <span class='comment'># 1.9.
|
423
|
+
</span> <span class='id identifier rubyid_prefix'>prefix</span> <span class='op'>=</span> <span class='const'>CALLBACK</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(</span><span class='tstring_end'>'</span></span>
|
424
|
+
<span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>)</span><span class='tstring_end'>'</span></span>
|
425
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_jsonp'>jsonp</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='id identifier rubyid_prefix'>prefix</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_jsonp'>jsonp</span><span class='period'>.</span><span class='id identifier rubyid_end_with?'>end_with?</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span><span class='rparen'>)</span>
|
426
|
+
<span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_jsonp'>jsonp</span><span class='lbracket'>[</span><span class='id identifier rubyid_prefix'>prefix</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='comma'>,</span> <span class='id identifier rubyid_jsonp'>jsonp</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>-</span> <span class='id identifier rubyid_prefix'>prefix</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>-</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ResultSet</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
427
|
+
<span class='kw'>else</span>
|
428
|
+
<span class='kw'>nil</span>
|
429
|
+
<span class='kw'>end</span>
|
430
|
+
<span class='kw'>end</span></pre>
|
431
|
+
</td>
|
432
|
+
</tr>
|
433
|
+
</table>
|
434
|
+
</div>
|
435
|
+
|
436
|
+
<div class="method_details ">
|
437
|
+
<h3 class="signature " id="suggestions_from_jsonp-class_method">
|
438
|
+
|
439
|
+
+ (<tt>Object</tt>) <strong>suggestions_from_jsonp</strong>(jsonp)
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
</h3><div class="docstring">
|
446
|
+
<div class="discussion">
|
447
|
+
|
448
|
+
<p>Answers an array of symbol suggestions given some JSONP sent by the Yahoo
|
449
|
+
Finance symbol-suggestion service.</p>
|
450
|
+
|
451
|
+
|
452
|
+
</div>
|
453
|
+
</div>
|
454
|
+
<div class="tags">
|
455
|
+
|
456
|
+
|
457
|
+
</div><table class="source_code">
|
458
|
+
<tr>
|
459
|
+
<td>
|
460
|
+
<pre class="lines">
|
461
|
+
|
462
|
+
|
463
|
+
67
|
464
|
+
68
|
465
|
+
69</pre>
|
466
|
+
</td>
|
467
|
+
<td>
|
468
|
+
<pre class="code"><span class="info file"># File 'lib/yahoofinance-symbolsuggest.rb', line 67</span>
|
469
|
+
|
470
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_suggestions_from_jsonp'>suggestions_from_jsonp</span><span class='lparen'>(</span><span class='id identifier rubyid_jsonp'>jsonp</span><span class='rparen'>)</span>
|
471
|
+
<span class='id identifier rubyid_suggestions_from_results'>suggestions_from_results</span><span class='lparen'>(</span><span class='id identifier rubyid_results_from_jsonp'>results_from_jsonp</span><span class='lparen'>(</span><span class='id identifier rubyid_jsonp'>jsonp</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
472
|
+
<span class='kw'>end</span></pre>
|
473
|
+
</td>
|
474
|
+
</tr>
|
475
|
+
</table>
|
476
|
+
</div>
|
477
|
+
|
478
|
+
<div class="method_details ">
|
479
|
+
<h3 class="signature " id="suggestions_from_results-class_method">
|
480
|
+
|
481
|
+
+ (<tt>Object</tt>) <strong>suggestions_from_results</strong>(results)
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
</h3><div class="docstring">
|
488
|
+
<div class="discussion">
|
489
|
+
|
490
|
+
<p>Answers an array of hashes representing symbol suggestions given a set of
|
491
|
+
results; in other words, discards the <code>Query</code> key. The results
|
492
|
+
argument typically comes from the results_from_jsonp method.</p>
|
493
|
+
|
494
|
+
|
495
|
+
</div>
|
496
|
+
</div>
|
497
|
+
<div class="tags">
|
498
|
+
|
499
|
+
|
500
|
+
</div><table class="source_code">
|
501
|
+
<tr>
|
502
|
+
<td>
|
503
|
+
<pre class="lines">
|
504
|
+
|
505
|
+
|
506
|
+
61
|
507
|
+
62
|
508
|
+
63</pre>
|
509
|
+
</td>
|
510
|
+
<td>
|
511
|
+
<pre class="code"><span class="info file"># File 'lib/yahoofinance-symbolsuggest.rb', line 61</span>
|
512
|
+
|
513
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_suggestions_from_results'>suggestions_from_results</span><span class='lparen'>(</span><span class='id identifier rubyid_results'>results</span><span class='rparen'>)</span>
|
514
|
+
<span class='id identifier rubyid_results'>results</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Result</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
515
|
+
<span class='kw'>end</span></pre>
|
516
|
+
</td>
|
517
|
+
</tr>
|
518
|
+
</table>
|
519
|
+
</div>
|
520
|
+
|
521
|
+
<div class="method_details ">
|
522
|
+
<h3 class="signature " id="url_from_symbol-class_method">
|
523
|
+
|
524
|
+
+ (<tt>Object</tt>) <strong>url_from_symbol</strong>(symbol)
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
</h3><div class="docstring">
|
531
|
+
<div class="discussion">
|
532
|
+
|
533
|
+
<p>Answers an URL given a ticker symbol or company name; Yahoo Finance matches
|
534
|
+
both simultaneously. Send an HTTP GET request to this URL and Yahoo will
|
535
|
+
reply with a padded JSON response containing some useful suggestions for
|
536
|
+
matching companies. Use suggestions_from_jsonp to decode the response.</p>
|
537
|
+
|
538
|
+
|
539
|
+
</div>
|
540
|
+
</div>
|
541
|
+
<div class="tags">
|
542
|
+
|
543
|
+
|
544
|
+
</div><table class="source_code">
|
545
|
+
<tr>
|
546
|
+
<td>
|
547
|
+
<pre class="lines">
|
548
|
+
|
549
|
+
|
550
|
+
31
|
551
|
+
32
|
552
|
+
33
|
553
|
+
34
|
554
|
+
35</pre>
|
555
|
+
</td>
|
556
|
+
<td>
|
557
|
+
<pre class="code"><span class="info file"># File 'lib/yahoofinance-symbolsuggest.rb', line 31</span>
|
558
|
+
|
559
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_url_from_symbol'>url_from_symbol</span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='rparen'>)</span>
|
560
|
+
<span class='comment'># Escape the query string using CGI rather than URI because URI fails to
|
561
|
+
</span> <span class='comment'># encode ampersands.
|
562
|
+
</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>http://d.yimg.com/aq/autoc?query=</span><span class='embexpr_beg'>#{</span><span class='const'>CGI</span><span class='period'>.</span><span class='id identifier rubyid_escape'>escape</span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>&callback=</span><span class='embexpr_beg'>#{</span><span class='const'>CALLBACK</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
563
|
+
<span class='kw'>end</span></pre>
|
564
|
+
</td>
|
565
|
+
</tr>
|
566
|
+
</table>
|
567
|
+
</div>
|
568
|
+
|
569
|
+
</div>
|
570
|
+
|
571
|
+
</div>
|
572
|
+
|
573
|
+
<div id="footer">
|
574
|
+
Generated on Sun Feb 9 06:40:06 2014 by
|
575
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
576
|
+
0.8.7.3 (ruby-2.1.0).
|
577
|
+
</div>
|
578
|
+
|
579
|
+
</body>
|
580
|
+
</html>
|