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
.balance ⇒ Object
60
61
62
63
64
|
# File 'lib/bitstamp.rb', line 60
def self.balance
self.sanity_check!
JSON.parse Bitstamp::Net.post('/balance').body
end
|
.bitcoin_deposit_address ⇒ Object
78
79
80
81
82
|
# File 'lib/bitstamp.rb', line 78
def self.bitcoin_deposit_address
self.sanity_check!
return Bitstamp::Net.post('/bitcoin_deposit_address').body
end
|
101
102
103
|
# File 'lib/bitstamp.rb', line 101
def self.configured?
self.key && self.secret && self.client_id
end
|
.nonce_parameter ⇒ Object
39
40
41
42
|
# 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 ⇒ Object
93
94
95
|
# File 'lib/bitstamp.rb', line 93
def self.order_book
return JSON.parse Bitstamp::Net.get('/order_book/').body
end
|
.orders ⇒ Object
44
45
46
47
48
|
# File 'lib/bitstamp.rb', line 44
def self.orders
self.sanity_check!
@@orders ||= Bitstamp::Orders.new
end
|
.sanity_check! ⇒ Object
105
106
107
108
109
|
# File 'lib/bitstamp.rb', line 105
def self.sanity_check!
unless configured?
raise MissingConfigExeception.new("Bitstamp Gem not properly configured")
end
end
|
.setup {|_self| ... } ⇒ Object
97
98
99
|
# File 'lib/bitstamp.rb', line 97
def self.setup
yield self
end
|
.unconfirmed_user_deposits ⇒ Object
84
85
86
87
|
# 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 ⇒ Object
50
51
52
53
54
|
# File 'lib/bitstamp.rb', line 50
def self.user_transactions
self.sanity_check!
@@transactions ||= Bitstamp::UserTransactions.new
end
|
.withdraw_bitcoins(options = {}) ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
|
# 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
|