module Bitstamp

Public Class Methods

balance() click to toggle source
# File lib/bitstamp.rb, line 60
def self.balance
  self.sanity_check!

  JSON.parse Bitstamp::Net.post('/balance').body
end
bitcoin_deposit_address() click to toggle source
# File lib/bitstamp.rb, line 78
def self.bitcoin_deposit_address
  # returns the deposit address
  self.sanity_check!
  return Bitstamp::Net.post('/bitcoin_deposit_address').body
end
configured?() click to toggle source
# File lib/bitstamp.rb, line 101
def self.configured?
  self.key && self.secret && self.client_id
end
nonce_parameter() click to toggle source
# File lib/bitstamp.rb, line 39
def self.nonce_parameter
  return self.nonce_parameter_generator.call if nonce_parameter_generator
  (Time.now.to_f*10000).to_i.to_s
end
order_book() click to toggle source
# File lib/bitstamp.rb, line 93
def self.order_book
  return JSON.parse Bitstamp::Net.get('/order_book/').body
end
orders() click to toggle source
# File lib/bitstamp.rb, line 44
def self.orders
  self.sanity_check!

  @@orders ||= Bitstamp::Orders.new
end
sanity_check!() click to toggle source
# File lib/bitstamp.rb, line 105
def self.sanity_check!
  unless configured?
    raise MissingConfigExeception.new("Bitstamp Gem not properly configured")
  end
end
setup() { |self| ... } click to toggle source
# File lib/bitstamp.rb, line 97
def self.setup
  yield self
end
ticker() click to toggle source
# File lib/bitstamp.rb, line 89
def self.ticker
  return Bitstamp::Ticker.from_api
end
transactions() click to toggle source
# File lib/bitstamp.rb, line 56
def self.transactions
  return Bitstamp::Transactions.from_api
end
unconfirmed_user_deposits() click to toggle source
# File lib/bitstamp.rb, line 84
def self.unconfirmed_user_deposits
  self.sanity_check!
  return JSON.parse Bitstamp::Net.post("/unconfirmed_btc").body
end
user_transactions() click to toggle source
# File lib/bitstamp.rb, line 50
def self.user_transactions
  self.sanity_check!

  @@transactions ||= Bitstamp::UserTransactions.new
end
withdraw_bitcoins(options = {}) click to toggle source
# File lib/bitstamp.rb, line 66
def self.withdraw_bitcoins(options = {})
  self.sanity_check!
  if options[:amount].nil? || options[:address].nil?
    raise MissingConfigExeception.new("Required parameters not supplied, :amount, :address")
  end
  response_body = Bitstamp::Net.post('/bitcoin_withdrawal',options).body
  if response_body != 'true'
    return JSON.parse response_body
  else
    return response_body
  end
end