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