Class: KrakenClient::Endpoints::Public

Inherits:
Base
  • Object
show all
Defined in:
lib/kraken_client/endpoints/public.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize, #request_manager

Constructor Details

This class inherits a constructor from KrakenClient::Endpoints::Base

Instance Method Details

#dataObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/kraken_client/endpoints/public.rb', line 11

def data
  {
    :Time       => :server_time,
    :AssetPairs => :asset_pairs,
    :Depth      => :order_book,
    :Ticker     => :ticker,
    :OHLC       => [:ohlc,  params: [:pair, :last, :interval]],
    :Trades     => :trades,
    :Spread     => :spread,
    :Assets     => :assets,
  }
end

#perform(endpoint_name, args) ⇒ Object



5
6
7
8
9
# File 'lib/kraken_client/endpoints/public.rb', line 5

def perform(endpoint_name, args)
  response = request_manager.call(url(endpoint_name), args)
  hash = JSON.parse(response.body).with_indifferent_access
  hash[:result]
end