X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=api%2Fportfolio.go;h=8e4cdc6a6c1103bfb65bc6ef6f99b51a760a545a;hb=f7521f251456fea091d1eb950fd55a7cd4257c65;hp=0fef94c7bf041793f367fcd5e48e32e755f4ff00;hpb=24e4797900b3d2edf642fdb547bc22357a5b39ad;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FFront.git diff --git a/api/portfolio.go b/api/portfolio.go index 0fef94c..8e4cdc6 100644 --- a/api/portfolio.go +++ b/api/portfolio.go @@ -4,8 +4,8 @@ import ( "fmt" "time" + "git.immae.eu/Cryptoportfolio/Front.git/db" "github.com/shopspring/decimal" - "immae.eu/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front/db" ) 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,