mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
xbalance: use time util function from the util package
This commit is contained in:
parent
c6d66ebb46
commit
cef28fa651
|
@ -56,7 +56,7 @@ func (s *State) SlackAttachment() slack.Attachment {
|
|||
}
|
||||
|
||||
func (s *State) Reset() {
|
||||
var beginningOfTheDay = Bod(time.Now())
|
||||
var beginningOfTheDay = util.BeginningOfTheDay(time.Now().Local())
|
||||
*s = State{
|
||||
DailyNumberOfTransfers: 0,
|
||||
DailyAmountOfTransfers: 0,
|
||||
|
@ -304,11 +304,6 @@ func (s *Strategy) findLowBalanceLevelSession(sessions map[string]*bbgo.Exchange
|
|||
return nil, balance, nil
|
||||
}
|
||||
|
||||
func Bod(t time.Time) time.Time {
|
||||
year, month, day := t.Date()
|
||||
return time.Date(year, month, day, 0, 0, 0, 0, t.Location())
|
||||
}
|
||||
|
||||
func (s *Strategy) SaveState() {
|
||||
if err := s.Persistence.Save(s.state, ID, s.Asset, stateKey); err != nil {
|
||||
log.WithError(err).Errorf("can not save state: %+v", s.state)
|
||||
|
|
Loading…
Reference in New Issue
Block a user