Class: MtgoxOrder

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



3
4
5
# File 'lib/mtgox_order.rb', line 3

def amount
  @amount
end

#buy_or_sellObject

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_idObject

Returns the value of attribute order_id.



3
4
5
# File 'lib/mtgox_order.rb', line 3

def order_id
  @order_id
end

#priceObject

Returns the value of attribute price.



3
4
5
# File 'lib/mtgox_order.rb', line 3

def price
  @price
end

#timeObject

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

Returns:

  • (Boolean)


5
6
7
# File 'lib/mtgox_order.rb', line 5

def buy?
	self.buy_or_sell == :buy
end

#sell?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/mtgox_order.rb', line 9

def sell?
	self.buy_or_sell == :sell
end