Skip to content

Commit

Permalink
fix moex cache once again
Browse files Browse the repository at this point in the history
  • Loading branch information
kiberdruzhinnik committed Dec 17, 2023
1 parent bbe11dc commit cd3b03b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/moex.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ func (api *MoexAPI) getSecurityHistoryOffset(ticker string,
duration = time.Duration(0)

} else {
duration = time.Hour * 3
// cache until tomorrow
now := time.Now().UTC()
tomorrow := time.Date(now.Year(), now.Month(), now.Day()+1, 0, 0, 0, 0, time.UTC)
duration = tomorrow.Sub(now)
}
err = api.setSecurityHistoryOffsetToCache(cacheKey, moexHistory, duration)
if err != nil {
Expand Down

0 comments on commit cd3b03b

Please sign in to comment.