]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git/commitdiff
Fix missing ticker. v0.0.20
authorjloup <jloup@jloup.work>
Tue, 22 May 2018 11:37:38 +0000 (13:37 +0200)
committerjloup <jloup@jloup.work>
Tue, 22 May 2018 11:37:38 +0000 (13:37 +0200)
api/portfolio.go

index 1e16426ac13a1873777205250a25bc5eca6c9593..8e4cdc6a6c1103bfb65bc6ef6f99b51a760a545a 100644 (file)
@@ -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,