Class: Medici::Historical

Inherits:
Object
  • Object
show all
Defined in:
lib/medici/historical.rb

Constant Summary collapse

API_BASE_URL =
'http://www.google.com/finance/historical?'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#closeObject (readonly)

Returns the value of attribute close.



8
9
10
# File 'lib/medici/historical.rb', line 8

def close
  @close
end

#dateObject (readonly)

Returns the value of attribute date.



8
9
10
# File 'lib/medici/historical.rb', line 8

def date
  @date
end

#highObject (readonly)

Returns the value of attribute high.



8
9
10
# File 'lib/medici/historical.rb', line 8

def high
  @high
end

#lowObject (readonly)

Returns the value of attribute low.



8
9
10
# File 'lib/medici/historical.rb', line 8

def low
  @low
end

#openObject (readonly)

Returns the value of attribute open.



8
9
10
# File 'lib/medici/historical.rb', line 8

def open
  @open
end

#volumeObject (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