mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +00:00
types: init today since if it's 0
This commit is contained in:
parent
f0c0c6712d
commit
24fd81986c
|
@ -196,6 +196,11 @@ func (s *ProfitStats) AddProfit(profit Profit) {
|
|||
s.AccumulatedSince = profit.TradedAt.Unix()
|
||||
}
|
||||
|
||||
if s.TodaySince == 0 {
|
||||
var beginningOfTheDay = BeginningOfTheDay(profit.TradedAt.Local())
|
||||
s.TodaySince = beginningOfTheDay.Unix()
|
||||
}
|
||||
|
||||
s.AccumulatedPnL = s.AccumulatedPnL.Add(profit.Profit)
|
||||
s.AccumulatedNetProfit = s.AccumulatedNetProfit.Add(profit.NetProfit)
|
||||
s.TodayPnL = s.TodayPnL.Add(profit.Profit)
|
||||
|
|
Loading…
Reference in New Issue
Block a user