class Bitstamp::Orders
Public Instance Methods
all(options = {})
click to toggle source
# File lib/bitstamp/orders.rb, line 3 def all(options = {}) Bitstamp::Helper.parse_objects! Bitstamp::Net::post('/open_orders').body_str, self.model end
buy(options = {})
click to toggle source
# File lib/bitstamp/orders.rb, line 17 def buy(options = {}) options.merge!({type: Bitstamp::Order::BUY}) self.create options end
create(options = {})
click to toggle source
# File lib/bitstamp/orders.rb, line 7 def create(options = {}) path = (options[:type] == Bitstamp::Order::SELL ? "/sell" : "/buy") Bitstamp::Helper.parse_object! Bitstamp::Net::post(path, options).body_str, self.model end
find(order_id)
click to toggle source
# File lib/bitstamp/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/bitstamp/orders.rb, line 12 def sell(options = {}) options.merge!({type: Bitstamp::Order::SELL}) self.create options end