Sha256: 6a310f3f904ace96c233ae498839a5b2accf492b221eb4042db1d817824eba11

Contents?: true

Size: 1.46 KB

Versions: 2

Compression:

Stored size: 1.46 KB

Contents

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

      class Default < Base
        property 'open'
        property 'close'
        property 'unadjusted_volume', from: 'unadjustedVolume'
        property 'change'
        property 'change_percent', from: 'changePercent'
        property 'change_percent_s', from: 'changePercent', with: lambda { |v|
          [
            v > 0 ? '+' : '',
            format('%.2f', v),
            '%'
          ].join
        } # change in percent as a String with a leading + or - sign
        property 'vwap'
      end

      class OneDay < Base
        property 'minute'
        property 'market_average', from: 'marketAverage'
        property 'market_notional', from: 'marketNotional'
        property 'market_number_of_trades', from: 'marketNumberOfTrades'
        property 'market_high', from: 'marketHigh'
        property 'market_low', from: 'marketLow'
        property 'market_volume', from: 'marketVolume'
        property 'market_change_over_time', from: 'marketChangeOverTime'
        property 'average'
        property 'notional'
        property 'number_of_trades', from: 'numberOfTrades'
        property 'simplify_factor', from: 'simplifyFactor'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iex-ruby-client-1.0.1 lib/iex/resources/chart.rb
iex-ruby-client-1.0.0 lib/iex/resources/chart.rb