Class: Cmc::Exchange

Inherits:
Object
  • Object
show all
Defined in:
lib/cmc/resources/exchange.rb

Constant Summary collapse

LIMIT =
1000

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Exchange

Returns a new instance of Exchange.



9
10
11
12
13
14
15
# File 'lib/cmc/resources/exchange.rb', line 9

def initialize(params = {})
  @slug = params.fetch(:slug, 'bitcoin')
  @quote = params.fetch(:quote, 825)

  @start = params.fetch(:start, 1)
  @limit = params.fetch(:limit, LIMIT)
end

Instance Method Details

#listObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/cmc/resources/exchange.rb', line 17

def list
  options = OpenStruct.new(http_method: 'get', url: Cmc::Base.path_prefix,
                           headers: { 'Content-Type' => 'application/json' }, data: {},
                           params: {
                             slug: @slug, start: @start, quoteCurrencyId: @quote, limit: @limit,
                             category: 'spot', centerType: 'all', sort: 'cmc_rank_advanced'
                           }, auth: nil, proxy: nil, options: {})

  Request::Client.request(options)
end