class Excoin::Account::Trade

Attributes

commodity[R]
currency[R]
fee[R]
net_received[R]
price[R]
received[R]
sent[R]
timestamp[R]
type[R]

Public Class Methods

new(trade_data) click to toggle source
# File lib/account/trade.rb, line 5
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'])
    @sent = BigDecimal.new(trade_data['sent'])
    @received = BigDecimal.new(trade_data['received'])
    @fee = BigDecimal.new(trade_data['fee'])
    @net_received = BigDecimal.new(trade_data['net_received'])
  rescue
    puts "Error in Excoin::Account::Trade.initialize"
    puts trade_data
  end
end

Public Instance Methods

exchange() click to toggle source
# File lib/account/trade.rb, line 22
def exchange
  Excoin.market.exchange(@currency + @commodity)
end