-
Notifications
You must be signed in to change notification settings - Fork 0
/
dfcandle.go
57 lines (49 loc) · 1.2 KB
/
dfcandle.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
package models
import "time"
type DataFrameCandle struct {
ProductCode string `json:"product_code"`
Duration time.Duration `json:"duration"`
Candles []Candle `json:"candles"`
}
func (df *DataFrameCandle) Times() []time.Time {
s := make([]time.Time, len(df.Candles))
for i, candle := range df.Candles {
s[i] = candle.Time
}
return s
}
func (df *DataFrameCandle) Opens() []float64 {
s := make([]float64, len(df.Candles))
for i, candle := range df.Candles {
s[i] = candle.Open
}
return s
}
func (df *DataFrameCandle) Closes() []float64 {
s := make([]float64, len(df.Candles))
for i, candle := range df.Candles {
s[i] = candle.Close
}
return s
}
func (df *DataFrameCandle) Highs() []float64 {
s := make([]float64, len(df.Candles))
for i, candle := range df.Candles {
s[i] = candle.High
}
return s
}
func (df *DataFrameCandle) Low() []float64 {
s := make([]float64, len(df.Candles))
for i, candle := range df.Candles {
s[i] = candle.Low
}
return s
}
func (df *DataFrameCandle) Volume() []float64 {
s := make([]float64, len(df.Candles))
for i, candle := range df.Candles {
s[i] = candle.Volume
}
return s
}