Sha256: 5e72d00f0866cd952bbcdbe52b37c1dad311604d8ac166a91dc153e640aa7cb7

Contents?: true

Size: 596 Bytes

Versions: 4

Compression:

Stored size: 596 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_int,
          type: map_type,
          price: map_decimal,
          amount: map_decimal
        }
      end

      setup_readers
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bitstampede-0.1.2 lib/bitstampede/entities/order.rb
bitstampede-0.1.1 lib/bitstampede/entities/order.rb
bitstampede-0.1.0 lib/bitstampede/entities/order.rb
bitstampede-0.0.1 lib/bitstampede/entities/order.rb