Skip to content

Commit

Permalink
avg price added
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitweinvest committed Sep 14, 2017
1 parent c3110eb commit 3e5e0ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/coinmarketcap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ def self.get_historical_price(id, start_date, end_date) #20170908
price_bundle = {}
each_row = Nokogiri::HTML(row.to_s).css('td')
price_bundle[:date] = Date.parse(each_row[0].text)
price_bundle[:open] = each_row[1].text
price_bundle[:high] = each_row[2].text
price_bundle[:low] = each_row[3].text
price_bundle[:close] = each_row[4].text
price_bundle[:open] = each_row[1].text.to_f
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
prices << price_bundle
rescue => error
next
Expand Down
2 changes: 1 addition & 1 deletion lib/coinmarketcap/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Coinmarketcap
VERSION = "0.2.1"
VERSION = "0.2.2"
end

0 comments on commit 3e5e0ce

Please sign in to comment.