Class: Excoin::Market::Exchange::Order

Inherits:
Object
  • Object
show all
Defined in:
lib/exchange/order.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(order_data) ⇒ Order

Returns a new instance of Order.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/exchange/order.rb', line 5

def initialize(order_data)
  begin
    @currency = order_data['currency']
    @commodity = order_data['commodity']
    @type = order_data['type']
    @price = BigDecimal.new(order_data['price'])
    @commodity_amount = BigDecimal.new(order_data['commodity_amount'])
    @currency_amount = BigDecimal.new(order_data['currency_amount'])
  rescue
    puts "Error in Excoin::Market::Exchange::Order.initialize"
    puts order_data
  end
end

Instance Attribute Details

#commodityObject (readonly)

Returns the value of attribute commodity.



2
3
4
# File 'lib/exchange/order.rb', line 2

def commodity
  @commodity
end

#commodity_amountObject (readonly)

Returns the value of attribute commodity_amount.



2
3
4
# File 'lib/exchange/order.rb', line 2

def commodity_amount
  @commodity_amount
end

#currencyObject (readonly)

Returns the value of attribute currency.



2
3
4
# File 'lib/exchange/order.rb', line 2

def currency
  @currency
end

#currency_amountObject (readonly)

Returns the value of attribute currency_amount.



2
3
4
# File 'lib/exchange/order.rb', line 2

def currency_amount
  @currency_amount
end

#priceObject (readonly)

Returns the value of attribute price.



2
3
4
# File 'lib/exchange/order.rb', line 2

def price
  @price
end

#typeObject (readonly)

Returns the value of attribute type.



2
3
4
# File 'lib/exchange/order.rb', line 2

def type
  @type
end

Instance Method Details

#exchangeObject



19
20
21
# File 'lib/exchange/order.rb', line 19

def exchange
  return Excoin.market.exchange(@currency + @commodity)
end