Class: Medici::Historical
- Inherits:
-
Object
- Object
- Medici::Historical
- Defined in:
- lib/medici/historical.rb
Constant Summary collapse
- API_BASE_URL =
'http://www.google.com/finance/historical?'
Instance Attribute Summary collapse
-
#close ⇒ Object
readonly
Returns the value of attribute close.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#high ⇒ Object
readonly
Returns the value of attribute high.
-
#low ⇒ Object
readonly
Returns the value of attribute low.
-
#open ⇒ Object
readonly
Returns the value of attribute open.
-
#volume ⇒ Object
readonly
Returns the value of attribute volume.
Class Method Summary collapse
Instance Attribute Details
#close ⇒ Object (readonly)
Returns the value of attribute close.
8 9 10 |
# File 'lib/medici/historical.rb', line 8 def close @close end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
8 9 10 |
# File 'lib/medici/historical.rb', line 8 def date @date end |
#high ⇒ Object (readonly)
Returns the value of attribute high.
8 9 10 |
# File 'lib/medici/historical.rb', line 8 def high @high end |
#low ⇒ Object (readonly)
Returns the value of attribute low.
8 9 10 |
# File 'lib/medici/historical.rb', line 8 def low @low end |
#open ⇒ Object (readonly)
Returns the value of attribute open.
8 9 10 |
# File 'lib/medici/historical.rb', line 8 def open @open end |
#volume ⇒ Object (readonly)
Returns the value of attribute volume.
8 9 10 |
# File 'lib/medici/historical.rb', line 8 def volume @volume end |
Class Method Details
.quote(symbol, start_date = nil, end_date = nil) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/medici/historical.rb', line 10 def self.quote(symbol, start_date = nil, end_date = nil) request = self.build_request(symbol, start_date, end_date) response = Net::HTTP.get_response(URI.parse(request)) raise HistoricalDataError if response.code != '200' self.parse(response.body) end |