Skip to content

Commit

Permalink
Merge pull request kojnapp#1 from epscylonb/add-balances
Browse files Browse the repository at this point in the history
added order_book method
  • Loading branch information
stygeo committed Jun 23, 2013
2 parents 9484503 + f4a4cd0 commit 0e9c3da
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/bitstamp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def self.ticker
return Bitstamp::Ticker.from_api
end

def self.order_book
return JSON.parse Bitstamp::Net.post('/order_book/').body_str
end

def self.setup
yield self
end
Expand Down
12 changes: 12 additions & 0 deletions spec/bitstamp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,16 @@

Bitstamp.balance.should be_kind_of Hash
end

it 'should have a order_book method' do
Bitstamp.order_book.should be_kind_of Hash
end

it 'should have bids and asks in the order_book' do
order_book = Bitstamp.order_book
order_book.should have_key("asks")
order_book.should have_key("bids")
order_book["asks"].should be_kind_of Array
order_book["bids"].should be_kind_of Array
end
end

0 comments on commit 0e9c3da

Please sign in to comment.