Class: Bitstamp::Orders
Instance Attribute Summary
Attributes inherited from Collection
#access_token, #model, #module, #name, #path
Instance Method Summary
collapse
Methods inherited from Collection
#find, #initialize, #update
Instance Method Details
#all(options = {}) ⇒ Object
3
4
5
|
# 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 = {}) ⇒ Object
17
18
19
20
|
# File 'lib/bitstamp/orders.rb', line 17
def buy(options = {})
options.merge!({type: Bitstamp::Order::BUY})
self.create options
end
|
#create(options = {}) ⇒ Object
7
8
9
10
|
# 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
|
#sell(options = {}) ⇒ Object
12
13
14
15
|
# File 'lib/bitstamp/orders.rb', line 12
def sell(options = {})
options.merge!({type: Bitstamp::Order::SELL})
self.create options
end
|