Module: IEX::Endpoints::Ohlc

Included in:
Api::Client
Defined in:
lib/iex/endpoints/ohlc.rb

Instance Method Summary collapse

Instance Method Details

#market(options = {}) ⇒ Object



10
11
12
13
14
# File 'lib/iex/endpoints/ohlc.rb', line 10

def market(options = {})
  Hash[get('stock/market/ohlc', { token: publishable_token }.merge(options)).map do |k, v|
    [k, IEX::Resources::OHLC.new(v)]
  end]
end

#ohlc(symbol, options = {}) ⇒ Object



4
5
6
7
8
# File 'lib/iex/endpoints/ohlc.rb', line 4

def ohlc(symbol, options = {})
  IEX::Resources::OHLC.new(get("stock/#{symbol}/ohlc", { token: publishable_token }.merge(options)))
rescue Faraday::ResourceNotFound => e
  raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
end