Class: MtgoxOrder
- Inherits:
-
Object
- Object
- MtgoxOrder
- Defined in:
- lib/mtgox_order.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#buy_or_sell ⇒ Object
Returns the value of attribute buy_or_sell.
-
#order_id ⇒ Object
Returns the value of attribute order_id.
-
#price ⇒ Object
Returns the value of attribute price.
-
#time ⇒ Object
Returns the value of attribute time.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
3 4 5 |
# File 'lib/mtgox_order.rb', line 3 def amount @amount end |
#buy_or_sell ⇒ Object
Returns the value of attribute buy_or_sell.
3 4 5 |
# File 'lib/mtgox_order.rb', line 3 def buy_or_sell @buy_or_sell end |
#order_id ⇒ Object
Returns the value of attribute order_id.
3 4 5 |
# File 'lib/mtgox_order.rb', line 3 def order_id @order_id end |
#price ⇒ Object
Returns the value of attribute price.
3 4 5 |
# File 'lib/mtgox_order.rb', line 3 def price @price end |
#time ⇒ Object
Returns the value of attribute time.
3 4 5 |
# File 'lib/mtgox_order.rb', line 3 def time @time end |
Class Method Details
.from_json(json) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/mtgox_order.rb', line 13 def self.from_json(json) order = self.new order.amount = json["amount"].to_f order.order_id = json["tid"] order.price = json["price"].to_f order.time = Time.at(json["date"].to_i) return order end |
Instance Method Details
#buy? ⇒ Boolean
5 6 7 |
# File 'lib/mtgox_order.rb', line 5 def buy? self.buy_or_sell == :buy end |
#sell? ⇒ Boolean
9 10 11 |
# File 'lib/mtgox_order.rb', line 9 def sell? self.buy_or_sell == :sell end |