module Bitstamper::Rest::Private::Withdrawals

Public Instance Methods

bank_withdrawal_status(id) click to toggle source
# File lib/bitstamper/rest/private/withdrawals.rb, line 38
def bank_withdrawal_status(id)
  check_credentials!
  
  response    =   post("/v2/withdrawal/status", data: {id: id})
end
cancel_bank_withdrawal(id) click to toggle source
# File lib/bitstamper/rest/private/withdrawals.rb, line 44
def cancel_bank_withdrawal(id)
  check_credentials!
  
  response    =   post("/v2/withdrawal/cancel", data: {id: id})
end
withdraw(currency, address:, amount:, instant: nil) click to toggle source
# File lib/bitstamper/rest/private/withdrawals.rb, line 6
def withdraw(currency, address:, amount:, instant: nil)
  check_credentials!
  
  currency    =   currency.to_s.downcase
  
  if !::Bitstamper::Constants::AVAILABLE_CRYPTOS.include?(currency)
    raise ::Bitstamper::Errors::InvalidCurrencyError.new("#{currency} is not a tradeable crypto currency on Bitstamp.")
  end
  
  path        =   currency.eql?("btc") ? "/bitcoin_withdrawal" : "/v2/#{currency}_withdrawal"
  
  data        =   {
    address:  address,
    amount:   amount,
  }
  
  data[:instant] = 1 if (currency.eql?("btc") && (instant.eql?(true) || instant.eql?(1)))
  
  response    =   parse(post(path, data: data))
  response    =   response.is_a?(String) ? {"id" => response} : response
  
  return response
end
withdrawal_requests(interval: ::Bitstamper::Constants::TIME_IN_SECONDS[:day]) click to toggle source
# File lib/bitstamper/rest/private/withdrawals.rb, line 30
def withdrawal_requests(interval: ::Bitstamper::Constants::TIME_IN_SECONDS[:day])
  check_credentials!
  
  response    =   post("/v2/withdrawal-requests", data: {timedelta: interval})
  
  Bitstamper::Models::Withdrawal.parse(response) if response
end