|
@@ -1,6 +1,9 @@
|
|
package sentio
|
|
package sentio
|
|
|
|
|
|
-import "time"
|
|
|
|
|
|
+import (
|
|
|
|
+ "cmp"
|
|
|
|
+ "time"
|
|
|
|
+)
|
|
|
|
|
|
type Bar struct {
|
|
type Bar struct {
|
|
Datetime time.Time `json:"datetime" yaml:"datetime"`
|
|
Datetime time.Time `json:"datetime" yaml:"datetime"`
|
|
@@ -11,3 +14,7 @@ type Bar struct {
|
|
Volume float64 `json:"volume" yaml:"volume"`
|
|
Volume float64 `json:"volume" yaml:"volume"`
|
|
Trades int `json:"trades" yaml:"trades"`
|
|
Trades int `json:"trades" yaml:"trades"`
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func CompareBars(a, b Bar) int {
|
|
|
|
+ return cmp.Compare(a.Datetime.Unix(), b.Datetime.Unix())
|
|
|
|
+}
|