- add
@@ -1,6 +1,9 @@
package sentio
-import "time"
+import (
+ "cmp"
+ "time"
+)
type PortfolioRecord struct {
TS time.Time
@@ -8,3 +11,7 @@ type PortfolioRecord struct {
PnL float64
PnLPct float64
}
+
+func ComparePortfolioRecords(a, b PortfolioRecord) int {
+ return cmp.Compare(a.TS.Unix(), b.TS.Unix())
+}