Skip to content

Commit

Permalink
Merge pull request kojnapp#4 from colinreidbrown/depth_chart
Browse files Browse the repository at this point in the history
added the transactions api depth chart
  • Loading branch information
stygeo committed Nov 9, 2013
2 parents dbf1deb + 06dffdd commit 4ebd2e6
Show file tree
Hide file tree
Showing 4 changed files with 268 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 @@ -41,6 +41,10 @@ def self.user_transactions
@@transactions ||= Bitstamp::UserTransactions.new
end

def self.transactions
return Bitstamp::Transactions.from_api
end

def self.balance
self.sanity_check!

Expand Down
10 changes: 10 additions & 0 deletions lib/bitstamp/transactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,14 @@ def update(options={})
class UserTransaction < Bitstamp::Model
attr_accessor :datetime, :id, :type, :usd, :btc, :fee, :order_id, :btc_usd
end

# adding in methods to pull the last public trades list
class Transactions < Bitstamp::Model
attr_accessor :date, :price, :tid, :amount

def self.from_api
Bitstamp::Helper.parse_objects! Bitstamp::Net::get("/transactions").body_str, self
end

end
end
244 changes: 244 additions & 0 deletions spec/fixtures/vcr_cassettes/bitstamp/transactions.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions spec/transactions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@
end

end

describe Bitstamp::Transactions do
before { setup_bitstamp }

describe :all, vcr:{cassette_name: 'bitstamp/transactions'} do
subject { Bitstamp.transactions }
it { should be_kind_of Array }
end

end

0 comments on commit 4ebd2e6

Please sign in to comment.