<commit_before>require 'happy/xrp'

module Happy
  class Collector
    def initialize
      @logstash = Happy.logstash.with(type: 'market_prices')
    end

    def taint_eop list
      list.last[:eop] = true
    end

    def log_market_xrp_impl(base, counter)
      xrp = XRP.new(ENV['XRP_ADDRESS'])
      asks = xrp.market(base, counter)
      taint_eop(asks)
      Happy.logger.debug { "Count of asks(#{base}, #{counter}): #{asks.size}" }
      @logstash.at_once.stash_all(asks)
    end

    def log_market_xrp
      log_market_xrp_impl(Currency::BTC_P, Currency::XRP)
      log_market_xrp_impl(Currency::XRP, Currency::KRW_P)
    end

    def log_market_xcoin
      xcoin = XCoin.new
      asks = xcoin.market
      taint_eop(asks)
      Happy.logger.debug { "Count of asks(XCoin): #{asks.size}" }
      @logstash.at_once.stash_all(asks)
    end
  end
end
<commit_msg>Check the count of prices<commit_after>require 'happy/xrp'

module Happy
  class Collector
    def initialize
      @logstash = Happy.logstash.with(type: 'market_prices')
    end

    def taint_eop list
      list.last[:price_count] = list.size
    end

    def log_market_xrp_impl(base, counter)
      xrp = XRP.new(ENV['XRP_ADDRESS'])
      asks = xrp.market(base, counter)
      taint_eop(asks)
      Happy.logger.debug { "Count of asks(#{base}, #{counter}): #{asks.size}" }
      @logstash.at_once.stash_all(asks)
    end

    def log_market_xrp
      log_market_xrp_impl(Currency::BTC_P, Currency::XRP)
      log_market_xrp_impl(Currency::XRP, Currency::KRW_P)
    end

    def log_market_xcoin
      xcoin = XCoin.new
      asks = xcoin.market
      taint_eop(asks)
      Happy.logger.debug { "Count of asks(XCoin): #{asks.size}" }
      @logstash.at_once.stash_all(asks)
    end
  end
end

{'fraction_non_alphanumeric': 0.11488398415393322, 'fraction_numerical': 0.0, 'mean_word_length': 2.981981981981982, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2721494', 'n_tokens_mistral': 684, 'n_tokens_neox': 665, 'n_words': 120}