]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git/blobdiff - api/portfolio.go
Fix missing ticker.
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git] / api / portfolio.go
index 0fef94c7bf041793f367fcd5e48e32e755f4ff00..8e4cdc6a6c1103bfb65bc6ef6f99b51a760a545a 100644 (file)
@@ -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,