Class: MtGox::OrderResult

Inherits:
Object
  • Object
show all
Includes:
Value
Defined in:
lib/mtgox/order_result.rb

Constant Summary

Constants included from Value

Value::INT_MULTIPLIERS

Instance Method Summary collapse

Methods included from Value

#decimalify, #intify, #value_bitcoin, #value_currency

Constructor Details

#initialize(json) ⇒ OrderResult

Returns a new instance of OrderResult.



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

def initialize(json)
  @json = json
end

Instance Method Details

#avg_costObject



25
26
27
# File 'lib/mtgox/order_result.rb', line 25

def avg_cost
  to_decimal "avg_cost", @json
end

#idObject



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

def id
  @json["order_id"]
end

#total_amountObject



21
22
23
# File 'lib/mtgox/order_result.rb', line 21

def total_amount
  to_decimal "total_amount", @json
end

#total_spentObject



17
18
19
# File 'lib/mtgox/order_result.rb', line 17

def total_spent
  to_decimal "total_spent", @json
end

#tradesObject



13
14
15
# File 'lib/mtgox/order_result.rb', line 13

def trades
  @json["trades"].map{|t| Trade.new(coerce_trade(t)) }
end