From: jloup Date: Tue, 22 May 2018 11:37:38 +0000 (+0200) Subject: Fix missing ticker. X-Git-Tag: v0.0.20 X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FFront.git;a=commitdiff_plain;h=f7521f251456fea091d1eb950fd55a7cd4257c65 Fix missing ticker. --- 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,