class Bitso::Orders
Public Instance Methods
all(options = {})
click to toggle source
# File lib/bitso/orders.rb, line 3 def all(options = {}) Bitso::Helper.parse_objects! Bitso::Net::post('/open_orders').to_str, self.model end
buy(options = {})
click to toggle source
# File lib/bitso/orders.rb, line 17 def buy(options = {}) options.merge!({type: Bitso::Order::BUY}) self.create options end
create(options = {})
click to toggle source
# File lib/bitso/orders.rb, line 7 def create(options = {}) path = (options[:type] == Bitso::Order::SELL ? "/sell" : "/buy") Bitso::Helper.parse_object! Bitso::Net::post(path, options).to_str, self.model end
find(order_id)
click to toggle source
# File lib/bitso/orders.rb, line 22 def find(order_id) all = self.all index = all.index {|order| order.id.to_i == order_id} return all[index] if index end
sell(options = {})
click to toggle source
# File lib/bitso/orders.rb, line 12 def sell(options = {}) options.merge!({type: Bitso::Order::SELL}) self.create options end