Skip to content

Commit

Permalink
Bistamp => Bitstamp. Adden cancel order method
Browse files Browse the repository at this point in the history
  • Loading branch information
stygeo committed Jun 12, 2013
1 parent 0297df9 commit 0cf709d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bitstamp/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def create(options = {})
end

def find(id, options = {})
Bitstamp::Helper.parse_object! Bistamp::Net::get("#{self.path}/#{id}").body_str, self.model
Bitstamp::Helper.parse_object! Bitstamp::Net::get("#{self.path}/#{id}").body_str, self.model
end

def update(id, options = {})
Expand Down
11 changes: 11 additions & 0 deletions lib/bitstamp/orders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ def buy(options = {})
options.merge!({type: Bitstamp::Order::BUY})
self.create options
end

def find(order_id)
all = self.all
index = all.index {|order| order.id.to_i == order_id}

return all[index] if index
end
end

class Order < Bitstamp::Model
Expand All @@ -26,5 +33,9 @@ class Order < Bitstamp::Model

attr_accessor :type, :amount, :price, :id, :datetime
attr_accessor :error, :message

def cancel!
Bitstamp::Net::post('/cancel_order', {id: self.id}).body_str
end
end
end

0 comments on commit 0cf709d

Please sign in to comment.