module Stocks

Provides an interface to do real-time analysis of stocks.

Author

Matt Fornaciari (mattforni@gmail.com)

License

MIT

Author

Matt Fornaciari (mattforni@gmail.com)

License

MIT

Public Class Methods

exists!(symbol) click to toggle source

Raises an exception if the provided symbol does not exist.

Args
  • symbol The symbol to evaluate for existence

Raises
  • RetrievalError If the provided symbol does not exist

# File lib/stocks.rb, line 35
def self.exists!(symbol)
  raise RetrievalError.new(symbol) if !Stocks.exists?(symbol)
end
exists?(symbol) click to toggle source

Determines whether or not the provided symbol exists.

Args
  • symbol The symbol to evaluate for existence

Returns

Whether or not the provided symbol exists

# File lib/stocks.rb, line 24
def self.exists?(symbol)
  symbol.upcase!
  EXISTS_CACHE.fetch(symbol) { !Quote.get(symbol)[symbol][:date].nil? }
end