Implement daily stats

This commit is contained in:
Pijus Kamandulis
2025-06-23 21:35:16 +03:00
parent 4ddd9abd2e
commit b89a1a2a7e
8 changed files with 318 additions and 0 deletions

View File

@@ -36,6 +36,20 @@ type TimeWindowHighShare struct {
Time string `json:"share_time"` // Time of the highest share
}
type DailyStats struct {
Date string `json:"date"` // Format: "2006-01-02" in UTC
ShareCount int `json:"sharecount"` // Total shares submitted that day
TopShare ShareLog `json:"topshare"` // Highest share (by SDiff)
PoolHashrate float64 `json:"poolhashrate"` // In H/s (averaged)
Workers map[string]WorkerDailyStats `json:"workers"` // key = workername
}
type WorkerDailyStats struct {
TopShare ShareLog `json:"topshare"` // Highest share by this worker
Hashrate float64 `json:"hashrate"` // avg hashrate in H/s
Shares int `json:"shares"` // shares submitted
}
// ParseCreateDate can be used to convert ShareLog.CreateDate to time.Time
func (s *ShareLog) ParseCreateDate() (time.Time, error) {
var sec, nsec int64