diff --git a/lib/cryptofolio/web/templates/portfolio/index.html.eex b/lib/cryptofolio/web/templates/portfolio/index.html.eex
index f10b8ae..a69de1b 100644
--- a/lib/cryptofolio/web/templates/portfolio/index.html.eex
+++ b/lib/cryptofolio/web/templates/portfolio/index.html.eex
@@ -107,7 +107,7 @@ e class="portfolio-pie"
<%= format_money(coin_trades_cost(coin_trades), @fiat) %> |
<%= format_money(coin_trades_total_cost(coin_trades), @fiat) %> |
<%= format_money(List.first(coin_trades).currency.cost_usd, @fiat) %> |
- <%= format_money(List.first(coin_trades).current_value, @fiat) %> |
+ <%= format_money(coin_trades_current_value(coin_trades), @fiat) %> |
<%= format_money(coin_trades_profit_lost(coin_trades), @fiat) %>
diff --git a/lib/cryptofolio/web/views/portfolio_view.ex b/lib/cryptofolio/web/views/portfolio_view.ex
index b4c2ffc..3a207da 100644
--- a/lib/cryptofolio/web/views/portfolio_view.ex
+++ b/lib/cryptofolio/web/views/portfolio_view.ex
@@ -52,6 +52,10 @@ defmodule Cryptofolio.Web.PortfolioView do
Enum.reduce(trades, Decimal.new(0), fn(trade, acc) -> Decimal.add(Trade.profit_loss(trade), acc) end)
end
+ def coin_trades_current_value(trades) do
+ Decimal.mult(List.first(trades).currency.cost_usd, coin_trades_amount(trades))
+ end
+
def coin_trades_profit_lost_perc(trades) do
total_cost = coin_trades_total_cost(trades)
|