forked from thrasher-corp/gocryptotrader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixer_types.go
76 lines (71 loc) · 2.17 KB
/
fixer_types.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package fixer
// Rates contains the data fields for the currencies you have requested.
type Rates struct {
Success bool `json:"success"`
Error struct {
Code int `json:"code"`
Type string `json:"type"`
Info string `json:"info"`
} `json:"error"`
Historical bool `json:"historical"`
Timestamp int64 `json:"timestamp"`
Base string `json:"base"`
Date string `json:"date"`
Rates map[string]float64 `json:"rates"`
}
// Conversion contains data for currency conversion
type Conversion struct {
Success bool `json:"success"`
Error struct {
Code int `json:"code"`
Type string `json:"type"`
Info string `json:"info"`
} `json:"error"`
Query struct {
From string `json:"from"`
To string `json:"to"`
Amount float64 `json:"amount"`
} `json:"query"`
Info struct {
Timestamp int64 `json:"timestamp"`
Rate float64 `json:"rate"`
} `json:"info"`
Historical bool `json:"historical"`
Date string `json:"date"`
Result float64 `json:"result"`
}
// TimeSeries holds timeseries data
type TimeSeries struct {
Success bool `json:"success"`
Error struct {
Code int `json:"code"`
Type string `json:"type"`
Info string `json:"info"`
} `json:"error"`
Timeseries bool `json:"timeseries"`
StartDate string `json:"start_date"`
EndDate string `json:"end_date"`
Base string `json:"base"`
Rates map[string]interface{} `json:"rates"`
}
// Fluctuation holds fluctuation data
type Fluctuation struct {
Success bool `json:"success"`
Error struct {
Code int `json:"code"`
Type string `json:"type"`
Info string `json:"info"`
} `json:"error"`
Fluctuation bool `json:"fluctuation"`
StartDate string `json:"start_date"`
EndDate string `json:"end_date"`
Base string `json:"base"`
Rates map[string]Flux `json:"rates"`
}
// Flux is a sub type holding fluctation data
type Flux struct {
StartRate float64 `json:"start_rate"`
EndRate float64 `json:"end_rate"`
Change float64 `json:"change"`
ChangePCT float64 `json:"change_pct"`
}