Sha256: 7c4d8643a8ac11ac7bb30ef8cb4173ec2a8d50243844c4ba717f014bc2a7eedf

Contents?: true

Size: 969 Bytes

Versions: 25

Compression:

Stored size: 969 Bytes

Contents

module IB
  module Messages
    module Incoming

      # Called Error in Java code, but in fact this type of messages also
      # deliver system alerts and additional (non-error) info from TWS.
      ErrorMessage = Error = Alert = def_message([4, 2],
                                                 [:error_id, :int],
                                                 [:code, :int],
                                                 [:message, :string])
      class Alert
        # Is it an Error message?
        def error?
          code < 1000
        end

        # Is it a System message?
        def system?
          code > 1000 && code < 2000
        end

        # Is it a Warning message?
        def warning?
          code > 2000
        end

        def to_human
          "TWS #{ error? ? 'Error' : system? ? 'System' : 'Warning'} #{code}: #{message}"
        end
      end # class Alert

    end # module Incoming
  end # module Messages
end # module IB

Version data entries

25 entries across 25 versions & 3 rubygems

Version Path
ib-api-972.5 lib/ib/messages/incoming/alert.rb
ib-api-972.4 lib/ib/messages/incoming/alert.rb
ib-api-972.3.1 lib/ib/messages/incoming/alert.rb
ib-api-972.3 lib/ib/messages/incoming/alert.rb
ib-api-972.2 lib/ib/messages/incoming/alert.rb
my-ib-api-0.0.4 lib/ib/messages/incoming/alert.rb
my-ib-api-0.0.3 lib/ib/messages/incoming/alert.rb
ib-api-972.1 lib/ib/messages/incoming/alert.rb
my-ib-api-0.0.2 lib/ib/messages/incoming/alert.rb
my-ib-api-0.0.1 lib/ib/messages/incoming/alert.rb
ib-api-972.0 lib/ib/messages/incoming/alert.rb
ib-ruby-0.9.2 lib/ib/messages/incoming/alert.rb
ib-ruby-0.9.1 lib/ib/messages/incoming/alert.rb
ib-ruby-0.9.0 lib/ib/messages/incoming/alert.rb
ib-ruby-0.8.5 lib/ib/messages/incoming/alert.rb
ib-ruby-0.8.4 lib/ib/messages/incoming/alert.rb
ib-ruby-0.8.3 lib/ib/messages/incoming/alert.rb
ib-ruby-0.8.1 lib/ib-ruby/messages/incoming/alert.rb
ib-ruby-0.8.0 lib/ib-ruby/messages/incoming/alert.rb
ib-ruby-0.7.12 lib/ib-ruby/messages/incoming/alert.rb