Sha256: 61158effe76c83ab0a70184b1a678b72be3733608ad2ab1e3db934f57dd43945

Contents?: true

Size: 471 Bytes

Versions: 7

Compression:

Stored size: 471 Bytes

Contents

# frozen_string_literal: true

module Alpaca
  module Trade
    module Api
      class Bar
        attr_reader :time, :open, :high, :low, :close, :volume

        def initialize(json)
          @time = Time.at(json['t'])
          @open = BigDecimal(json['o'].to_s)
          @high = BigDecimal(json['h'].to_s)
          @low = BigDecimal(json['l'].to_s)
          @close = BigDecimal(json['c'].to_s)
          @volume = json['v']
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
alpaca-trade-api-0.8.0 lib/alpaca/trade/api/bar.rb
alpaca-trade-api-0.7.0 lib/alpaca/trade/api/bar.rb
alpaca-trade-api-0.6.0 lib/alpaca/trade/api/bar.rb
alpaca-trade-api-0.5.0 lib/alpaca/trade/api/bar.rb
alpaca-trade-api-0.4.1 lib/alpaca/trade/api/bar.rb
alpaca-trade-api-0.4.0 lib/alpaca/trade/api/bar.rb
alpaca-trade-api-0.3.0 lib/alpaca/trade/api/bar.rb