diff --git a/conf/finaldata/dexorder-finaldata.toml b/conf/finaldata/dexorder-finaldata.toml index be0d742..7e905c1 100644 --- a/conf/finaldata/dexorder-finaldata.toml +++ b/conf/finaldata/dexorder-finaldata.toml @@ -3,3 +3,4 @@ ws_url = '' redis_url = '' ohlc_dir = '/ohlc' walker_flush_interval=25 +concurrent_rpc_connections=9999 diff --git a/src/dexorder/final_ohlc.py b/src/dexorder/final_ohlc.py index f735c4d..cebf552 100644 --- a/src/dexorder/final_ohlc.py +++ b/src/dexorder/final_ohlc.py @@ -24,14 +24,14 @@ class OHLCFilePath: self.period = period name = period_name(period) self.filepath = f'{symbol}/{name}/' - if period < timedelta(minutes=15): + if period < timedelta(hours=1): # one file per day is the smallest resolution # log.debug(f'{name} is daily') 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}/{start.month}/{symbol}-{name}-{start:%Y%m%d}.csv' - elif period < timedelta(hours=8): + elif period < timedelta(days=1): # one file per month # log.debug(f'{name} is monthly') self.start = start = datetime(time.year, time.month, 1, tzinfo=timezone.utc) @@ -324,10 +324,10 @@ class OHLCFileSeries: # flush quote file # try: - start_of_column = self.quote_file.tell() if self.start_time_bytes: self.quote_file.write(self.start_time_bytes) self.start_time_bytes = None + start_of_column = self.quote_file.tell() self.quote_file.write(f'{ts},{price:f}\n'.encode('ascii')) self.quote_file.truncate() self.quote_file.flush() diff --git a/src/dexorder/ohlc.py b/src/dexorder/ohlc.py index aff0cee..cd0f877 100644 --- a/src/dexorder/ohlc.py +++ b/src/dexorder/ohlc.py @@ -34,7 +34,8 @@ OHLC_PERIODS = [ timedelta(days=1), timedelta(days=2), timedelta(days=3), timedelta(days=7) ] -OHLC_DATE_ROOT = datetime(2009, 1, 4, tzinfo=timezone.utc) # Sunday before Bitcoin Genesis +# Sunday before Bitcoin Genesis. Timestamp: 1231027200 +OHLC_DATE_ROOT = datetime(2009, 1, 4, tzinfo=timezone.utc) # OHLC's are stored as [timestamp, open, high, low, close] with prices as string values. If there was no data during # the interval, then open, high, and low are None but the close value is carried over from the previous interval.