Add config defaults for more assets.
All checks were successful
Build & Test / Main (push) Successful in 59s

* LTC
* SOL
* XRP
* DOGE
* ADA
This commit is contained in:
2024-03-21 22:07:16 -07:00
parent 7222c4e26b
commit e14f0488c5
2 changed files with 93 additions and 8 deletions

View File

@@ -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
})
}