Module: Bitstamp

Defined in:
lib/bitstamp.rb,
lib/bitstamp/net.rb,
lib/bitstamp/model.rb,
lib/bitstamp/helper.rb,
lib/bitstamp/orders.rb,
lib/bitstamp/ticker.rb,
lib/bitstamp/collection.rb,
lib/bitstamp/transactions.rb

Defined Under Namespace

Modules: Helper, Net Classes: Collection, MissingConfigExeception, Model, Order, Orders, Ticker, Transactions, UserTransaction, UserTransactions

Constant Summary collapse

@@currency =
:usd

Class Method Summary collapse

Class Method Details

.balanceObject



48
49
50
51
52
# File 'lib/bitstamp.rb', line 48

def self.balance
  self.sanity_check!

  JSON.parse Bitstamp::Net.post('/balance').body_str
end

.configured?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/bitstamp.rb', line 66

def self.configured?
  self.key && self.secret && self.client_id
end

.order_bookObject



58
59
60
# File 'lib/bitstamp.rb', line 58

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

.ordersObject



32
33
34
35
36
# File 'lib/bitstamp.rb', line 32

def self.orders
  self.sanity_check!

  @@orders ||= Bitstamp::Orders.new
end

.sanity_check!Object



70
71
72
73
74
# File 'lib/bitstamp.rb', line 70

def self.sanity_check!
  unless configured?
    raise MissingConfigExeception.new("Bitstamp Gem not properly configured")
  end
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Bitstamp)

    the object that the method was called on



62
63
64
# File 'lib/bitstamp.rb', line 62

def self.setup
  yield self
end

.tickerObject



54
55
56
# File 'lib/bitstamp.rb', line 54

def self.ticker
  return Bitstamp::Ticker.from_api
end

.transactionsObject



44
45
46
# File 'lib/bitstamp.rb', line 44

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

.user_transactionsObject



38
39
40
41
42
# File 'lib/bitstamp.rb', line 38

def self.user_transactions
  self.sanity_check!

  @@transactions ||= Bitstamp::UserTransactions.new
end