Sha256: 1618388c0abeeadd8b36937f5852a50216e63d6d431134b02f6b2aa0569275a9

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

require 'ib-ruby/models/model'

module IB
  module Models
    # This is a single data point delivered by HistoricData messages.
    # Instantiate with a Hash of attributes, to be auto-set via initialize in Model.
    class Bar < Model
      prop :time, # The date-time stamp of the start of the bar. The format is
           #        determined by the reqHistoricalData() formatDate parameter.
           :open, #   The bar opening price.
           :high, #   The high price during the time covered by the bar.
           :low, #    The low price during the time covered by the bar.
           :close, #  The bar closing price.
           :volume, # The bar opening price.
           :wap, #    Weighted average price during the time covered by the bar.
           :has_gaps, # Whether or not there are gaps in the data.
           :trades # int: When TRADES data history is returned, represents number
                   # of trades that occurred during the time period the bar covers

      def to_s
        "<Bar #{time}: wap: #{wap}, OHLC: #{open}, #{high}, #{low}, #{close}, " +
            (trades ? "trades: #{trades}," : "") + " vol: #{volume}, gaps? #{has_gaps}>"
      end
    end # class Bar
  end # module Models
end # module IB

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ib-ruby-0.7.4 lib/ib-ruby/models/bar.rb
ib-ruby-0.7.3 lib/ib-ruby/models/bar.rb
ib-ruby-0.7.2 lib/ib-ruby/models/bar.rb
ib-ruby-0.7.0 lib/ib-ruby/models/bar.rb
ib-ruby-0.6.1 lib/ib-ruby/models/bar.rb