ohlc file path update
This commit is contained in:
@@ -30,7 +30,7 @@ class OHLCFilePath:
|
||||
self.start = start = datetime(time.year, time.month, time.day, tzinfo=timezone.utc)
|
||||
self.end = self.start + timedelta(days=1)
|
||||
self.file_interval = timedelta(days=1)
|
||||
self.filepath += f'{start.year}/{symbol}-{name}-{start:%Y%m%d}.csv'
|
||||
self.filepath += f'{start.year}/{start.month}/{symbol}-{name}-{start:%Y%m%d}.csv'
|
||||
elif period < timedelta(hours=8):
|
||||
# one file per month
|
||||
# log.debug(f'{name} is monthly')
|
||||
@@ -42,14 +42,14 @@ class OHLCFilePath:
|
||||
end_year += 1
|
||||
self.end = datetime(end_year, end_month, 1, tzinfo=timezone.utc)
|
||||
self.file_interval = timedelta(days=32) # it's ok to add a little more because we will find the start time of the new file.
|
||||
self.filepath += f'{start.year}/{start.month}/{symbol}-{name}-{start:%Y%m}.csv'
|
||||
self.filepath += f'{start.year}/{symbol}-{name}-{start:%Y%m}.csv'
|
||||
elif period < timedelta(days=7):
|
||||
# one file per year
|
||||
# log.debug(f'{name} is yearly')
|
||||
self.start = start = datetime(time.year, 1, 1, tzinfo=timezone.utc)
|
||||
self.end = datetime(time.year+1, 1, 1, tzinfo=timezone.utc)
|
||||
self.file_interval = timedelta(days=366)
|
||||
self.filepath += f'{start.year}/{symbol}-{name}-{start:%Y}.csv'
|
||||
self.filepath += f'{symbol}-{name}-{start:%Y}.csv'
|
||||
else:
|
||||
# weeklies get one file for everything
|
||||
# log.debug(f'{name} is a single file')
|
||||
|
||||
Reference in New Issue
Block a user