-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcandle.go
65 lines (53 loc) · 1.05 KB
/
candle.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
package main
import (
"reflect"
"time"
)
type CandleSimple struct {
DateTime time.Time
Volume int64
Open float64
High float64
Low float64
Close float64
}
type CandleEnriched struct {
DateTime time.Time
OpenTime time.Time
CloseTime time.Time
DayOpen float64
DayClose float64
DayHigh float64
DayLow float64
DayLowWithoutFirstMin float64
DayHighWithoutFirstMin float64
DayVolume int64
DayHighTime time.Time
DayLowTime time.Time
DayHighTimeWithoutFirstMin time.Time
DayLowTimeWithoutFirstMin time.Time
High9 float64
High10 float64
High11 float64
High12 float64
High13 float64
High14 float64
High15 float64
Low9 float64
Low10 float64
Low11 float64
Low12 float64
Low13 float64
Low14 float64
Low15 float64
}
func (c *CandleEnriched) setPriceValue(field string, value float64) {
v := reflect.ValueOf(c).Elem().FieldByName(field)
if v.IsValid() {
v.SetFloat(value)
}
}
func (c *CandleEnriched) getPriceValue(field string) float64 {
v := reflect.ValueOf(c).Elem().FieldByName(field).Float()
return v
}