Skip to content

Commit

Permalink
Using prior value if no new value for a curreny ( fixes #836 )
Browse files Browse the repository at this point in the history
  • Loading branch information
netboz committed Jan 23, 2023
1 parent 75be47d commit d55e462
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/archethic/oracle_chain/services/uco_price.ex
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ defmodule Archethic.OracleChain.Services.UCOPrice do
previous_values ++ values
end)

{_currency, _values}, acc ->
_, acc ->
acc
end)
end
Expand All @@ -87,7 +87,10 @@ defmodule Archethic.OracleChain.Services.UCOPrice do

{:ok, prices_now} ->
Enum.all?(@pairs, fn pair ->
compare_price(Map.fetch!(prices_prior, pair), Map.fetch!(prices_now, pair))
compare_price(
Map.fetch!(prices_prior, pair),
Map.get(prices_now, pair, Map.fetch!(prices_prior, pair))
)
end)
end
end
Expand Down

0 comments on commit d55e462

Please sign in to comment.