Class: Excoin::Market::Exchange::Trade
- Inherits:
-
Object
- Object
- Excoin::Market::Exchange::Trade
- Defined in:
- lib/exchange/trade.rb
Instance Attribute Summary collapse
-
#commodity ⇒ Object
readonly
Returns the value of attribute commodity.
-
#commodity_amount ⇒ Object
readonly
Returns the value of attribute commodity_amount.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#currency_amount ⇒ Object
readonly
Returns the value of attribute currency_amount.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #exchange ⇒ Object
-
#initialize(trade_data) ⇒ Trade
constructor
A new instance of Trade.
Constructor Details
#initialize(trade_data) ⇒ Trade
Returns a new instance of Trade.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# 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 |
Instance Attribute Details
#commodity ⇒ Object (readonly)
Returns the value of attribute commodity.
2 3 4 |
# File 'lib/exchange/trade.rb', line 2 def commodity @commodity end |
#commodity_amount ⇒ Object (readonly)
Returns the value of attribute commodity_amount.
2 3 4 |
# File 'lib/exchange/trade.rb', line 2 def commodity_amount @commodity_amount end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
2 3 4 |
# File 'lib/exchange/trade.rb', line 2 def currency @currency end |
#currency_amount ⇒ Object (readonly)
Returns the value of attribute currency_amount.
2 3 4 |
# File 'lib/exchange/trade.rb', line 2 def currency_amount @currency_amount end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
2 3 4 |
# File 'lib/exchange/trade.rb', line 2 def price @price end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
2 3 4 |
# File 'lib/exchange/trade.rb', line 2 def @timestamp end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
2 3 4 |
# File 'lib/exchange/trade.rb', line 2 def type @type end |