yahoo_finance_2 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +218 -0
  3. metadata +122 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b52929bca6aeb2d0f0584573088d698676f494ba
4
+ data.tar.gz: 9ee94fbf1c5e7db78320dddf6ab9b1e22dffdef7
5
+ SHA512:
6
+ metadata.gz: a84d5802639e1df00858c5e07258f657710de0e02fa48215a184e2261e1777ac68cdd6934474270818d7fe1ebde8d9cfcc10a05697a395c68d2ad9c68516ad68
7
+ data.tar.gz: 18ea881e5827986723ef13c9d2bb129fd81379e087fe76a9cce183f7bd39ea737999be2a748c1d0909dbf4bfdd860e107ed063573e5ccc1d294c44dbe54db472
data/README.md ADDED
@@ -0,0 +1,218 @@
1
+ # yahoo_finance
2
+
3
+ A ruby gem that retrieves real-time stock quotes and historical pricing from ~~google~~ yahoo.
4
+
5
+ # Update
6
+
7
+ On November 1, 2013, Google discontinued iGoogle, which contained the api endpoint yahoo_finance utilized, rendering the gem inoperable.
8
+
9
+ As of November 2nd, 2013, the yahoo_finance gem has been rebuilt to use the Yahoo finance api, starting with version 1.1.0. All applications leveraging this gem should update to 1.1.0 to resume operation. The gem methods are the same, but responses have been modified to leverage the new api. Documentation has been updated to reflect these changes.
10
+
11
+ ## Installation
12
+
13
+ To install the 'yahoo_finance' ruby gem:
14
+
15
+ `gem install yahoo_finance`
16
+
17
+ ## Gem Configuration
18
+
19
+ To use the gem in your Rails Application, include it:
20
+
21
+ ### Rails 2+
22
+
23
+ Include the gem in config/environments.rb:
24
+
25
+ `config.gem "yahoo_finance"`
26
+
27
+ ### Rails 3+
28
+
29
+ Include the gem in your Gemfile:
30
+
31
+ `gem "yahoo_finance"`
32
+
33
+ ## Usage
34
+
35
+ ### YahooFinance::Stock.quote("symbol")
36
+
37
+ You can get a current quote with the following syntax:
38
+
39
+ `stock = YahooFinance::Stock.quote("symbol")`
40
+
41
+ Where symbol equals the company stock symbol you want a quote for. For example, "aapl" for Apple, Inc.
42
+
43
+ You may search for multiple stocks by separating symbols with a comma. For example:
44
+
45
+ `stocks = YahooFinance::Stock.quote("aapl,tsla")`
46
+
47
+ Or as an array.
48
+
49
+ `stocks = YahooFinance::Stock.quote(["aapl", "tsla"])`
50
+
51
+ These queries will return a Stock object or an array of Stock objects which you may iterate through. Each stock object has the following values:
52
+
53
+ * symbol
54
+ * ask
55
+ * average_daily_volume
56
+ * bid
57
+ * ask_realtime
58
+ * bid_realtime
59
+ * book_value
60
+ * change_percent_change
61
+ * change
62
+ * commission
63
+ * change_realtime
64
+ * after_hours_change_realtime
65
+ * dividend_share
66
+ * last_trade_date
67
+ * trade_date
68
+ * earnings_share
69
+ * eps_estimate_current_year
70
+ * eps_estimate_next_year
71
+ * eps_estimate_next_quarter
72
+ * days_low
73
+ * days_high
74
+ * year_low
75
+ * year_high
76
+ * holdings_gain_percent
77
+ * annualized_gain
78
+ * holdings_gain
79
+ * holdings_gain_percent_realtime
80
+ * holdings_gain_realtime
81
+ * more_info
82
+ * order_book_realtime
83
+ * market_capitalization
84
+ * market_cap_realtime
85
+ * ebitda
86
+ * change_from_year_low
87
+ * percent_change_from_year_low
88
+ * last_trade_realtime_with_time
89
+ * change_percent_realtime
90
+ * change_from_year_high
91
+ * percebt_change_from_year_high
92
+ * last_trade_with_time
93
+ * last_trade_price_only
94
+ * high_limit
95
+ * low_limit
96
+ * days_range
97
+ * days_range_realtime
98
+ * fiftyday_moving_average
99
+ * two_hundredday_moving_average
100
+ * change_from_two_hundredday_moving_average
101
+ * percent_change_from_two_hundredday_moving_average
102
+ * change_from_fiftyday_moving_average
103
+ * percent_change_from_fiftyday_moving_average
104
+ * name
105
+ * notes
106
+ * open
107
+ * previous_close
108
+ * price_paid
109
+ * changein_percent
110
+ * price_sales
111
+ * price_book
112
+ * ex_dividend_date
113
+ * pe_ratio
114
+ * dividend_pay_date
115
+ * pe_ratio_realtime
116
+ * peg_ratio
117
+ * price_eps_estimate_current_year
118
+ * price_eps_estimate_next_year
119
+ * symbol
120
+ * shares_owned
121
+ * short_ratio
122
+ * last_trade_time
123
+ * ticker_trend
124
+ * oneyr_target_price
125
+ * volume
126
+ * holdings_value
127
+ * holdings_value_realtime
128
+ * year_range
129
+ * days_value_change
130
+ * days_value_change_realtime
131
+ * stock_exchange
132
+ * dividend_yield
133
+ * percent_change",
134
+
135
+ ### YahooFinance::Stock.history(symbol, start_date, end_date)
136
+
137
+ YahooFinance::Stock.history(symbol, start_date, end_date) is as alias to YahooFinance::Stock.quote(symbol, start_date, end_date).
138
+
139
+ If you pass quote a start_date and end_date it will do a historical query within the date range as opposed to a realtime quote. Only one stock symbol should be used for historical quotes.
140
+
141
+ Historical queries provide an array of Price objects with the following values:
142
+
143
+ * symbol
144
+ * date
145
+ * open
146
+ * high
147
+ * low
148
+ * close
149
+ * volume
150
+
151
+ ## Values
152
+
153
+ Values may be accessed off the Stock or Price object like so:
154
+
155
+ `YahooFinance::Stock.quote("SYMBOL").last`
156
+
157
+ Or:
158
+
159
+ `stock = YahooFinance::Stock.quote("SYMBOL")`
160
+
161
+ `stock.last`
162
+
163
+ You can always convert the queries results to json with the following commands:
164
+
165
+ `YahooFinance::Stock.quote("SYMBOL").to_json`
166
+
167
+ Or:
168
+
169
+ `YahooFinance::Stock.history("SYMBOL").to_json`
170
+
171
+
172
+ ## Response Codes
173
+
174
+ Stock instances now include a response_code: 200 and 404.
175
+
176
+ > @stock = YahooFinance::Stock.quote('aapl')
177
+ > @stock.response_code
178
+ => 200
179
+
180
+ Additionally, stock instances now have a success? and failure? method.
181
+
182
+ > @stock.success?
183
+ => true
184
+
185
+ In the event that a stock symbol is incorrect, the returned instance will provide a response code of 404 and respond in the affirmative to a failure? method call.
186
+
187
+ > @stock = YahooFinance::Stock.quote('asdf')
188
+ > @stock.response_code
189
+ => 404
190
+ > @stock.failure?
191
+ => true
192
+
193
+ ## Special thanks to
194
+
195
+ ...~~Google~~ Yahoo for making this api publicly available.
196
+
197
+ ## License
198
+
199
+ Copyright (c) 2011 Ty Rauber
200
+
201
+ Permission is hereby granted, free of charge, to any person obtaining a copy
202
+ of this software and associated documentation files (the "Software"), to deal
203
+ in the Software without restriction, including without limitation the rights
204
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
205
+ copies of the Software, and to permit persons to whom the Software is
206
+ furnished to do so, subject to the following conditions:
207
+
208
+ The above copyright notice and this permission notice shall be included in
209
+ all copies or substantial portions of the Software.
210
+
211
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
212
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
213
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
214
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
215
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
216
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
217
+ THE SOFTWARE.
218
+
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yahoo_finance_2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Adamson, Ty Rauber
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: fakeweb
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: vcr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Retrieve up to 100 stock quotes per query with the following variables
84
+ - symbol, pretty_symbol, symbol_lookup_url, company, exchange, exchange_timezone,
85
+ exchange_utc_offset, exchange_closing, divisor, currency, last, high, low, volume,
86
+ avg_volume, market_cap, open, y_close, change, perc_change, delay, trade_timestamp,
87
+ trade_date_utc, trade_time_utc, current_date_utc, current_time_utc, symbol_url,
88
+ chart_url, disclaimer_url, ecn_url, isld_last, isld_trade_date_utc, isld_trade_time_utc,
89
+ brut_last, brut_trade_date_utc, brut_trade_time_utc and daylight_savings - per stock.
90
+ Extended for use with keystats and stocks Yahoo tables. Will upgrade it for use
91
+ with Yahoo options tables soon.
92
+ email:
93
+ - aadamson@stanford.edu
94
+ executables: []
95
+ extensions: []
96
+ extra_rdoc_files: []
97
+ files:
98
+ - README.md
99
+ homepage: https://github.com/aadamson/yahoo_finance
100
+ licenses: []
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 2.0.6
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: A ruby gem that retrieves real-time stock quotes from google.
122
+ test_files: []