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