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.start = start = datetime(time.year, time.month, time.day, tzinfo=timezone.utc)
|
||||||
self.end = self.start + timedelta(days=1)
|
self.end = self.start + timedelta(days=1)
|
||||||
self.file_interval = 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):
|
elif period < timedelta(hours=8):
|
||||||
# one file per month
|
# one file per month
|
||||||
# log.debug(f'{name} is monthly')
|
# log.debug(f'{name} is monthly')
|
||||||
@@ -42,14 +42,14 @@ class OHLCFilePath:
|
|||||||
end_year += 1
|
end_year += 1
|
||||||
self.end = datetime(end_year, end_month, 1, tzinfo=timezone.utc)
|
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.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):
|
elif period < timedelta(days=7):
|
||||||
# one file per year
|
# one file per year
|
||||||
# log.debug(f'{name} is yearly')
|
# log.debug(f'{name} is yearly')
|
||||||
self.start = start = datetime(time.year, 1, 1, tzinfo=timezone.utc)
|
self.start = start = datetime(time.year, 1, 1, tzinfo=timezone.utc)
|
||||||
self.end = datetime(time.year+1, 1, 1, tzinfo=timezone.utc)
|
self.end = datetime(time.year+1, 1, 1, tzinfo=timezone.utc)
|
||||||
self.file_interval = timedelta(days=366)
|
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:
|
else:
|
||||||
# weeklies get one file for everything
|
# weeklies get one file for everything
|
||||||
# log.debug(f'{name} is a single file')
|
# log.debug(f'{name} is a single file')
|
||||||
|
|||||||
Reference in New Issue
Block a user