From f7521f251456fea091d1eb950fd55a7cd4257c65 Mon Sep 17 00:00:00 2001 From: jloup Date: Tue, 22 May 2018 13:37:38 +0200 Subject: Fix missing ticker. --- api/portfolio.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'api') diff --git a/api/portfolio.go b/api/portfolio.go index 1e16426..8e4cdc6 100644 --- a/api/portfolio.go +++ b/api/portfolio.go @@ -4,8 +4,8 @@ import ( "fmt" "time" - "github.com/shopspring/decimal" "git.immae.eu/Cryptoportfolio/Front.git/db" + "github.com/shopspring/decimal" ) func init() { @@ -27,6 +27,10 @@ type ValuePerformance struct { func NewValuePerformance(fromValue, toValue decimal.Decimal) ValuePerformance { variation := toValue.Sub(fromValue) + if fromValue.Equals(decimal.Zero) { + return ValuePerformance{} + } + return ValuePerformance{ Value: toValue, Variation: variation, -- cgit v1.2.3