From 0b572aa9676fed2115f586aff16e577fea50e911 Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 3 Sep 2024 03:26:47 +0800 Subject: [PATCH] bbgo: add stringer method to the quota struct --- pkg/bbgo/quota.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/bbgo/quota.go b/pkg/bbgo/quota.go index 6b7e34d..dd17610 100644 --- a/pkg/bbgo/quota.go +++ b/pkg/bbgo/quota.go @@ -51,6 +51,13 @@ func (q *Quota) Rollback() { q.mu.Unlock() } +func (q *Quota) String() string { + q.mu.Lock() + defer q.mu.Unlock() + + return q.Locked.String() + "/" + q.Available.String() +} + // QuotaTransaction is a transactional quota manager type QuotaTransaction struct { mu sync.Mutex