options-backtesting/backtesting/available_entry_times.py

16 lines
441 B
Python

from datetime import datetime, timedelta
entry_time_format = '%H:%M:%S'
def available_entry_times():
start = datetime.strptime('09:35:00', entry_time_format)
end = datetime.strptime('15:55:00', entry_time_format)
current_time = start
entry_times = []
while current_time <= end:
entry_times.append(current_time.strftime(entry_time_format))
current_time += timedelta(minutes = 5)
return entry_times