Module: QuadrigaCX::Private

Included in:
Client
Defined in:
lib/quadrigacx/client/private.rb

Instance Method Summary collapse

Instance Method Details

#balanceObject

List all account balances.



5
6
7
# File 'lib/quadrigacx/client/private.rb', line 5

def balance
  request(:post, '/balance')
end

#cancel_order(params = {}) ⇒ Object

Cancel an order.

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



48
49
50
# File 'lib/quadrigacx/client/private.rb', line 48

def cancel_order params={}
  request(:post, '/cancel_order', params)
end

#deposit_address(coin, params = {}) ⇒ Object

Return a deposit address for specific coin type.

coin – The coin type

Raises:



80
81
82
83
84
# 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 = {}) ⇒ Object

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.

Raises:



14
15
16
17
# 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 = {}) ⇒ Object

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.

Raises:



24
25
26
27
# 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 = {}) ⇒ Object

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.



62
63
64
# File 'lib/quadrigacx/client/private.rb', line 62

def lookup_order params={}
  request(:post, '/lookup_order', params)
end

#market_buy(params = {}) ⇒ Object

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.



33
34
35
# File 'lib/quadrigacx/client/private.rb', line 33

def market_buy params={}
  request(:post, '/buy', params)
end

#market_sell(params = {}) ⇒ Object

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.



41
42
43
# File 'lib/quadrigacx/client/private.rb', line 41

def market_sell params={}
  request(:post, '/sell', params)
end

#open_orders(params = {}) ⇒ Object

Return a JSON list of open orders.

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



55
56
57
# File 'lib/quadrigacx/client/private.rb', line 55

def open_orders params={}
  request(:post, '/open_orders', params)
end

#user_transactions(params = {}) ⇒ Object

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.



93
94
95
# 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 = {}) ⇒ Object

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.

Raises:



71
72
73
74
75
# 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