Sha256: 906f1bb57ac5bd28ddcfbc8e1a54ce9670d2132d293ff93d6a0c93af0f9033d7

Contents?: true

Size: 403 Bytes

Versions: 2

Compression:

Stored size: 403 Bytes

Contents

# frozen_string_literal: true

module Cotcube
  module Bardata

    # fetching official tradedates from CME
    def last_trade_date
      uri = "https://www.cmegroup.com/CmeWS/mvc/Volume/TradeDates?exchange=CME"
      res = nil
      res = HTTParty.get(uri).parsed_response
      res.map{|x| a = x["tradeDate"].chars.each_slice(2).map(&:join); "#{a[0]}#{a[1]}-#{a[2]}-#{a[3]}"}.first
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cotcube-bardata-0.1.3 lib/cotcube-bardata/trade_dates.rb
cotcube-bardata-0.1.2 lib/cotcube-bardata/trade_dates.rb