module Bitstamp
Public Class Methods
balance(currency_pair = "btcusd")
click to toggle source
# File lib/bitstamp.rb, line 50 def self.balance(currency_pair = "btcusd") self.sanity_check! path = currency_pair ? "/v2/balance/#{currency_pair}" : "/v2/balance" JSON.parse Bitstamp::Net.post(path).to_str end
bitcoin_deposit_address()
click to toggle source
# File lib/bitstamp.rb, line 73 def self.bitcoin_deposit_address # returns the deposit address self.sanity_check! return Bitstamp::Net.post('/bitcoin_deposit_address').to_str end
configured?()
click to toggle source
# File lib/bitstamp.rb, line 96 def self.configured? self.key && self.secret && self.client_id end
create_withdrawal(options = {})
click to toggle source
# File lib/bitstamp.rb, line 56 def self.create_withdrawal(options = {}) self.sanity_check! Bitstamp::Withdrawals.new.create(options) end
order_book(currency_pair = "btcusd")
click to toggle source
# File lib/bitstamp.rb, line 88 def self.order_book(currency_pair = "btcusd") return JSON.parse Bitstamp::Net.get("/v2/order_book/#{currency_pair}").to_str end
orders()
click to toggle source
# File lib/bitstamp.rb, line 34 def self.orders self.sanity_check! @@orders ||= Bitstamp::Orders.new end
sanity_check!()
click to toggle source
# File lib/bitstamp.rb, line 100 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 92 def self.setup yield self end
ticker(currency_pair = "btcusd")
click to toggle source
# File lib/bitstamp.rb, line 84 def self.ticker(currency_pair = "btcusd") return Bitstamp::Ticker.from_api(currency_pair) end
transactions(currency_pair = "btcusd")
click to toggle source
# File lib/bitstamp.rb, line 46 def self.transactions(currency_pair = "btcusd") return Bitstamp::Transactions.from_api(currency_pair) end
unconfirmed_user_deposits()
click to toggle source
# File lib/bitstamp.rb, line 79 def self.unconfirmed_user_deposits self.sanity_check! return JSON.parse Bitstamp::Net::post("/unconfirmed_btc").to_str end
user_transactions()
click to toggle source
# File lib/bitstamp.rb, line 40 def self.user_transactions self.sanity_check! @@transactions ||= Bitstamp::UserTransactions.new end
withdraw_bitcoins(options = {})
click to toggle source
# File lib/bitstamp.rb, line 61 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).to_str if response_body != 'true' return JSON.parse response_body else return response_body end end