Skip to content

Instantly share code, notes, and snippets.

@peakBreaker
Last active November 26, 2018 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peakBreaker/2b49c6d840c697584d2cdd46b6f2af4b to your computer and use it in GitHub Desktop.
Save peakBreaker/2b49c6d840c697584d2cdd46b6f2af4b to your computer and use it in GitHub Desktop.
Iterating through historical data until today
import datetime
# Set the config for the date iterator
start_date = datetime.datetime(2018, 9, 10)
end_date = datetime.datetime(2018, 11, 20)
d = start_date
delta = datetime.timedelta(days=1)
# Iterate from start date, adding delta with every iteration
while d <= end_date:
print('Doing something for date %s' % d)
d += delta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment