Module: Coinigy::Client::AccountFunctions

Included in:
Coinigy::Client
Defined in:
lib/coinigy/client/account_functions.rb

Overview

Private account methods - place alerts, orders, refresh balances

Instance Method Summary collapse

Instance Method Details

#activate_api_key(id = nil, auth_active = 1) ⇒ Object

Activate/Enable API Key usage (enables automatic balance monitoring)



52
53
54
# File 'lib/coinigy/client/account_functions.rb', line 52

def activate_api_key(id = nil, auth_active = 1)
  request('activateApiKey', { auth_id: id, auth_active: auth_active })
end

#activate_trading_key(id = nil, auth_active = 1) ⇒ Object

Activate/Enable Trading on specified API key



57
58
59
# File 'lib/coinigy/client/account_functions.rb', line 57

def activate_trading_key(id = nil, auth_active = 1)
  request('activateTradingKey', { auth_id: id, auth_trade: auth_active })
end

#add_alert(options = {}) ⇒ Object

Add a new price alert



31
32
33
# File 'lib/coinigy/client/account_functions.rb', line 31

def add_alert(options = {})
  request('addAlert', options.slice('exch_code', 'market_name', 'alert_price', 'alert_note'))
end

#add_api_key(options = {}) ⇒ Object

Add a new Exchange API Key to your account. Returns newly-generated auth_id in 'data' block. After adding a new key, it must still be both activated and activated for trading.



42
43
44
# File 'lib/coinigy/client/account_functions.rb', line 42

def add_api_key(options = {})
  request('addApiKey', options.slice('api_key', 'api_secret', 'api_exch_id', 'api_nickname'))
end

#add_order(options = {}) ⇒ Object

Create a new exchange order. Returns internal_order_id upon success



62
63
64
# File 'lib/coinigy/client/account_functions.rb', line 62

def add_order(options = {})
  request('addOrder', options.slice('auth_id', 'exch_id', 'mkt_id', 'order_type_id', 'price_type_id', 'limit_price', 'order_quantity'))
end

#cancel_order(id = nil) ⇒ Object

Cancel an outstanding exchange order



67
68
69
# File 'lib/coinigy/client/account_functions.rb', line 67

def cancel_order(id = nil)
  request('cancelOrder', { internal_order_id: id })
end

#delete_alert(id = nil) ⇒ Object

Delete existing price alert by alert_id



36
37
38
# File 'lib/coinigy/client/account_functions.rb', line 36

def delete_alert(id = nil)
  request('deleteAlert', { alert_id: id })
end

#delete_api_key(id = nil) ⇒ Object

Delete specified Exchange API Account by auth_id



47
48
49
# File 'lib/coinigy/client/account_functions.rb', line 47

def delete_api_key(id = nil)
  request('deleteApiKey', { auth_id: id })
end

#order_typesObject

Returns a list of supported order and price types



21
22
23
# File 'lib/coinigy/client/account_functions.rb', line 21

def order_types
  request('orderTypes')
end

#refresh_balance(id = nil) ⇒ Object

Refresh balances on specified auth_id



26
27
28
# File 'lib/coinigy/client/account_functions.rb', line 26

def refresh_balance(id = nil)
  request('refreshBalance', { auth_id: id })
end

#save_notifications_preferences(options = {}) ⇒ Object

Update your notification preferences (alerts, trades, balances) via (email, sms)



11
12
13
# File 'lib/coinigy/client/account_functions.rb', line 11

def save_notifications_preferences(options = {})
  request('savePrefs', options.slice('alert_email', 'alert_sms', 'trade_email', 'trade_sms', 'balance_email'))
end

#update_tickers(ids = []) ⇒ Object

Update your favorite markets/tickers based on exch_mkt_id



16
17
18
# File 'lib/coinigy/client/account_functions.rb', line 16

def update_tickers(ids = [])
  request('updateTickers', { exch_mkt_ids: ids.join(',') })
end

#update_user(options = {}) ⇒ Object

Update your account information on record



6
7
8
# File 'lib/coinigy/client/account_functions.rb', line 6

def update_user(options = {})
  request('updateUser', options.slice('first_name', 'last_name', 'company', 'phone', 'street1', 'street2', 'city', 'state', 'zip', 'country'))
end