module QuadrigaCX::Private

Public Instance Methods

balance() click to toggle source

List all account balances.

# File lib/quadrigacx/client/private.rb, line 5
def balance
  request(:post, '/balance')
end
cancel_order(params={}) click to toggle source

Cancel an order.

id – a 64 characters long hexadecimal string taken from the list of orders.

# File lib/quadrigacx/client/private.rb, line 48
def cancel_order params={}
  request(:post, '/cancel_order', params)
end
deposit_address(coin, params={}) click to toggle source

Return a deposit address for specific coin type.

coin – The coin type

# File lib/quadrigacx/client/private.rb, line 80
def deposit_address coin, params={}
  raise ConfigurationError.new('No coin type specified') unless coin
  raise ConfigurationError.new('Invalid coin type specified') unless Coin.valid?(coin)
  request(:post, "/#{coin}_deposit_address", params)
end
limit_buy(params={}) click to toggle source

Place a limit buy order. Returns JSON describing the order.

amount - amount of major currency. price - price to buy at. book - optional, if not specified, will default to btc_cad.

# File lib/quadrigacx/client/private.rb, line 14
def limit_buy params={}
  raise ConfigurationError.new('No price specified for limit buy') unless params[:price]
  request(:post, '/buy', params)
end
limit_sell(params={}) click to toggle source

Place a limit sell order. Returns JSON describing the order.

amount - amount of major currency. price - price to sell at. book - optional, if not specified, will default to btc_cad.

# File lib/quadrigacx/client/private.rb, line 24
def limit_sell params={}
  raise ConfigurationError.new('No price specified for limit sell') unless params[:price]
  request(:post, '/sell', params)
end
lookup_order(params={}) click to toggle source

Returns JSON list of details about 1 or more orders.

id – a single or array of 64 characters long hexadecimal string taken from the list of orders.

# File lib/quadrigacx/client/private.rb, line 62
def lookup_order params={}
  request(:post, '/lookup_order', params)
end
market_buy(params={}) click to toggle source

Place a market order. Returns JSON describing the order.

amount - amount of major currency to spend. book - optional, if not specified, will default to btc_cad.

# File lib/quadrigacx/client/private.rb, line 33
def market_buy params={}
  request(:post, '/buy', params)
end
market_sell(params={}) click to toggle source

Place a market order. Returns JSON describing the order.

amount - amount of major currency to sell. book - optional, if not specified, will default to btc_cad.

# File lib/quadrigacx/client/private.rb, line 41
def market_sell params={}
  request(:post, '/sell', params)
end
open_orders(params={}) click to toggle source

Return a JSON list of open orders.

book - optional, if not specified, will default to btc_cad.

# File lib/quadrigacx/client/private.rb, line 55
def open_orders params={}
  request(:post, '/open_orders', params)
end
user_transactions(params={}) click to toggle source

Return a list of user transactions.

offset - optional, skip that many transactions before beginning to return results. Default: 0. limit - optional, limit result to that many transactions. Default: 50. sort - optional, sorting by date and time (asc - ascending; desc - descending). Default: desc. book - optional, if not specified, will default to btc_cad.

# File lib/quadrigacx/client/private.rb, line 93
def user_transactions params={}
  request(:post, '/user_transactions', params).each { |t| t.id = t.id.to_s }
end
withdraw(coin, params={}) click to toggle source

Withdrawal of the specified coin type.

coin – The coin type amount – The amount to withdraw. address – The coin type's address we will send the amount to.

# File lib/quadrigacx/client/private.rb, line 71
def withdraw coin, params={}
  raise ConfigurationError.new('No coin type specified') unless coin
  raise ConfigurationError.new('Invalid coin type specified') unless Coin.valid?(coin)
  request(:post, "/#{coin}_withdrawal", params)
end