Class: Excoin::Account::Trade
- Inherits:
-
Object
- Object
- Excoin::Account::Trade
- Defined in:
- lib/account/trade.rb
Instance Attribute Summary collapse
-
#commodity ⇒ Object
readonly
Returns the value of attribute commodity.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#fee ⇒ Object
readonly
Returns the value of attribute fee.
-
#net_received ⇒ Object
readonly
Returns the value of attribute net_received.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#received ⇒ Object
readonly
Returns the value of attribute received.
-
#sent ⇒ Object
readonly
Returns the value of attribute sent.
-
#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.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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 |
Instance Attribute Details
#commodity ⇒ Object (readonly)
Returns the value of attribute commodity.
2 3 4 |
# File 'lib/account/trade.rb', line 2 def commodity @commodity end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
2 3 4 |
# File 'lib/account/trade.rb', line 2 def currency @currency end |
#fee ⇒ Object (readonly)
Returns the value of attribute fee.
2 3 4 |
# File 'lib/account/trade.rb', line 2 def fee @fee end |
#net_received ⇒ Object (readonly)
Returns the value of attribute net_received.
2 3 4 |
# File 'lib/account/trade.rb', line 2 def net_received @net_received end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
2 3 4 |
# File 'lib/account/trade.rb', line 2 def price @price end |
#received ⇒ Object (readonly)
Returns the value of attribute received.
2 3 4 |
# File 'lib/account/trade.rb', line 2 def received @received end |
#sent ⇒ Object (readonly)
Returns the value of attribute sent.
2 3 4 |
# File 'lib/account/trade.rb', line 2 def sent @sent end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
2 3 4 |
# File 'lib/account/trade.rb', line 2 def @timestamp end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
2 3 4 |
# File 'lib/account/trade.rb', line 2 def type @type end |