Sha256: a46e6b2b112d498e5df54e5d7605cd14a27a04466b78404e0e8607c53334d5ea

Contents?: true

Size: 746 Bytes

Versions: 5

Compression:

Stored size: 746 Bytes

Contents

require_relative 'base'
require_relative 'chart/base'
require_relative 'chart/one_day'
require_relative 'chart/default'

module IEX
  module Resources
    module Chart
      def self.get(stock_symbol, range = nil, options = {})
        IEX::Resources::Base.symbol(stock_symbol) do
          response = IEX::Api::Chart.get(stock_symbol, range, options)
          if range && range.to_s == 'dynamic'
            range = response['range']
            response = response['data']
          end
          response.map do |data|
            case range
            when '1d', Date, DateTime
              Chart::OneDay.new data
            else
              Chart::Default.new data
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
iex-ruby-client-0.4.4 lib/iex/resources/chart.rb
iex-ruby-client-0.4.3 lib/iex/resources/chart.rb
iex-ruby-client-0.4.2 lib/iex/resources/chart.rb
iex-ruby-client-0.4.1 lib/iex/resources/chart.rb
iex-ruby-client-0.4.0 lib/iex/resources/chart.rb