inflation implementation
This commit is contained in:
parent
c944e84771
commit
9ada121417
@ -26,16 +26,14 @@ type Datas struct {
|
||||
var rawData = make(map[string]map[time.Time]float32)
|
||||
|
||||
var datas = map[string]Datas{
|
||||
/*
|
||||
"FPCPITOTLZGUSA": {
|
||||
Name: "CPI USA",
|
||||
ProcessFunction: func(m map[time.Time]float32) map[time.Time]float32 { return m },
|
||||
},
|
||||
*/
|
||||
"CPIAUCSL": {
|
||||
Name: "CPI USA BASE",
|
||||
ProcessFunction: toPercent,
|
||||
},
|
||||
"PCEPI": {
|
||||
Name: "PCECPI USA",
|
||||
ProcessFunction: toPercent,
|
||||
},
|
||||
"M2SL": {
|
||||
Name: "M2 USA",
|
||||
ProcessFunction: toPercent,
|
||||
@ -44,6 +42,10 @@ var datas = map[string]Datas{
|
||||
Name: "HICP ECB",
|
||||
ProcessFunction: toPercent,
|
||||
},
|
||||
"MABMM301EZM189S": {
|
||||
Name: "M3 ECB",
|
||||
ProcessFunction: toPercent,
|
||||
},
|
||||
}
|
||||
|
||||
//go:embed locales/*
|
||||
@ -139,6 +141,7 @@ func LoadData() error {
|
||||
}
|
||||
|
||||
resp, err := http.Get(fredBaseUrl + id)
|
||||
log.Debug().Str("id", id).Msg("inflation.LoadData: getting")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -96,6 +96,10 @@ func readCSV(filePath string) (map[time.Time]float32, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
if len(record) < 2 || record[1] == "." {
|
||||
continue
|
||||
}
|
||||
|
||||
date, err := time.Parse("2006-01-02", record[0])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error parsing date on line %d: %v", i+1, err)
|
||||
|
Loading…
Reference in New Issue
Block a user