Class: KrakenClient::Endpoints::Private
- Defined in:
- lib/kraken_client/endpoints/private.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from KrakenClient::Endpoints::Base
Instance Method Details
#data ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/kraken_client/endpoints/private.rb', line 18 def data { :Balance => :balance, :TradeBalance => :trade_balance, :OpenOrders => :open_orders, :ClosedOrders => :closed_orders, :QueryOrders => [:query_orders, params: [:txid]], :TradesHistory => :trades_history, :QueryTrades => [:query_trades, params: [:txid]], :OpenPositions => :open_positions, params: [:txid], :Ledgers => :ledgers, :QueryLedgers => [:query_ledgers, params: [:id]], :TradeVolume => :trade_volume, :AddOrder => [:add_order, params: [:pair, :type, :ordertype, :volume]], :CancelOrder => [:cancel_order, params: [:txid]], :Withdraw => [:withdraw, params: [:asset, :key, :amount]] } end |
#perform(endpoint_name, args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/kraken_client/endpoints/private.rb', line 5 def perform(endpoint_name, args) url = config.base_uri + url_path(endpoint_name) response = request_manager.call(url, endpoint_name, args) if response.is_a?(Array) && response.first.match(/^E[\w]+:/) fail ErrorResponse.new(response.first) elsif response == "error" fail ErrorResponse.new(response) else response.with_indifferent_access end end |
#raise_exception(options, args) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/kraken_client/endpoints/private.rb', line 37 def raise_exception(, args) return unless .is_a?(Hash) leftover = [:params] - args.keys if leftover.length > 0 fail ::KrakenClient::ArgumentError, "Required options absent. Input must include #{leftover}" end end |