|
|
@ -48,13 +48,18 @@ defmodule Explorer.Market.History.Source.CryptoCompare do |
|
|
|
defp format_data(data) do |
|
|
|
defp format_data(data) do |
|
|
|
json = Jason.decode!(data) |
|
|
|
json = Jason.decode!(data) |
|
|
|
|
|
|
|
|
|
|
|
for item <- json["Data"] do |
|
|
|
items = |
|
|
|
%{ |
|
|
|
for item <- json["Data"] do |
|
|
|
closing_price: Decimal.new(to_string(item["close"])), |
|
|
|
%{ |
|
|
|
date: date(item["time"]), |
|
|
|
closing_price: Decimal.new(to_string(item["close"])), |
|
|
|
opening_price: Decimal.new(to_string(item["open"])) |
|
|
|
date: date(item["time"]), |
|
|
|
} |
|
|
|
opening_price: Decimal.new(to_string(item["open"])) |
|
|
|
end |
|
|
|
} |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Enum.reject(items, fn item -> |
|
|
|
|
|
|
|
Decimal.equal?(item.closing_price, 0) && Decimal.equal?(item.opening_price, 0) |
|
|
|
|
|
|
|
end) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@spec history_url(non_neg_integer()) :: String.t() |
|
|
|
@spec history_url(non_neg_integer()) :: String.t() |
|
|
|