MCPcopy Create free account
hub / github.com/DVampire/FinAgent / generate_dates

Function generate_dates

finagent/utils/misc.py:51–74  ·  view source on GitHub ↗
(start_date, end_date, interval_level='year')

Source from the content-addressed store, hash-verified

49 return intervals
50
51def generate_dates(start_date, end_date, interval_level='year'):
52
53 dates = []
54
55 if interval_level == 'year':
56 current_date = start_date
57 while current_date < end_date:
58 next_year = current_date.replace(year=current_date.year + 1)
59 if next_year > end_date:
60 next_year = end_date
61 date = current_date
62 dates.append(date)
63 current_date = next_year
64 elif interval_level == 'day':
65 current_date = start_date
66 while current_date < end_date:
67 next_day = current_date + timedelta(days=1)
68 date = current_date
69 dates.append(date)
70 current_date = next_day
71 else:
72 return None
73
74 return dates
75
76def find_latest_checkpoint(path, suffix='pth'):
77 """Find the latest checkpoint from the working directory.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected