From f7521f251456fea091d1eb950fd55a7cd4257c65 Mon Sep 17 00:00:00 2001 From: jloup Date: Tue, 22 May 2018 13:37:38 +0200 Subject: [PATCH] Fix missing ticker. --- api/portfolio.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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, -- 2.41.0