xmaker: call reset today if the date exceeded

This commit is contained in:
c9s 2021-06-26 20:23:41 +08:00
parent fcc1331fcd
commit 1d316ed89c

View File

@ -85,6 +85,10 @@ func (s *ProfitStats) AddProfit(profit, netProfit fixedpoint.Value) {
} }
func (s *ProfitStats) AddTrade(trade types.Trade) { func (s *ProfitStats) AddTrade(trade types.Trade) {
if s.IsOver24Hours() {
s.ResetToday()
}
if trade.Exchange == s.MakerExchange { if trade.Exchange == s.MakerExchange {
s.AccumulatedMakerVolume.AtomicAdd(fixedpoint.NewFromFloat(trade.Quantity)) s.AccumulatedMakerVolume.AtomicAdd(fixedpoint.NewFromFloat(trade.Quantity))
s.TodayMakerVolume.AtomicAdd(fixedpoint.NewFromFloat(trade.Quantity)) s.TodayMakerVolume.AtomicAdd(fixedpoint.NewFromFloat(trade.Quantity))