class Cryptoexchange::Exchanges::Coinut::Services::Pairs

Public Instance Methods

adapt(output) click to toggle source
# File lib/cryptoexchange/exchanges/coinut/services/pairs.rb, line 27
def adapt(output)
  output["SPOT"].map do |pairs, array|
    hash = array.first
    Cryptoexchange::Models::MarketPair.new(
      base: hash["base"],
      target: hash["quote"],
      inst_id: hash["inst_id"].to_s,
      market: Coinut::Market::NAME
    )
  end
end
fetch() click to toggle source
# File lib/cryptoexchange/exchanges/coinut/services/pairs.rb, line 6
def fetch
  authentication = Cryptoexchange::Exchanges::Coinut::Authentication.new(
    :pairs,
    Cryptoexchange::Exchanges::Coinut::Market::NAME
  )
  authentication.validate_credentials!

  payload_ = payload
  headers = authentication.headers(payload_)
  output = fetch_via_api_using_post(pairs_url, headers, payload_)
  adapt(output)
end
pairs_url() click to toggle source
# File lib/cryptoexchange/exchanges/coinut/services/pairs.rb, line 23
def pairs_url
  Cryptoexchange::Exchanges::Coinut::Market::API_URL
end
payload() click to toggle source
# File lib/cryptoexchange/exchanges/coinut/services/pairs.rb, line 19
def payload
  '{"nonce":' + SecureRandom.random_number(99999).to_s + ',"request":"inst_list", "sec_type":"SPOT"}'
end