aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/portfolio.go6
1 files changed, 5 insertions, 1 deletions
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 (
4 "fmt" 4 "fmt"
5 "time" 5 "time"
6 6
7 "github.com/shopspring/decimal"
8 "git.immae.eu/Cryptoportfolio/Front.git/db" 7 "git.immae.eu/Cryptoportfolio/Front.git/db"
8 "github.com/shopspring/decimal"
9) 9)
10 10
11func init() { 11func init() {
@@ -27,6 +27,10 @@ type ValuePerformance struct {
27func NewValuePerformance(fromValue, toValue decimal.Decimal) ValuePerformance { 27func NewValuePerformance(fromValue, toValue decimal.Decimal) ValuePerformance {
28 variation := toValue.Sub(fromValue) 28 variation := toValue.Sub(fromValue)
29 29
30 if fromValue.Equals(decimal.Zero) {
31 return ValuePerformance{}
32 }
33
30 return ValuePerformance{ 34 return ValuePerformance{
31 Value: toValue, 35 Value: toValue,
32 Variation: variation, 36 Variation: variation,