Add config defaults for more assets.
All checks were successful
Build & Test / Main (push) Successful in 59s
All checks were successful
Build & Test / Main (push) Successful in 59s
* LTC * SOL * XRP * DOGE * ADA
This commit is contained in:
16
moon/moon.go
16
moon/moon.go
@@ -86,18 +86,18 @@ func (m *Math) Refresh(ctx context.Context) (err error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(resp.Data.Entries) == 0 {
|
||||
c.Projections.Dates = nil
|
||||
return nil
|
||||
}
|
||||
c.StartingPrice = resp.Data.Entries[0].Price
|
||||
c.Gain = float64(m.CurrentPrice) / float64(c.StartingPrice)
|
||||
days := now.Sub(c.StartingDate).Hours() / 24
|
||||
c.CDPR = CDPR(days, c.Gain)
|
||||
if c.CDPR > 1 {
|
||||
c.Projections = ProjectDates(
|
||||
now, float64(m.CurrentPrice),
|
||||
c.CDPR, m.Goals,
|
||||
)
|
||||
} else {
|
||||
c.Projections.Dates = nil
|
||||
}
|
||||
c.Projections = ProjectDates(
|
||||
now, float64(m.CurrentPrice),
|
||||
c.CDPR, m.Goals,
|
||||
)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user