lib/bitcoin/order_book.rb in bitcoin-api-0.1.0 vs lib/bitcoin/order_book.rb in bitcoin-api-0.1.1
- old
+ new
@@ -1,9 +1,19 @@
class Bitcoin::OrderBook
attr_accessor :side, :price, :size, :timestamp, :limit, :symbol
+ def display_details
+ puts <<-DOC
+ #{@symbol} #{@side.upcase} Order:
+ #{@price}
+ Quantity: #{@size}
+ #{@timestamp}
+
+ DOC
+ end
+
def self.new_from_object(object)
o = Bitcoin::OrderBook.new
o.size = object['size'].to_f
o.side = object[:side]
o.price = object['price'].to_f
@@ -32,15 +42,7 @@
[ask_orders, bid_orders].flatten!.map{|order|
Bitcoin::OrderBook.new_from_object(order)
}
end
- def display_details
- puts <<-DOC
- #{@symbol} #{@side.upcase} Order:
- #{@price}
- Quantity: #{@size}
- #{@timestamp}
- DOC
- end
end