class Market::Exchange::Trade
Attributes
commodity[R]
commodity_amount[R]
currency[R]
currency_amount[R]
price[R]
timestamp[R]
type[R]
Public Class Methods
new(trade_data)
click to toggle source
# File lib/exchange/trade.rb, line 6 def initialize(trade_data) begin @timestamp = Time.parse(trade_data['timestamp']) @currency = trade_data['currency'] @commodity = trade_data['commodity'] @type = trade_data['type'] @price = BigDecimal.new(trade_data['price']) @commodity_amount = BigDecimal.new(trade_data['commodity_amount']) @currency_amount = BigDecimal.new(trade_data['currency_amount']) rescue puts "Error in Excoin::Market::Exchange::Trade.initialize" puts trade_data end end
Public Instance Methods
exchange()
click to toggle source
# File lib/exchange/trade.rb, line 21 def exchange Excoin.market.exchange(@currency + @commodity) end