Sha256: 3e6768f7897fba846763ce2d5b91d5b2f10f722854574cecbc47deae0febb392

Contents?: true

Size: 597 Bytes

Versions: 7

Compression:

Stored size: 597 Bytes

Contents

require_relative './base'

module Bitstampede
  module Entities
    class Order < Base
      class InvalidTypeError < StandardError; end

      def self.map_type
        ->(val) do
          case val.to_s
          when '0'
            :buy
          when '1'
            :sell
          else
            raise InvalidTypeError
          end
        end
      end

      def self.mappings
        {
          id: map_int,
          datetime: map_time,
          type: map_type,
          price: map_decimal,
          amount: map_decimal
        }
      end

      setup_readers
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bitstampede-0.1.9 lib/bitstampede/entities/order.rb
bitstampede-0.1.8 lib/bitstampede/entities/order.rb
bitstampede-0.1.7 lib/bitstampede/entities/order.rb
bitstampede-0.1.6 lib/bitstampede/entities/order.rb
bitstampede-0.1.5 lib/bitstampede/entities/order.rb
bitstampede-0.1.4 lib/bitstampede/entities/order.rb
bitstampede-0.1.3 lib/bitstampede/entities/order.rb