-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (37 loc) · 1.18 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"fmt"
"sync"
"time"
)
import "main/util"
const DATE_ONLY = "2006-01-02"
func main() {
currentTime := time.Now()
endOfLastMonth := currentTime.AddDate(0, 0, -currentTime.Day())
var wg sync.WaitGroup
fmt.Println(
"[Start]",
"Today is " + currentTime.Format(DATE_ONLY) + ", we'll search exchanges rates from " + endOfLastMonth.Format(DATE_ONLY))
wg.Add(1)
go util.FetchOfficialUsdArsRate(endOfLastMonth, func(rate float64, date time.Time) {
defer wg.Done()
fmt.Println("[Result] USD to ARS (official):", date.Format(DATE_ONLY), "=", rate)
})
wg.Add(1)
go util.FetchMepUsdArsRate(endOfLastMonth, func(rate float64, date time.Time) {
defer wg.Done()
fmt.Println("[Result] USD to ARS (MEP):", date.Format(DATE_ONLY), "=", rate)
})
wg.Add(1)
go util.FetchUvaArsRate(endOfLastMonth, func(rate float64, date time.Time) {
defer wg.Done()
fmt.Println("[Result] UVA to ARS:", date.Format(DATE_ONLY), "=", rate)
})
wg.Add(1)
go util.FetchDaiArsRate(endOfLastMonth, func(rate float64, date time.Time) {
defer wg.Done()
fmt.Println("[Result] DAI to ARS:", date.Format(DATE_ONLY), "=", rate,)
})
wg.Wait()
}