Skip to content

Commit

Permalink
Merge pull request #3 from alexanderdavidpan/patch-5
Browse files Browse the repository at this point in the history
Fix minor formatting issues reported by Code Climate.
  • Loading branch information
ankitsamarthya committed Dec 11, 2017
2 parents 885d90d + 6e4d41c commit 0a6f986
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/coinmarketcap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require 'nokogiri'

module Coinmarketcap

def self.coins(limit = nil)
if limit.nil?
HTTParty.get('https://api.coinmarketcap.com/v1/ticker/')
Expand All @@ -21,7 +20,7 @@ def self.global(currency = 'USD')
HTTParty.get("https://api.coinmarketcap.com/v1/global/?convert=#{currency}")
end

def self.get_historical_price(id, start_date, end_date) #20170908
def self.get_historical_price(id, start_date, end_date) # 20170908
prices = []
doc = Nokogiri::HTML(open("https://coinmarketcap.com/currencies/#{id}/historical-data/?start=#{start_date}&end=#{end_date}"))
rows = doc.css('tr')
Expand All @@ -40,7 +39,7 @@ def self.get_historical_price(id, start_date, end_date) #20170908
price_bundle[:high] = each_row[2].text.to_f
price_bundle[:low] = each_row[3].text.to_f
price_bundle[:close] = each_row[4].text.to_f
price_bundle[:avg] = ( price_bundle[:high] + price_bundle[:low] ) / 2.0
price_bundle[:avg] = (price_bundle[:high] + price_bundle[:low]) / 2.0
prices << price_bundle
end
rescue
Expand All @@ -49,5 +48,4 @@ def self.get_historical_price(id, start_date, end_date) #20170908
end
prices
end

end

0 comments on commit 0a6f986

Please sign in to comment.