Method: Bitcoin::Trade.new_from_object

Defined in:
lib/bitcoin/trade.rb

.new_from_object(symbol_name, data) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/bitcoin/trade.rb', line 15

def self.new_from_object(symbol_name, data)
  t = Bitcoin::Trade.new
  t.id = data['id']
  t.price = data['price'].to_f
  t.quantity = data['quantity'].to_f
  t.side = data['side']
  t.timestamp = Time.parse(data['timestamp'])
  t.symbol = symbol_name
  t
end