Sha256: 7afa4274c8d5a8a358d50a3e8aeacf275987f5b143849337563b406587befde9

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

module IEX
  module Resources
    module Chart
      class Base < Resource
        property 'high'
        property 'low'
        property 'volume'
        property 'open'
        property 'close'
        property 'label'
        property 'date', transform_with: ->(v) { Date.parse(v) }
      end

      class Default < Base
        property 'u_high', from: 'uHigh'
        property 'u_low', from: 'uLow'
        property 'u_volume', from: 'uVolume'
        property 'u_open', from: 'uOpen'
        property 'u_close', from: 'uClose'
        property 'change'
        property 'change_percent', from: 'changePercent'
        property 'change_percent_s', from: 'changePercent', with: lambda { |v|
          [
            v.positive? ? '+' : '',
            format('%.2f', v),
            '%'
          ].join
        } # change in percent as a String with a leading + or - sign
        property 'change_over_time', from: 'changeOverTime'
      end

      class OneDay < Base
        property 'minute'
        property 'average'
        property 'notional'
        property 'number_of_trades', from: 'numberOfTrades'
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
iex-ruby-client-2.1.0 lib/iex/resources/chart.rb
iex-ruby-client-2.0.0 lib/iex/resources/chart.rb
iex-ruby-client-1.6.0 lib/iex/resources/chart.rb
iex-ruby-client-1.5.0 lib/iex/resources/chart.rb
iex-ruby-client-1.4.1 lib/iex/resources/chart.rb
iex-ruby-client-1.4.0 lib/iex/resources/chart.rb
iex-ruby-client-1.3.0 lib/iex/resources/chart.rb
iex-ruby-client-1.2.0 lib/iex/resources/chart.rb
iex-ruby-client-1.1.2 lib/iex/resources/chart.rb
iex-ruby-client-1.1.1 lib/iex/resources/chart.rb