Skip to content

Commit

Permalink
Merge pull request #9 from sgobotta/hotfix/handle-nil-stock-prices-fr…
Browse files Browse the repository at this point in the history
…om-api

Fix nil values from the finnhub api
  • Loading branch information
sgobotta authored Feb 1, 2024
2 parents 0828af3 + 8eaf3d6 commit 3e5e549
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/ex_finnhub/api/stock_price.ex
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ defmodule ExFinnhub.StockPrice do
}
end

defp parse_number(n) when is_nil(n), do: Decimal.new(0)
defp parse_number(n) when is_float(n), do: Decimal.from_float(n)
defp parse_number(n), do: Decimal.new(n)
end

0 comments on commit 3e5e549

Please sign in to comment.