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:
Sam Fredrickson 2024-03-21 22:07:16 -07:00
parent 7222c4e26b
commit e14f0488c5
2 changed files with 93 additions and 8 deletions

View File

@ -44,3 +44,88 @@ assets:
value: 20000
- name: $25k
value: 25000
LTC:
goals:
- name: $100
value: 100
- name: $150
value: 150
- name: $200
value: 200
- name: $300
value: 300
- name: $500
value: 500
- name: $1k
value: 1000
constantBases:
- name: 2021-
time: 2020-12-31T16:00:00-08:00
SOL:
goals:
- name: $250
value: 250
- name: $375
value: 375
- name: $500
value: 500
- name: $750
value: 750
- name: $1k
value: 1000
- name: $2k
value: 2000
constantBases:
- name: 2022-
time: 2021-12-31T16:00:00-08:00
XRP:
goals:
- name: $1
value: 1
- name: $1.5
value: 1.5
- name: $2
value: 2
- name: $3
value: 3
- name: $5
value: 5
- name: $10
value: 10
constantBases:
- name: 2022-
time: 2021-12-31T16:00:00-08:00
DOGE:
goals:
- name: $1
value: 1
- name: $1.5
value: 1.5
- name: $2
value: 2
- name: $3
value: 3
- name: $5
value: 5
- name: $10
value: 10
constantBases:
- name: 2022-
time: 2021-12-31T16:00:00-08:00
ADA:
goals:
- name: $1
value: 1
- name: $1.5
value: 1.5
- name: $2
value: 2
- name: $3
value: 3
- name: $5
value: 5
- name: $10
value: 10
constantBases:
- name: 2022-
time: 2021-12-31T16:00:00-08:00

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